Introduction Latex
- 2. What is Latex?
How to start with LaTeX?
How to use LaTeX to write a paper?
What about mathematic and technical texts?
How can create reference and the other special
sections?
2
- 6. Installation Latex
6
Editors
——————
TeXmaker
TeXtudio
…..
Distributions 2
Window MiKTeX
MacOS MacTex
Linux, MacOS,
Window
TeX Live
1
- 9. The Latex Syntax
9
Spaces
Reserved Characters
# $ % ^ & _ { } ~
Comment
started by % character
LaTeX group
between braces {…}
- 12. Common Elements
• Document Structure
• Macro Packages
• Text Fonts
• Special Characters
• Importing Graphics
• Table
- 13. Document structure
• Document Class
documentclass[options]{class}
options = a4paper, 11pt, 12pt, 10pt, onecolumn,
twocolumn, landscape,...
class = article, report, book,…
• Start with begin{document}
• End with end{document}
13
- 15. Document Structure
• Sections
section{…} = 1. Latex is Great
subsection{…} = 1.1 Why Latex is Great
subsubsection{…} = 1.1.1 Reason One
appendix - changes numbering scheme
chapter{…} - To be used with book and report document
classes
• Titles, Authors
title{…} author{…}
15
- 17. Packages
• Add-on features for
Latex are know as
Package
• Allow you to use
special commands
usepackage[options]{pack
age_name}
17
- 22. Special Characters
• The following symbols are reserved:
# $ % & _ { } ^ ~
• To include them in your text:
# $ % & _ { } ^{} ~{}
• Note: you cannot just do (which is a
linebreak) , but instead:
$backslash$
22
- 25. Importing Graphics
• Use the graphicx package
usepackage{graphicx}
• Supported image formats
- Compiling with latex: .esp
- Compiling with pdflatex: .jpg, jpeg, png,
pdf, eps
25
- 26. Importing Graphics
begin{figure}
includegraphics[attr1=val1, attr2=val2, ...,
attrn=valn]{imagename}
caption{The graph of Gaussian function}
label{fig:1}
end{figure}
26
- 29. Table
• Syntax
begin{table} [!t] % define a table
caption{Table Example} % table’s name
label{table_example} % reference laber
centering
<table content>
end{tabular}
end{table}
29
- 30. Table example
30
begin{table} [!t]
caption{Table Example}
label{table_example}
centering
begin{tabular}{|c|c|}
hline
Line 1 column 1 & Line 1 column 2
hline
Line 2 column 1 & Line 2 column 2
hline
Line 3 column 1 & Line 3 column 2
hline
hline
end{tabular}
end{table}
- 31. Table spacing
31
begin{table} [!t]
renewcommand{arraystretch}{2}
caption{Table Example}
label{table_example}
centering
begin{tabular}{|c|c|}
hline
Line 1 column 1 & Line 1 column 2
hline
Line 2 column 1 & Line 2 column 2
hline
Line 3 column 1 & Line 3 column 2
hline
hline
end{tabular}
end{table}
2
4
- 32. Equation in Table
32
begin{table} [!t]
caption{Table Example}
label{table_example}
centering
begin{tabular}{|c|c|}
hline
Line 1 column 1 & text{emph{A} = $frac {{{B +
C}}^2} D$}
hline
Line 2 column 1 & Line 2 column 2
hline
Line 3 column 1 & Line 3 column 2
hline
hline
end{tabular}
end{table}
- 35. Mathematic
• Two ways to form equations
– Using ‘$’: $ equation syntax $
– Using commands:
begin{equation}
label{equation_label}
Insert equation syntax here
end{equation}
• Syntax can be generated with software packages like
MathType or TeXaide
35
- 38. Algorithm Example
38
begin{algorithm}[!t]
caption{Algorithm Test 1}
label{alg1}
begin{algorithmic}[1]
State text{Determine initial condition}
While {emph {V(A) = 1}}
State text{ emph{V(B) = 2} }
State text{ emph{V(C) = 3} }
State text{ emph{V(D) = 4} }
EndWhile end{algorithmic}
end{algorithm}
- 39. Equation in Algorithm
Example
39
begin{algorithm}[!t]
caption{Algorithm Test 1}
label{alg1}
begin{algorithmic}[1]
State text{emph{A} = $frac {{{B + C}}^2} D$}
EndWhile end{algorithmic}
end{algorithm}
- 40. Long Algorithm Example
begin{algorithm}[!h]
caption{Algorithm Test 1}label{alg1}
begin{algorithmic}[1]
State text{This is the first part of my algorithm}
State text{This is the end of the first part}
algstore {store_var}
end {algorithmic}
end {algorithm}
begin{algorithm}[!h]
ContinuedFloat
caption{Algorithm Test 1
emph{(continue)}}label{alg1}
begin{algorithmic} [1]
algrestore{store_var}}
State text{This is the second part of my algorithm}
State text{This is the end of the second part}
end{algorithmic}
end{algorithm}
40
- 46. The authors would like to thank Prof. Saxena
for giving us a chance to introduce this tutorial to
all of our friends.
Editor's Notes
- LaTeX (pronounced either "Lah-tech" or "Lay-tech") is a macro package based on TeX created by Leslie Lamport. Its purpose is to simplify TeX typesetting, especially for documents containing mathematical formulae. Within the typesetting system, its name is formatted as LATEX.
Many later authors have contributed extensions, called packages or styles, to LaTeX. Some of these are bundled with most TeX/LaTeX software distributions; more can be found in the Comprehensive TeX Archive Network (CTAN).
Since LaTeX comprises a group of TeX commands, LaTeX document processing is essentially programming. You create a text file in LaTeX markup, which LaTeX reads to produce the final document.
- more complex document more time in ms-word
- now you know what is latex
- open source -> many version
- the first time open
- these very simple things
Backslash \ Braces { } sign $ Caret ^ Underscore _ Percent % Number # And&
- let start to write a paper!
- some thing look like a paper
- Sometimes it is necessary to not rely on the breaking algorithm when using the p specifier, but rather specify the line breaks by hand. In this case it is easiest to use a \parbox:
\begin{tabular}{cc} boring cell content & \parbox[t]{5cm}{rather long par\\new par}\end{tabular}
Space between columns[edit]
To tweak the space between columns (LaTeX will by default choose very tight columns), one can alter the column separation: \setlength{\tabcolsep}{5pt}. The default value is 6pt.
Space between rows[edit]
Re-define the \arraystretch command to set the space between rows:
\renewcommand{\arraystretch}{1.5}