- In the 1960's there was roff, followed by troff and groff in the 80's
- In 1978, Donald Knuth introduce Tex (yes, THAT Knuth), which is freely available to all. There are still bounties waiting.
- Shortly after, Leslie Lamport extended Tex with LaTex macros and templates. Today, LaTex remains the baseline tool for preparation of mathematical and technical documents. (NOT WORD!!!)
- In the late 90's, lyx became a popular free WYSIWYG gui for LaTex editing, though there are other options as well.

- The Not So Short Introduction to LATEX2ε
- The Comprehensive LaTeX Symbol List
- Detexify let's you draw the symbol you are looking for, and then searches for a match.
- A tutorial
- A good guide book

- My first latex document
- compiling to a pdf
- error messages
- enumerated lists
- equations

- amsmath - AMS's standard package for math macros and environments like "gather"
- amssymb - extra math symbols not in default LaTex
- amsthm - theorem and proposition environments for writting proofs
- graphicx - allows easy and flexible graphics inclusion in LaTex
- geometry - change margins and page geometry in output
- natbib - flexible bibliography and citation tools
- color - use colors in LaTex
- tikz - draw figures as graphics directly in LaTex
- hyperref - use urls and links with and between documents

For practice, follow all of the directions below using commands in the terminal that we learned about yesterday. You may find it useful to use more than one terminal window (one for your text editor and one for shell commands).

Create a new directory on your Desktop called "LaTex".

Change your current working directory to your new "LaTex" directory.

Create a new file called "hello.tex" in your new directory. This will be your first LaTex document. LaTex files traditionally end with the ".tex" suffix.

The common work-flow for creating documents with Latex is

Edit your .tex file.

Compile your .tex file with the pdflatex command.

If you get compile errors, fix them and recompile.

Inspect your .pdf output in a pdf viewer.

This is the same kind of work-flow used in writing Fortran and C programs, so it is a good introduction. Here is how it goes...

Type the following code into your "hello.tex" file.

`\documentclass[]{article} \begin{document} hello world! My favorite book is Solaris by Stanislaw Lem \end{document}`

Be sure to save your changes.

LaTex is a "markup" language, which tells printers and other tools what you want your document to look like. None of the tags above beginning with a backslash will appear in your final pdf document.

At your shell command line, compile "hello.tex" using the following command.

`pdflatex hello.tex`

This compiles your LaTex file. It creates a bunch of new files in the process.

hello.pdf - this is the final document output

hello.log - this is a log of the events that occurred during compilation, and is used for debugging

hello.aux - this is a data file, used for tracking references to equations, figures, and bibliography citations. Latex is only a single-pass program, pdflatex has to be run 2 or 3 times to

Sometimes there are other hello.* files, where * represents some other 3 letter suffix.

Use the Preview or Acrobat portable document format viewers to inspect your new "hello.pdf". Compare what you got out with what you put in and see if you understand what happened. How does the arrangement of the text you got out differ from what you put in?

Make a backup copy of the file "hello.pdf" for future reference.

Update "hello.tex" file to be the following.

`\documentclass[]{article} \begin{document} hello world! \begin{enumerate} \item should be number one in the list \item should be number two in the list \end{document}`

Be sure to save your changes.

Compile "hello.tex" like you did above. This time, however, you are going to get an error. Read the error message, see if you can figure out what is wrong with your changes, and fix things.

Once you have fixed things, you can inspect "hello.pdf" to see how LaTex typesets an enumerated list. Notice that we did not have to do the numbering ourselves – LaTex handled all that.

Remove hello.log and hello.aux.

(you do not really need to do this - pdflatex with overwrite them as needed, but it is another chance to practice shell commands)

The reason we have used LaTex for decades is that it provides a free common platform for writting pretty mathematical equations, and that it allows us to focus on

*what we mean*rather than what we see.Create a new file "myfirstmath.tex" with the following content.

`\documentclass[12pt]{report} % comments in LaTex are started by the percent symbol % if you want to type "%" in Latex, use \%. \usepackage{amsmath} % this is a library package for math commands % The "ams" in amsmath stands for American Mathematical Society \begin{document} my first equation is not 100\% true. \begin{equation} \label{eq1} 2 + 2 = 5 + \sqrt{3 + x^2} = 45 \leq \frac{z_6}{3 + \beta}. \end{equation} My second equation is inline: $ 2 + 3 > 5 \times 1 $ My 3rd equation is the system \begin{gather} \label{eq3a} x + y = 5, \\ \label{eq3b} 10 x - 10 y = 30. \end{gather} But we could also typeset this system as \begin{align} \label{eq4a} x + y &= 5, \\ \label{eq4b} 10 x - 10 y &= 30. Maybe Equations~\eqref{eq4a} and \eqref{eq4b} look better than Equations~\eqref{eq3a} and \eqref{eq3b} \end{document}`

Compile "myfirstmath.tex" once and inspect "myfirstmath.pdf" What commands did what? Also, notice that there are a few question marks.

Compile "myfirstmath.tex" a second time and inspect "myfirstmath.pdf". What happened to the question marks?

**Exercise:**

That is basic LaTex. To get some practice, create your own LaTex document explaining how the quadratic formula is used to solve a quadratic equation using the commands above.