Post on 17-Dec-2015
157A, Fall Semester 2006157A, Fall Semester 2006
Brent TurnerBrent Turner
Presentation Contents:Presentation Contents:
1.1. What Is LaTeX?What Is LaTeX?
2.2. History of LaTeXHistory of LaTeX
3.3. LaTeX UseLaTeX Use
4.4. Typesetting – HTML vs. LaTeXTypesetting – HTML vs. LaTeX
5.5. LaTeX SyntaxLaTeX Syntax
6.6. Examples: document and formulaExamples: document and formula
7.7. ReferencesReferences
What Is LaTeX?What Is LaTeX?
• TeX – typesetting standardTeX – typesetting standard
• A TeX based document formatA TeX based document format
• Used for typesetting documentsUsed for typesetting documents
• Uses tags to request elements of a Uses tags to request elements of a document from the TeX typesetterdocument from the TeX typesetter
• Not WYSIWYGNot WYSIWYG
TeX TeX (the history of LaTeX)(the history of LaTeX)
Created by Donald E. Knuth in 1977Created by Donald E. Knuth in 1977 Ideal for typesetting text and mathematical Ideal for typesetting text and mathematical
formulaeformulae Mr. Knuth did not like the way publishers Mr. Knuth did not like the way publishers
were formatting/typesetting his articles so were formatting/typesetting his articles so he set up his own standard for authorshe set up his own standard for authors
His website –
www-cs-faculty.stanford.edu/~knuth
History of LaTeXHistory of LaTeX
LaTeX is pronounced “Lay-tech,” with a “k” LaTeX is pronounced “Lay-tech,” with a “k” sound, it is not pronounced “latex” as in sound, it is not pronounced “latex” as in rubber.rubber.
The “ch” originates from the Greek The “ch” originates from the Greek alphabet where X is the letter “ch” or “chi”.alphabet where X is the letter “ch” or “chi”.
textex is also the first syllable of the Greek is also the first syllable of the Greek word word textexnologia (technology).nologia (technology).
The LaTeX program is a macro package that allows authors to use TeX easily. It is similar to a simple programming language
It is very stable and can run on almost any It is very stable and can run on almost any computercomputer
History of LaTeX - contHistory of LaTeX - cont
LaTeX UseLaTeX Use
1.1. Download and install the free software.Download and install the free software.2.2. Setup can be tricky, it is OS/machine Setup can be tricky, it is OS/machine
dependant.dependant.3.3. When using LaTeX, all document formatting is When using LaTeX, all document formatting is
embedded within the text.embedded within the text.4.4. LaTeX uses control sequences (tags), which LaTeX uses control sequences (tags), which
consist of a backslash (\) followed by a string consist of a backslash (\) followed by a string of letters, possibly contained within { }, to of letters, possibly contained within { }, to indicate the format of the text.indicate the format of the text.
(see examples later)(see examples later)
LaTeX fundamentalsLaTeX fundamentals
An author writes a LaTeX input file in a text
editor and then compiles this using LaTeX.
An input file has literal text along with commands
to process the text. There are some conceptual
similarities to a markup language such as HTML.
However, a fundamental difference is that LaTeX
is designed as a page layout language, unlike
HMTL which is functional markup. The whole
point of LaTeX is to achieve perfect typographic
output, which is not the purpose of HTML.
Typesetting – HTML vs. LaTeXTypesetting – HTML vs. LaTeX
SyntaxSyntax
Using LaTeX to produce a document:Using LaTeX to produce a document:\documentclass\documentclass\begin{document}\begin{document} (The text is typed here)(The text is typed here)
……\end{document}\end{document}
LaTeX will automatically indent and put it in paragraph LaTeX will automatically indent and put it in paragraph form.form.
To not indent a paragraph, we can use the \noindent tag To not indent a paragraph, we can use the \noindent tag at the beginning of the paragraph.at the beginning of the paragraph.
See the documentation for a complete list of tags.See the documentation for a complete list of tags.
Tags – a short listTags – a short list
Control SequencesControl Sequences Text FormatText Format
\textrm\textrm Roman fontRoman font
\textsf\textsf Sans serif fontSans serif font
\texttt\texttt Typewriter fontTypewriter font
\textup\textup Upright shapeUpright shape
\textit\textit Italic shapeItalic shape
\textsl\textsl Slanted shapeSlanted shape
\textsc\textsc Small caps shapeSmall caps shape
\textmd\textmd Medium fontMedium font
\textbf\textbf Bold faceBold face
\emph\emph EmphasizedEmphasized
Example:Example:
\documentclass{article}\documentclass{article}
\begin{document}\begin{document}
\textrm{PERL How To Program}\textrm{PERL How To Program}
\texttt{by Deitel, Nieto, and McPhie}\texttt{by Deitel, Nieto, and McPhie}
\textsl{1.8 Object-Oriented Programming}\textsl{1.8 Object-Oriented Programming}
\textsc{\textbf{One} of the key problems with procedural programming is that the program \textsc{\textbf{One} of the key problems with procedural programming is that the program units programmers create do not easily mirror \emph{real-world} entities effectively.}units programmers create do not easily mirror \emph{real-world} entities effectively.}
\end{document}\end{document}
Mathematical Formula ExampleMathematical Formula Example
\documentclass{article}\documentclass{article}
\begin{document}\begin{document}
\noindent\noindent
The \textbf{variance} of a continuous random variable $X$ with pdf $f(x)$ The \textbf{variance} of a continuous random variable $X$ with pdf $f(x)$ and mean value $\mu$ is and mean value $\mu$ is
\[\sigma_X^2 = V(X) = \int_{-\infty}^\infty (x - \mu)^2 \bullet f(x)dx = E[(X - \\[\sigma_X^2 = V(X) = \int_{-\infty}^\infty (x - \mu)^2 \bullet f(x)dx = E[(X - \mu)^2]\]mu)^2]\]
The \textbf{standard deviation} (SD) of $X$ is $\sigma_X = \sqrt{V(X)}$.The \textbf{standard deviation} (SD) of $X$ is $\sigma_X = \sqrt{V(X)}$.
\end{document}\end{document}
This example prints the definition of variance and standard deviation This example prints the definition of variance and standard deviation
using LaTeX syntax.using LaTeX syntax.
Result:Result:
Trying to do this in MSWord, or other popular WYSIWYG editor = too much work!
ReferencesReferences
• http://www.maths.tcd.ie/~dwilkins/LaTeXPrimerhttp://www.maths.tcd.ie/~dwilkins/LaTeXPrimer• http://www.latex-project.org/http://www.latex-project.org/
• John Eagle, Wen Gao; Spring 2006 cs157aJohn Eagle, Wen Gao; Spring 2006 cs157a
• http://en.wikipedia.org/wiki/LaTeXhttp://en.wikipedia.org/wiki/LaTeX