1 / 56

An introduction to LaTeX

An introduction to LaTeX. And other options for producing documents containing mathematics. Robbie Robinson. Department of Mathematics GWU Washington DC 20052 robinson@gwu.edu. 1. What is TeX?. Tex is:. A typesetting system for professional quality scientific documents.

wan
Download Presentation

An introduction to LaTeX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An introduction to LaTeX And other options for producing documents containing mathematics

  2. Robbie Robinson Department of Mathematics GWU Washington DC 20052 robinson@gwu.edu

  3. 1. What is TeX?

  4. Tex is: • A typesetting system for professional quality scientific documents. • ...especially those containing a lot of mathematical symbols. • Runs on multiple platforms. • Comes in PlainTeX, LaTex, AMS-LaTeX, etc.

  5. Origin • Written by Stanford University computer scientist Donald Knuth. • … was as unhappy about how publishers typeset his papers, • …studied traditional typesetting and printing, • …built a lot of expert knowledge into TeX.

  6. Pronunciation • Name comes from Greek tec. • Means both art and technology. • Rhymes with “belch”…. • Does not rhyme with “sex”! • However:LaTeX is sometimes pronounced “lay-tex” (as in a type of rubber).

  7. What does TeX consist of? • A language and software. • Knuth’s part TeX, plus packages (like LaTex) • Knuth’s ultimate version of the TeXprogram was released in 1983. • Knuth: “There will be no more changes.” • The TeX Book (1986) ultimate TeX language reference. • Other Knuth books: on the program, fonts, etc.

  8. 2. LaTeX and other packages

  9. Ancient history & lagacy • TeX is a primitive typesetting engine(by Knuth) that is programmable. • Programs can be put together into packages. • These define dialects and styles. • With the final version of the TeX program, Knuth released “PlainTex”, and the “Vanilla” style.

  10. More history: AMS-TeX… • Released in early 1980's by AMS. • Based on Knuth’s Vanilla style. • Improvements: • handling very complex math formulas. • additional math oriented fonts. • Developed by Michael Spivak. • The Joy of TeX (1982…)

  11. Still more history: LaTeX… • Released in mid 1980’s • written by Leslie Lamport, of Digital Equipment Co. • LaTeX: A documant preparation system (1986) • Upgrade of Knuth’s basic TeX language, independent of AMS-TeX.

  12. Innovations in LaTeX • Automatic numbering of theorems and equations. • A better “mark-up” system (e.g., environments). • A Pascal-like style. • A greater variety of document types article,book, etc.) • …still more fonts.

  13. Current State of the Art • LaTeX-2e(Frank Mittelbach, et al) • AMS-LaTeX as LaTeX-2e package. • Knuth’s TeX program replaced with PDFLaTex program. • Easy to install distributions for Windows, Mac, Linux (all open source). • TeXworks GUI for all platforms. • Many useful packages, styles, and auxiliaries: • BibTeX, graphics, Beamer, etc.

  14. Distributions. • Microsoft Windows: MikTeX • http://miktex.org/ (use the “Basic Installer”). • Mac OS X: MacTeX • https://www.tug.org/mactex/ (install MacTeX.pkg). • Linux (or any Unix): TeX-Live • https://www.tug.org/texlive/ (It’s probably best to install via your Linux distributions implementation of dpkg or RPM rather than from here.).

  15. GUI Front Ends • TeXworks (all platforms) • TeXShop (Mac), WinEdt (Windows) • GNU Emacs with AUCTeX package (for the hardcore hacker in you…).

  16. References • More Math into Latex by George A. Gratzer, (4thed 2007)http://www.amazon.com/More-Math-Into-LaTeX-Edition/dp/0387322892 • Math into LaTeX by George A. Gratzer (1993) ftp://ftp.tex.ac.uk/tex-archive/info/mil/mil.pdf • LaTeX by Wikibooks.orghttp://en.wikibooks.org/wiki/LaTeX • TUG (TeX Users Group) https://tug.org

  17. 3. Using TeX

  18. Mark-up • LaTeXis a markup language, (like HTML, the language of the www). • You type an ASCII (text) file with the extension ".tex”. • You do not worry about formatting. You leave it to LaTeX (as in HTML where you leave formatting to the browser). • TeX formats according to the style you are using.

  19. Ideology • “Logical Document Design”as opposed to “WYSIWYG” (what you see is what you get) • Common to TeX and HTML. • User describes logical role of each part of the document. • ... not how to place items on the page! • Of course some adjustment is often necessary at the end…

  20. Logical Document Design in TeX To emphasize text, you type: {\em Emphasize this!} • What you will (probably) get: Emphasize this!

  21. How do you demand italics? {\it Italicize this!} • What you (should) get: Italicize this!

  22. Font control in La-TeX. • {\bf … } for boldface, • {\rm … } for Roman (not italics or bold) • {\tt … } for teletype. • {\sc … } for “small caps”.

  23. 4. Typing Mathematics.

  24. More TeX v.s. HTML • In TeX the big thing is mathematics. • Inside your document, all formulas are typeset in math mode. • There is display math and inline math. • Variables in italics, numbers in Roman, lots of math symbols! • In contrast, text is set in text mode. • Default font is Roman.

  25. Example Math mode Inline: equations between $’s An inline equation $x^2-x-1=0$ appears in this line. • You will get (approximately) An inline equation x2–x–1 = 0 appears in this line. LaTeXdecides where to break lines, pages, etc.

  26. Knuth’s poor choice of delimiters • TeX violates a common custom of notation: Delimiters should come in left and right pairs. $x^2-x-1=0$ violates this.

  27. LaTeX corrects Knuth • Allows\( x^2-x-1=0 \) for inline math. • But most people still use $x^2-x-1=0$. • LaTeXalso allows \[ x^2-x-1=0 \] for display math. • But I prefer a LaTeX feature called environments:

  28. Display equation environment in LaTeX: • Here is a displayed equation • \begin{equation} \label{eq:fib}x^2-x-1=0, \end{equation} • and it has a number. Here is a displayed equation (1.1) x2–x–1 = 0, and it has a number!

  29. Later, you can refer to the label… • Solving the quadratic equation (\ref{eq:fib}) we get the Golden Mean. Solving the quadratic equation (1.1) we get the Golden Mean.

  30. You can also display without a number… • Here is a displayed equation • \begin{equation*} • x^2-x-1=0, \end{equation*} • withouta number. Here is a displayed equation x2–x–1 = 0, withouta number!

  31. Greek letters: Spelled out as “control sequences”. • For all $\epsilon>0$ there exists $\delta$ so that if $|x-y|<\delta$ then $|f(x)-f(y)|<\epsilon$. For all  > 0 there exists  > 0 so that if |x - y| <  then |f(x) - f(y)| < .

  32. Given a bounded sequence x1, x2,…, there exists convergent subsequence . • Subscripts and superscripts These use “^” and “_”. Nesting is allowed with { } • Given a bounded sequence $x_1,x_2,\dots$, there exists a convergent subsequence $x_{i_1},x_{i_2},\dots$.

  33. Integrals, and sums If f is in L2[0,2] and then . • If $f$ is in $L^2[0,1]$ and • \begin{equation*} • f_n=\frac{1}{2\pi} • \int_0^{2\pi} f(x)e^{i n x}\,dx • \end{equation*} • then $||f||^2_2=\Sum_0^\infty |f_n|^2$.

  34. Theorem-like environments • \begin{thm}\label{th:fw} • The equation $A^n+B^n=C^n$ has no integer solutions for $n>2$. • \end{thm} • \begin{proof} • See the margins.\end{proof} Theorem 1.1. The equation An+Bn=Cnhas no integer solutions for n>2. Proof. See the margins. □

  35. 5. Document structure.

  36. Starting and finishing • LaTeX requires (at least a few) special lines at the beginning and end of a document. \documentclass[12pt]{amsart} \begin{document} Put your text here... \end{document}

  37. Partitioning your document \documentclass[12pt]{amsart} \title{Hello world} \author{Robbie Robinson} \begin{document} \maketitle \section{Introduction} Put your text here… \section{The main result} Put your text here… \subsection{Some comments} Put your text here…\end{document}

  38. Adding packages and macros \documentclass[12pt]{amsart} \usepackage{amsmath,amssymb,amsfonts} \usepackage{graphicx} … \begin{document} … \end{document} These packages ass fonts and symbols. And allow for the insertion of graphics.

  39. Adding Comments \documentclass[12pt]{amsart} \begin{document} % Hi Steve. This is my latest draft. % What do you think? Put your text here… \end{document} Anything after a % on a line is a comment.

  40. Other useful things to do All of the above are demonstrated somewhere in the sample LaTeX files • Insert graphics (pdf preferred, but can take eps or bitmapped graphics too) • Bibliography • Manually • With BibTeX • In LaTeX itself • Index or table of contents

  41. 6. The LaTeX workflow

  42. The TeXworks window

  43. Choose “Syntax Coloring” in “Format”

  44. Choose “pdfLaTeX” and GO

  45. Errors (need to be fixed)

  46. (Finally) the result

  47. Run twice or more LaTeX is a 1 pass processor. Information about cross-referencing, etc. requires a second pass. With indexes, BibTeX bibliographies, etc., more passes may be necessary Errors and warnings. Take them all seriously

  48. The perils of artificial intelligence LaTeX (and TeX) “want” to do things their way. As hard as it is to believe at first, their way is usually better then your way (Knuth studied 500 years of printing tradition). You can always force LaTeX to do what you want, but it can be difficult to do.

  49. 7. Useful Programs Now and on the horizon

  50. Graphics • Use graphicxpackage (see examples) • pdf, Posescript (vector graphics preferred) • Mathematica*, Maple*, Matlab* (Maxima, Sage, Octave, Scilab, GNUplot) • Inkscape, llustrator*,ghostview, Acrobat* • jpeg, tiff (bitmapped) • Your camera or phone, web downloads, Windows paint* • Photoshop*, Gimp, Irfanview (for Windows) * = $$$ (these cost money)

More Related