Title: Introduction to Unix CS 21
1Introduction to Unix CS 21
2Lecture Overview
- LaTeX
- History
- Running and creating LaTeX documents
- Documents and Articles
- Tables
- Lists
- Fonts
- Math mode
3LaTeX 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
4Other 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
5Where Did It Come From?
- TeX
- 1977 Donald Knuth
- Low level formatting details
- Constructed to make mathematical books look good
- LaTeX
- 1980s Leslie Lamport
- A layer of abstraction on top of TeX
6Why 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 doesnt try to out-think you and put
figures where it believes them to be best
7O.K., How Does Latex Work?
- Latex works on plain text files that are
annotated with commands - Commands are of the form \commandparameter
- Example \documentclassarticle
- 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
8Whats 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
9What Does A LaTeX File Look Like?
10How 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
11Example LaTeX Run
12What 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\enddocument
13Sample Run With Problems
14Example Latex File
15Example Output
16What 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
17Normal 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
18Normal Text Example
19Normal Text Output
20Common Constructs
- Italics and Bolding
- Sectioning
- Lists
- Tables
- Footnotes
- Mathematical formulas
21Italics And Bolding
- \emphtext to be emphasized
- \bf
- Changes the font to a bolder font
22Italic And Bolding Example
23Sectioning Commands
24Section Example
25Sectioning Output
26Unnumbered Sections
- \sectionSection Name
- Always numbers the section
- You can change the format of sections numbers if
youd like - \sectionSection Name
- Will output an unnumbered section
27Unnumbered Example
28Unnumbered Output
29Counters
- All sections have a counter associated with them
- You can adjust this counter if youd like
- \addtocounternamevalue
- You can create your own counters
- \newcountername
- \setcounternamevalue
30Counter Example
31Printing Out The Current Section Numbers
- The notation
- Will print out the current value of the counter
associated - \thechapter
- \thesection
- \thesubsection
32Ordered And Unordered Lists
- Ordered lists are handled with the enumerate
construct - \beginenumerate
- \endenumerate
- Unordered lists are handled with the itemize
construct - \beginitemize
- \enditemize
- \item
33List Example
34List Output
35Tables
- Tables are handled with the tabular environment
- \begintabular FORMAT
- \endtabular
- FORMAT determines how many columns are in the
table and how text is arranged
36Format Specifics
- represents vertical lines
- Specific characters tell how to arrange text in
the columns - l Left aligned
- c Centered
- r Right aligned
37Table Internal Specifics
- will separate columns
- \hline draws horizontal lines
- \\ ends a line
38First Tabular Example
39First Tabular Output
40More Complex Tabular Example
41Tabular Output
42Footnotes
- Footnotes are handled with the \footnote
construct - \footnoteThis is a footnote
- Again, there is an automatic counter that keeps
track of your footnotes on a section by section
basis
43Mathematical 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
44Adding Accents
45Accent Output
46Greek Letters
47Greek Letter Output
48Relational Symbols
49Relational Symbols Output
50Various Math Symbols
51Math Symbols Output
52Superscripts and Subscripts
- In math mode
- \sp
- as a shortcut
- \sb
- _ as a shortcut
53Complex Math Formula Example
54Complex Math Formula Output
55Vertical Skip And Horizontal Skip
56When You Dont Want Any Changes - Verbatim
- The verbatim environment will attempt to print
out everything exactly as it appears - \beginverbatim
- \endverbatim
- Spacing comes out just as typed in this mode
57Next Time
- We will look a little more at LaTeX and examine
the Make utility - Quiz 3 will be next Tuesday (March 8)