View
257
Download
2
Category
Preview:
Citation preview
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
1
LATEXA Document Preparation System2014
Danie ElsDept of Mech & Mechatron Eng, Stellenbosch University
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
2
Outline
1 Introduc on
2 LATEX command syntax
3 Basic LATEX document layout
4 Bibliography
5 LATEX installa on
6 Stellenbosch
7 Links
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
3
Introduc on
What is TEX?
TEX is a typese ng system wri en by Donald E. Knuth, whosays in the Preface to his book on TEX that it is “intended forthe crea on of beau ful books — and especially for books thatcontain a lot of mathema cs.”
TEX is a macro processor, and offers its users a powerfulprogramming capability. TEX on its own is a pre y difficultbeast to deal with, so Knuth provided a package of macros foruse with TEX called Plain TEX;
𝜕𝜌𝜕𝑡 = div(𝜌𝒗 )
𝜌D𝒗D𝑡 = 𝜌𝒈 +𝜕𝜕𝑥 𝜇 𝜕𝑣
𝜕𝑥 +𝜕𝑣𝜕𝑥 + 𝛿 𝜆 div 𝒗
𝜌D𝑒D𝑡 = div(𝑘𝛁𝑇)
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
4
What is LATEX?
LATEX is a TEX macro package, originally wri en by LeslieLamport, that provides a document processing system.LATEX allows markup to describe the structure of adocument, so that the user need not think aboutpresenta on. By using document classes and add-onpackages, the same document can be produced in avariety of different layouts.
LATEX is for producing scien fic and mathema caldocuments of high typographical quality and is alsosuitable for producing all sorts of other documents, fromsimple le ers to complete books.
LATEX is not a word processor! Instead, LATEX encouragesauthors not to worry too much about the appearance oftheir documents but to concentrate on ge ng the rightcontent.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
5
LATEX vs MS Word
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
6
WYSIWYG vs Markup languages
Word processors (WYSIWYG)Microso Word, Open Office, etc.Have a WYSIWYG interface hiding the markup.They’re perceived to be easier than LATEX, but ...
Markup languagesWri en in normal text with markup in a text editor.Needs to be interpreted or compiled (programminglanguage)
HTMLLATEX
Contents separated from format; uses style sheets tochange appearance.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
7
HTML Example
<html><head>
<title>HTML Example</title></head><body>
<p><b>Hello</b> world
</p></body>
</html>
Output
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
8
LATEX Example
\documentclass{article}\begin{document}
If $f(x)=3x+7$ and $g(x)=x+4$ then\begin{equation}
f(x) + g(x) = 4x + 11\end{equation}and\begin{equation}
f(x)g(x) = 3x^2 + 19x +28.\end{equation}
\end{document}
OutputIf 𝑓(𝑥) = 3𝑥 + 7 and 𝑔(𝑥) = 𝑥 + 4 then
𝑓(𝑥) + 𝑔(𝑥) = 4𝑥 + 11 (1)and
𝑓(𝑥)𝑔(𝑥) = 3𝑥 + 19𝑥 + 28. (2)
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
9
\documentclass{article} \begin{document} Hello world \end{document}
Hello world
myfile.tex
Hello world
myfile.dvi myfile.pdf
Create and edit
document
Compile
View and print
>pdflatex myfile.tex >latex myfile.tex
>dvips myfile.dvi >ps2pdf myfile.ps
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
10
Why use LATEX?
Very high quality documents.The most sophis cated math typese ng engineavailable.Sophis cated page, paragraph and line breaks withhyphena on.Micro typographical ligatures, le ers spacing, hangingpunctua on, etc.Floa ng figures for op mal page layout with graphics andtables.Easy cross referencing of equa ons, figures, etc. withhyperref links.Powerful linkage to bibliography databases, ci ngmechanisms and bibliography forma ng.Automa c tables of contents.Automa c language se ngs.Did I men oned very high quality documents.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
11
Micro typese ng
✓ ×Kerning Table, Avant Table, Avant
Ligatures fire, office fire, office
Le erspace D a n i e Danie
True small caps C T CAPE TOWN
Hanging Punct
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
12
LATEX command syntax
Ac ve chars # $ % ˆ & _ { } \\ – escape char to ac vate commands$ – ac vate math% – comment char
Special chars\”{e}, {\O} – gives ë, Ø
Inline commands\rmfamily, \itshape, etc.
Macros\section{Syntax} – cmnd with argument\func[x]{cos} – cmnd with op onal arg
Environments\begin{itemize}
\item ...\end{itemize}
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
13
Basic LATEX document layout
\documentclass[a4paper,12pt]{article}
% Preamble -------------------------\usepackage{amsmath}
% Beginning of main document -------\begin{document}
\section{Functions}% Heading ----
In equation (\ref{eq:a}) the quadraticfunction of $x$ is shown as\begin{equation}
f(x)=ax^2 + bx + c\label{eq:a}
\end{equation}It can be shown that $x \geq \sqrt{\alpha}$ and ...
\end{document}
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
14
Output
1. Func ons
In equa on (1) the quadra c func on of 𝑥 is shown as
𝑓(𝑥) = 𝑎𝑥 + 𝑏𝑥 + 𝑐 (1)
It can be shown that 𝑥 ≥ √𝛼 and ...
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
15
LATEXclasses
\documentclass[a4paper,12pt]{article}
Specify the basic forma ng of the document: Type block,headers, tle page, paragraph indents and spacing, etc.Op onal se ngs for paper size, font size, etc.
ar cle, report, book: Standard LATEX classesmemoir, koma: Other useful specialized classesamsart, elsivier, etc.: Journal classesusthesis: Stellenbosch thesis class
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
16
LATEXpackages
\usepackage{amsmath}
There are hundreds of different packages available on CTANfor any thing you can think of. Some useful packages fortheses are:
amsmath: Advanced mathema cal typese nghyperref: Hyper links in PDF documentsgraphicx: Inclusion of graphicsarray: For tables and arrayssiunitx: Type se ng of units and numbersfourier: A very nice complete font set
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
17
Main document
\begin{document}....
\end{document}
This is the main contents of the document.
Headings
\section{Functions}
LATEX has a hierarchy of headings\part\chapter\sec on, \subsec on, \subsubsec on\paragraph, \subparagraph
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
18
Paragraph text
In equation (\ref{eq:a}) the quadraticfunction of $x$ is shown.
This is a new paragraph.
A new paragraph is terminated by an open line in the text.
Math
\begin{equation}f(x)=ax^2 + bx + c
\end{equation}
Mathema cs can be wri en inline as $ x=3 $ or as displaymath as in example above.
The AMS math package gives a wealth of different ways toformat difficult equa ons and please RTFM!
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
19
Cross references
In equation (\ref{eq:a}) the quadraticfunction of $x$ is shown\begin{equation}
f(x)=ax^2 + bx + c\label{eq:a}
\end{equation}
OutputIn equa on (1) the quadra c func on of 𝑥 is shown
𝑓(𝑥) = 𝑎𝑥 + 𝑏𝑥 + 𝑐 (1)
The \label{...} and \ref{...} commands provide a verypowerful way to cross ref all the sec oning levels, equa ons,figures and tables, etc.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
20
Lists
Enumerate:\begin{enumerate}
\item The first item\item The second item
\end{enumerate}
Output1. The first item2. The second item
Itemize:\begin{itemize}
\item The first item\item The second item
\end{itemize}
Output• The first item• The second item
Descrip on:\begin{description}
\item[First] item\item[Second] item
\end{description}
OutputFirst item
Second item
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
21
Tables and figures
Figures
\begin{figure}\includegraphics{myfigure}\caption{A beautiful figure}\label{fig:1}
\end{figure}
Figures can be included from external files (or generatedinside LATEX). They float to where LATEX find it best.
LATEX: PostScriptPDFLATEX: PDF, PNG, JPEG, MPOST
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
22
Tables\begin{table}\begin{tabular}{l*{6}{c}r}
\hlineTeam & P & W & D & L & F & A & Pts \\\hlineManchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12 \\Celtic & 6 & 3 & 0 & 3 & 8 & 9 & 9 \\Benfica & 6 & 2 & 1 & 3 & 7 & 8 & 7 \\\hline
\end{tabular}\end{table}
Output
Team P W D L F A Pts
Manchester United 6 4 0 2 10 5 12Cel c 6 3 0 3 8 9 9Benfica 6 2 1 3 7 8 7
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
23
Bibliography
The BibTEX companion program makes it possible to link abibliographic database direct into a LATEXdocument.
BibTEX data item@ARTICLE{Ciamarra-2005,author = {Ciamarra, M. and Coniglio, A. and Nicodemi, M.},title = {Shear instabilities in granular mixtures},journal = {Physical Review Letters},year = {2005},volume = {94},number = {18},pages = {18 -- 24}}
In text
\cite{Ciamarra-2005} → Ciamarra et al. (2005)
List of references:Ciamarra, M., and Coniglio, A., and Nicodemi, M. (2005). Shearinstabilities in granular mixtures. Physical Review Letters, vol. 94,no. 18, pp. 18 – 24.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
24
Full func onal LATEX installa on
For a proper working LATEX installa on you need the following:
1 A LATEX system with programs and packages.2 A LATEX text editor (IDE)3 A BibTEX bibliographic database manager4 Graphics so ware.
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
25
LATEX distribu ons
The LATEX distribu ons provide comprehensive TEX/LATEX systemswith binaries for Linux, Windows and Apple Mac OS X. Itincludes all the major TEX-related programs, macro packages,and fonts, including support for many languages around theworld.
Linux, Windows
Windows
Mac OS X
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
28
Stellenbosch LATEX bundle
USthesis Class/style files to typeset reports, theses anddisserta ons that conform to the requirements ofStellenbosch University.
USbib A BibTEX package for the forma ng of bibliographicreferences of theses.
US tle A package that redefine the tle page to add a logoat the top and an address line below the author.
USnomencl Simple u lity to set a nomenclature or list ofsymbols.
USsummary Summary page required for the final year projects ofthe M&M Department.
USlogos A collec on of Stellenbosch University crest andlogos and Engineering logos.
These packages are all part of the standard TEXLive and MiKTEXdistribu on. Do not use old versions!
LATEX
Outline
Introduc onWhat is TEX and LATEX?
WYSIWYG vs Markup
Why use LATEX?
Syntax
Doc layoutClasses
LATEXpackages
Main document
Headings
Paragraph text
Math
Cross references
Lists
Tables and figures
Bibliography
LATEX installa on
Stellenbosch
Links
29
Links
This document & LATEX install
http://mecheng.sun.ac.za/index.php/en/general
For more informa on on LATEX:
http://latex-project.orghttp://latex-project.org/guideshttp://www.tug.orghttp://www.tug.org/interest.htmlhttp://www.ctan.org
Tutorials & wikishttp://www.ctan.org/pkg/lshort-englishhttp://en.wikibooks.org/wiki/LaTeXhttp://www.andy-roberts.net/writing/latexhttp://latex.silmaril.ie/formattinginformationhttp://tug.org/tutorials/tugindiahttp://csweb.ucc.ie/~dongen/LAF/LAF.html
Recommended