Download presentation
Presentation is loading. Please wait.
Published byVirgil Griffin Modified over 9 years ago
1
Introduction to Unix – CS 21 Lecture 16
2
Lecture Overview LaTeX History Running and creating LaTeX documents Documents and Articles Tables Lists Fonts Math mode
3
LaTeX – What Is It? A general markup language LaTeX is a system that describes how documents should appear on paper Formatting Margins Section Headings Special characters
4
Other Examples Of Markup Languages HTML Hypertext markup language Used to describe how web pages appear A little bit of interpretation is still required and pages may look different on different browsers SGML Allows for the construction of special constructs
5
Where Did It Come From? TeX 1977 – Donald Knuth Low level formatting details Constructed to make mathematical books look good LaTeX 1980’s – Leslie Lamport A layer of abstraction on top of TeX
6
Why Not Just Use Word? Main reason: Bugs TeX has long had a bounty for serious bugs that no one can collect on Secondary reason: LaTeX does what you tell it to LaTeX doesn’t try to out-think you and put figures where it believes them to be best
7
O.K., How Does Latex Work? Latex works on plain text files that are annotated with commands Commands are of the form: \command{parameter} Example: \documentclass{article} Document class tells LaTeX what type of document you are creating Books have chapters, articles have sections, etc. Most common: article, book, letter, report, slides
8
What’s With The Braces? LaTeX uses the braces for grouping like parenthesis { text } is the same as simply text Commands inside braces (like changing fonts) only apply inside the braces Example: { \sf This is in a serif font } And this is not
9
What Does A LaTeX File Look Like?
10
How Do I Get A Printable Paper Out? Usage: latex document.tex This creates several files document.aux, document.log, document.dvi document.idx, document.toc, document.lof xdvi document.dvi Views the document dvips –o document.ps document.dvi
11
Example LaTeX Run
12
What To Do When Something Goes Wrong Latex will pop up with an error message whenever it encounters a problem Malformed or unknown command Simplest thing to do: Simply hit return and ignore whatever command LaTeX had problems with Alternative: type I followed by the correct command to replace the problem Example: I\end{document}
13
Sample Run With Problems
14
Example Latex File
15
Example Output dvi1.JPG
16
What Are Comments Doing In A Document? Might seem a little weird coming from using Word LaTeX can define new commands and can be confusing at times LaTeX is not a programming language like perl or awk
17
Normal Text All paragraphs of normal text are simply typed in without any commands. Spacing is not taken into account, and all spaces get reduced to one space Example: this is the same
18
Normal Text Example
19
Normal Text Output dvi2.JPG
20
Common Constructs Italics and Bolding Sectioning Lists Tables Footnotes Mathematical formulas
21
Italics And Bolding \emph{text to be emphasized} \bf Changes the font to a bolder font
22
Italic And Bolding Example
23
Sectioning Commands NameLevel \part \chapter0 \section1 \subsection2 \subsubsection3 \paragraph4 \subparagraph5
24
Section Example
25
Sectioning Output
26
Unnumbered Sections \section{Section Name} Always numbers the section You can change the format of sections numbers if you’d like \section*{Section Name} Will output an unnumbered section
27
Unnumbered Example
28
Unnumbered Output
29
Counters All sections have a counter associated with them You can adjust this counter if you’d like \addtocounter{name}{value} You can create your own counters \newcounter{name} \setcounter{name}{value}
30
Counter Example
31
Printing Out The Current Section Numbers “The” notation Will print out the current value of the counter associated \thechapter \thesection \thesubsection
32
Ordered And Unordered Lists Ordered lists are handled with the enumerate construct \begin{enumerate} \end{enumerate} Unordered lists are handled with the itemize construct \begin{itemize} \end{itemize} \item
33
List Example
34
List Output
35
Tables Tables are handled with the tabular environment \begin{tabular}{ FORMAT } \end{tabular} FORMAT determines how many columns are in the table and how text is arranged
36
Format Specifics | represents vertical lines Specific characters tell how to arrange text in the columns l = Left aligned c = Centered r = Right aligned
37
Table Internal Specifics & will separate columns \hline draws horizontal lines \\ ends a line
38
First Tabular Example
39
First Tabular Output
40
More Complex Tabular Example
41
Tabular Output
42
Footnotes Footnotes are handled with the \footnote construct \footnote{This is a footnote} Again, there is an automatic counter that keeps track of your footnotes on a section by section basis
43
Mathematical Constructs LaTeX was built on Tex, which was designed for easy representation of complex mathematical formulas A special mode for math formulas exists in LaTeX $Math mode$
44
Adding Accents
45
Accent Output
46
Greek Letters
47
Greek Letter Output
48
Relational Symbols
49
Relational Symbols Output
50
Various Math Symbols
51
Math Symbols Output
52
Superscripts and Subscripts In math mode: \sp{ } ^ as a shortcut \sb{ } _ as a shortcut
53
Complex Math Formula Example
54
Complex Math Formula Output
55
Vertical Skip And Horizontal Skip \vskip 0.2in \hskip 3in
56
When You Don’t Want Any Changes - Verbatim The verbatim environment will attempt to print out everything exactly as it appears \begin{verbatim} \end{verbatim} Spacing comes out just as typed in this mode
57
Next Time We will look a little more at LaTeX and examine the Make utility Quiz # 3 will be next Tuesday (March 8)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.