L A T EX Lecture for UNIST Jaewoong Lee Ulsan National Institute - - PowerPoint PPT Presentation

l a t ex lecture for unist
SMART_READER_LITE
LIVE PREVIEW

L A T EX Lecture for UNIST Jaewoong Lee Ulsan National Institute - - PowerPoint PPT Presentation

L A T EX Lecture for UNIST Jaewoong Lee Ulsan National Institute of Science and Technology jwlee230@unist.ac.kr October 28, 2019 Jaewoong Lee (UNIST) UNIST L T EX October 28, 2019 1 / 38 A Overview Introduction myself 1 What is L A T


slide-1
SLIDE 1

L

AT

EX Lecture for UNIST

Jaewoong Lee

Ulsan National Institute of Science and Technology jwlee230@unist.ac.kr

October 28, 2019

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 1 / 38

slide-2
SLIDE 2

Overview

1

Introduction myself

2

What is L

AT

EX?

3

Hello World Example

4

Introduction to L

AT

EX

5

Advanced typesetting of L

AT

EX

6

Equation, Figure and Table

7

Reference Control

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 2 / 38

slide-3
SLIDE 3

I am...

Jaewoong Lee Senior at UNIST L

AT

EX user since 2014 Graduated Gyeonggi Science High School for the Gifted in 2016 Full Member of GSHS TeX User Association

Figure: GSHS TeX User Association

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 3 / 38

slide-4
SLIDE 4

What you could with L

AT

EX?

From a simple report to a presentation. This presentation file is also made by L

AT

EX. You can do almost everything in written form.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 4 / 38

slide-5
SLIDE 5

Refer this page

https://fumire.moe/Lecture/latex/

You can easily get TeX code in this lecture from here! You can get a installation guide, also!

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 5 / 38

slide-6
SLIDE 6

L

AT

EX?

LAH-tekh or LAY-tekh TeX-like editing tool In simple, that which is making a paper. Donald Knuth made TeX ⇛ L

AT

EX: a macro for TeX WYSIWYM

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 6 / 38

slide-7
SLIDE 7

WYSIWYG vs. WYSIWYM

WYSIWYG What you see is what you get MS Word or HWP WYSIWYM What you see is what you mean HTML, L

AT

EX

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 7 / 38

slide-8
SLIDE 8

L

AT

EX (cont.)

You write the contents, then L

AT

EXmakes it! Useful to write an equation As an equation editor, L

AT

EX is a de facto standard Convenient labeling & referencing After initial setting, you only think about contents; not design Table of contents, List of figures? ⇛ Only one line command! Cross-referencing: ’As figure 8a’ ⇛ You can see ’Big Picture’ Easily attach vector image like SVG & PDF

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 8 / 38

slide-9
SLIDE 9

L

AT

EX vs. MS word

Figure: L

AT

EX vs. MS word

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 9 / 38

slide-10
SLIDE 10

L

AT

EX vs. MS word (cont.)

L

AT

EX users were slower than Word users. L

AT

EX users wrote less text in the same amount of time. L

AT

EX users produced more typesetting, orthographical, grammatical, and formatting errors. L

AT

EX users more often report enjoying using their respective software. According to Knauff, M., & Nejasmic, J. (2014). An efficiency comparison

  • f document preparation systems used in academic research and
  • development. PloS one, 9(12), e115069.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 10 / 38

slide-11
SLIDE 11

Hello World for L

AT

EX

Example (Hello World)

\documentclass{article} \title{Hello world} \author{John Doe} \date{September 2019} \begin{document} \maketitle Lorem ipsum dolor sit amet. \end{document}

1 This is an article. 2 The title is ’Hello world’. 3 The author is ’John Doe’. 4 Written in September 2019. 5 This document contains a title

and a sentence.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 11 / 38

slide-12
SLIDE 12

Structure of L

AT

EX

Preamble In simple, a header of document. Declare class of document, packages, et cetera. Make a declaration of settings, also. Body Whole thing after \begin{document} Similar as editing mode in Wikipedia.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 12 / 38

slide-13
SLIDE 13

Hierarchy of Document

1 \document 2 \part 3 \chapter 4 \section 5 \subsection 6 \subsubsection 7 \paragraph 8 \subparagraph Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 13 / 38

slide-14
SLIDE 14

Table of Contents

Only one line command is required to make ’Table of Contents’.

Example (ToC code)

\documentclass{article} \begin{document} \tableofcontents \section{one} \subsection{two} \end{document} As the example, just add \tableofcontents command where you want.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 14 / 38

slide-15
SLIDE 15

Special Characters

You cannot use these character directly:

Special Characters

\, #, $, %, &, {, }, As following block, this problem has been solved by adding backslash in front of the character:

Using Special Characters

\textbackslash, \#, \$, \%, \&, \{, \}, \ Moreover, % means one line comment in L

AT

  • EX. Please refer here1 when

you want multiple line comment.

1http://bit.ly/2iZi3yn Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 15 / 38

slide-16
SLIDE 16

Spacing & Line Break

Even if there are so many spaces in L

AT

EX code, there is only one space in the result. If you want to use many spaces, use ’\ ’ instead. In the same way, there are so many line breaks in L

AT

EX code, there is only

  • ne line break. When you want to line breaks, use ’\\’ instead.

Furthermore, twice of line break start new paragraph in L

AT

EX.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 16 / 38

slide-17
SLIDE 17

Page Break

Use \newpage or \clearpage. When make a book, use \cleardoublepage.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 17 / 38

slide-18
SLIDE 18

Text Aligning

Align Text Left. Use flushleft. Justify Text. Use center. Align Text Right. Use flushright. In using flushleft, center or flushright, please refer following:

Text Aligning

\begin{flushright} Right Aligned Text is here. \end{flushright}

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 18 / 38

slide-19
SLIDE 19

Text Color

This example shows different examples on how to user the xcolor package to change the color of elements in L

AT

EX.

Example (xcolor code)

\documentclass{article} \usepackage{xcolor} \begin{document} \textcolor{green} {Hello,} \colorbox{orange} {world!} \end{document}

Example (color showing)

Hello, world!

1Reference: http://bit.ly/2UssO6a Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 19 / 38

slide-20
SLIDE 20

Font Styles

Bold: \textbf{...} Italic: \textit{...} Sans-serif : \textsf{...} Underline: \underline{...} Small Capitals: \textsc{...}

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 20 / 38

slide-21
SLIDE 21

Strikethrough

There are two ways to add strikethrough. First, use ulem package.

Example (ulem code)

\documentclass{article} \usepackage{ulem} \begin{document} \sout{Hello, world!} \end{document}

Example (ulem showing)

Hello, world!

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 21 / 38

slide-22
SLIDE 22

Strikethrough (cont.)

Second, use cancel package.

Example (cancel code)

\documentclass{article} \usepackage{cancel} \begin{document} \[ x + \cancel{y}=0 \] \[ x + \bcancel{y}=0 \] \[ x + \xcancel{y}=0 \] \[ x + \cancelto{0}{y}=0 \] \end{document}

Example (cancel showing)

x + ✓ y = 0 x + ❙ y = 0 x + ✓

y = 0 x +✓

✓ ✼

y = 0

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 22 / 38

slide-23
SLIDE 23

Page Setup

Suppose you have to create a document in a4paper and text should not exceed 18 cm in width and 20 cm in height. To create it with geometry package is easy, include this one line in the preamble.

geometry Example

\usepackage[a4paper, total={18cm, 20cm}]{geometry} If you need detailed page setting, you can do like this:

geometry Detailed Example

\usepackage{geometry} \geometry {a4paper, left=20mm, right=25mm, top=3cm, bottom=4in}

1Reference: http://bit.ly/34nbbJC Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 23 / 38

slide-24
SLIDE 24

Multi-Column

In L

AT

EX, you can use multi-column as:

Example (Multi-column Example)

\documentclass[twocolumn]{report} If you want to change columns in the document, you can use

Example (Multi-column Example 2)

\twocolumn \onecolumn However, this commands always starts new pages.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 24 / 38

slide-25
SLIDE 25

Multi-Column (cont.)

In case of that problem, use multicol package.

Example (multicol code)

\documentclass{article} \usepackage{multicol} \setlength{\columnseprule} {0.4pt} \begin{document} \begin{multicols}{2} Lorem ipsum \newpage dolor sit amet, \newline consectetur \end{multicols} \end{document}

Example (multicol showing)

Lorem ipsum dolor sit amet, consectetur

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 25 / 38

slide-26
SLIDE 26

Text Box

You can add text box with tcolorbox package.

Example (tcolorbox code)

\documentclass{article} \usepackage{tcolorbox} \begin{document} \begin{tcolorbox} The quick brown fox jumps right over the lazy dog. \end{tcolorbox} \end{document}

Example (tcolorbox showing)

The quick brown fox jumps right over the lazy dog.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 26 / 38

slide-27
SLIDE 27

Equation

For entering equation, amsmath package is required. \( ... \): In-line equation. eiπ + 1 = 0 \[ ... \]: Equation without number. eiπ + 1 = 0 \begin{equation} ... \end{equation}: Equation with number. eiπ + 1 = 0 (1) You can reference the number of equation. (In advance)

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 27 / 38

slide-28
SLIDE 28

Equation (cont.)

\sin{...}: sin{...} \log {...}: log{...} To avoid italic style. \frac {num}{den}: num

den

\sqrt[n]{x}:

n

√x \begin{pmatrix} x & y \\z & v \end{pmatrix} : x y z v

  • dt \operatorname{d}t, \partial \!t, \nabla \psi: dt, dt, ∂t, ∇ψ

f’, f”, f ˆ {3}, \dot y, \ddot y: f ′, f ′′, f (3), ˙ y, ¨ y \int {-N} ˆ {N} eˆ x \, dx: N

−N ex dx

\oint {C} xˆ 3\, dx :

  • C x3 dx

1Reference: http://bit.ly/2UALRLP Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 28 / 38

slide-29
SLIDE 29

Equation*

When you do not want number while using \begin{equation}, using equation* instead:

Example (equation* example)

\begin{equation*} e^{i \pi}+1=0 \end{equation*} Or, add \nonumber just after equation:

Example (\nonumber example)

\begin{equation} e^{i \pi}+1=0 \nonumber \end{equation}

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 29 / 38

slide-30
SLIDE 30

Figure

Basic example of figure is following:

Example (Basic Figure Example)

\usepackage{graphics, graphicx} \begin{figure}[htbp] \centering \includegraphics[width=5cm]{example.png} \end{figure} htbp means Here ⇛ Top ⇛ Bottom ⇛ Page. The ordering means priority

  • f figure location. You can change figure location setting.

You can add JPG, GIF, PNG, PDF, and more.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 30 / 38

slide-31
SLIDE 31

Table

Use online L

AT

EX table generator. 2

Example (Table code)

\begin{table}[htbp] \centering \begin{tabular}{l||c|r}

  • No. & Name & Sex \\ \hline

1 & John & M \\ 2 & Jane & F \end{tabular} \end{table}

Example (Table example)

No. Name Sex 1 John M 2 Jane F

2https://www.tablesgenerator.com Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 31 / 38

slide-32
SLIDE 32

Caption

All figures and tables can be attached with caption. You can explain what a meaning of figure or table.

Example (Table code)

\begin{table}[htbp] \centering \caption{Example Table} \begin{tabular}{l||c|r}

  • No. & Name & Sex \\ \hline

1 & John & M \\ 2 & Jane & F \end{tabular} \end{table}

Example (Table example)

Table: Example Table

No. Name Sex 1 John M 2 Jane F

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 32 / 38

slide-33
SLIDE 33

Label

A label can be attached to equations, figures, tables and section. Also, the number of label is automated increasing. A label is added by \label command:

Example (Add label)

\label{tb:example} Moreover, you can refer specific label with \ref command:

Example (Refer label)

\ref{tb:example}

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 33 / 38

slide-34
SLIDE 34

LoF & LoT

As same as ’Table of Contents’, you can easily add ’List of Figures’ and ’List of Tables’. Just add one line command, \listoftables and \listoffigures where you want.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 34 / 38

slide-35
SLIDE 35

BibTex

BibTex is reference management software for formatting lists of references. As you know, BibTex is came from bibliography and L

AT

EX.

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 35 / 38

slide-36
SLIDE 36

How can I get BibTex?

Google Scholar gives BibTex citation. You can copy and paste it.

Figure: Google Scholar gives BibTex

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 36 / 38

slide-37
SLIDE 37

How can I cite?

Only one line command is enough:

Example (Citation example)

\cite{ref:label} If you want multiple citation at once, use this command instead:

Example (Multiple citation example)

\cite{ref:label1, ref:label2}

Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 37 / 38

slide-38
SLIDE 38

How can I cite? (cont.)

For a list of references, add these commands where you want:

Example (Reference example)

\bibliographystyle{apalike} \bibliography{BibTex_Name} Moreover, these styles can be used:

1 abbrv 2 acm 3 alpha 4 apalike 5 ieeetr 6 plain 7 siam 2Reference: http://bit.ly/34of80o Jaewoong Lee (UNIST) UNIST L

A

T EX October 28, 2019 38 / 38