Download - Introduction to Unix – CS 21
![Page 1: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/1.jpg)
Introduction to Unix – CS 21
Lecture 16
![Page 2: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/2.jpg)
Lecture Overview LaTeX
History Running and creating LaTeX documents
Documents and Articles Tables Lists Fonts
Math mode
![Page 3: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/3.jpg)
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
![Page 4: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/4.jpg)
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
![Page 5: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/5.jpg)
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
![Page 6: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/6.jpg)
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
![Page 7: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/7.jpg)
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
![Page 8: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/8.jpg)
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
![Page 9: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/9.jpg)
What Does A LaTeX File Look Like?
![Page 10: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/10.jpg)
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
![Page 11: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/11.jpg)
Example LaTeX Run
![Page 12: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/12.jpg)
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}
![Page 13: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/13.jpg)
Sample Run With Problems
![Page 14: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/14.jpg)
Example Latex File
![Page 15: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/15.jpg)
Example Output dvi1.JPG
![Page 16: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/16.jpg)
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
![Page 17: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/17.jpg)
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 this is the same
![Page 18: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/18.jpg)
Normal Text Example
![Page 19: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/19.jpg)
Normal Text Output dvi2.JPG
![Page 20: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/20.jpg)
Common Constructs Italics and Bolding Sectioning Lists Tables Footnotes Mathematical formulas
![Page 21: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/21.jpg)
Italics And Bolding \emph{text to be emphasized} \bf
Changes the font to a bolder font
![Page 22: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/22.jpg)
Italic And Bolding Example
![Page 23: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/23.jpg)
Sectioning CommandsName Level\part -1\chapter 0\section 1\subsection 2\subsubsection 3\paragraph 4\subparagraph 5
![Page 24: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/24.jpg)
Section Example
![Page 25: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/25.jpg)
Sectioning Output
![Page 26: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/26.jpg)
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
![Page 27: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/27.jpg)
Unnumbered Example
![Page 28: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/28.jpg)
Unnumbered Output
![Page 29: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/29.jpg)
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}
![Page 30: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/30.jpg)
Counter Example
![Page 31: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/31.jpg)
Printing Out The Current Section Numbers “The” notation Will print out the current value of
the counter associated \thechapter \thesection \thesubsection
![Page 32: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/32.jpg)
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
![Page 33: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/33.jpg)
List Example
![Page 34: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/34.jpg)
List Output
![Page 35: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/35.jpg)
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
![Page 36: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/36.jpg)
Format Specifics | represents vertical lines Specific characters tell how to
arrange text in the columns l = Left aligned c = Centered r = Right aligned
![Page 37: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/37.jpg)
Table Internal Specifics & will separate columns \hline draws horizontal lines \\ ends a line
![Page 38: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/38.jpg)
First Tabular Example
![Page 39: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/39.jpg)
First Tabular Output
![Page 40: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/40.jpg)
More Complex Tabular Example
![Page 41: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/41.jpg)
Tabular Output
![Page 42: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/42.jpg)
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
![Page 43: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/43.jpg)
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$
![Page 44: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/44.jpg)
Adding Accents
![Page 45: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/45.jpg)
Accent Output
![Page 46: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/46.jpg)
Greek Letters
![Page 47: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/47.jpg)
Greek Letter Output
![Page 48: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/48.jpg)
Relational Symbols
![Page 49: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/49.jpg)
Relational Symbols Output
![Page 50: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/50.jpg)
Various Math Symbols
![Page 51: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/51.jpg)
Math Symbols Output
![Page 52: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/52.jpg)
Superscripts and Subscripts In math mode:
\sp{ } ^ as a shortcut
\sb{ } _ as a shortcut
![Page 53: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/53.jpg)
Complex Math Formula Example
![Page 54: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/54.jpg)
Complex Math Formula Output
![Page 55: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/55.jpg)
Vertical Skip And Horizontal Skip \vskip 0.2in \hskip 3in
![Page 56: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/56.jpg)
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
![Page 57: Introduction to Unix – CS 21](https://reader031.vdocument.in/reader031/viewer/2022020118/56814c54550346895db96c31/html5/thumbnails/57.jpg)
Next Time We will look a little more at LaTeX
and examine the Make utility Quiz # 3 will be next Tuesday
(March 8)