Latex2 a Document Preparation System
Total Page:16
File Type:pdf, Size:1020Kb
Evans Library Online Research Support Workshops: A 1 1 LTEX 2# a document preparation system [email protected] download @ cs.fit.edu/. William David Shoaff March 3 & 4, 2015 Contents History 1 Is LATEX hard to use? 2 Cools examples 2 Writing TEX&LATEX 2 File Extensions A minimal file 2 Standard stuff 3 LATEX does math 3 LATEX does lists 3 LATEX does tables 4 Gratuitous examples 4 Separate content from form 8 LATEX packages 8 Friendly tools 24 Additional resources 24 History Don Knuth received the 1974 Turing ‘In the late 1970s, Donald Knuth was revising the second volume of his award for his major contributions to multivolume magnum opus The Art of Computer Programming, got the the analysis of algorithms and the galleys, looked at them, and said (approximately) “blecch”! He had design of programming languages, and just received his first samples from the new typesetting system of the in particular for his contributions to the “art of computer programming” publisher’s, and its quality was so far below that of the first edition of through his well-known books in a Volume 2 that he couldn’t stand it.’ Just what is TEX continuous series by this title. Leslie Lamport received the 2013 TEX, written mostly by Knuth, was released in 1978. The current Turing Award for advances in reliability and consistency of computing systems. version of TEX is 3.14159265. To add a level of abstraction to TEX, Leslie Lamport wrote LATEX and released it in 1984.LATEX allows a writer to concentrate on con- tent and structure rather than formatting details. Separating content from form is important. evans library online research support workshops:LATEX 2# a document preparation system 2 Is LATEX hard to use? LATEX is not easy: Few worthwhile endeavors are easy. It’s easy to use if you’re one of the 2% of the population who thinks logically and can read an instruction manual. The other 98% of the population would find it very hard or impossible to use. An interview with Leslie Lamport I’ve heard TEX, hence LATEX is Turing complete: Any computable problem can be solved in LATEX, not that you would want too. Cools examples I cannot teach you how to write LATEX. I can point you to interesting examples. • The TEX showcase from TUG •T EX examples from well . .TEX examples Writing TEX&LATEX To write a Word document use Word. To write a LATEX document use . , well, I counted about 40 differ- ent tool on Wikdipedia’s page comparing TEX editor I use Emacs, a I can highly recommend Emacs, but basic text editor. From the Wikipedia page, I’ve heard of TeXworks, cannot for to use it. Learning Emacs requires a separate effort. TeXShop, Lyx, and TeXnicCenter, perhaps others. I cannot recom- mend any of these tools because I would/have not use them. Robert Gaskins on PowerPoint (his A minimal file invention): ‘But I also hear a complaint Here’s the LATEX version of Hello, world!. that really is new with Pow- erPoint: that more and more \documentclass{article} business and academic talks \begin{document} look like poor attempts at Hello, world! sales presentations, swamped \end{document} by gaudy visual ornamen- tation with no purpose or The class of a document defines basic structures: chapter, section, benefit related to the presen- subsection, table of contents, etc. Major classes are these: tation. This has come about not simply through a mass failure of taste but as a result article For journal articles, short reports, program documentation, . of a change in presentation beamer For writing presentations . really?! technology made possible book For real books by PowerPoint.’ PowerPoint letter For writing letters at 20: back to basics, CACM, December 2007 report For longer reports, small books, thesis, . See: The Gettysburg PowerPoint Presentation as rendered by Peter Norvig. evans library online research support workshops:LATEX 2# a document preparation system 3 Now, I mostly use tufte-handout or tufte-book classes for short presentations, literate programs, and longer documents. Do you know of Edward Tufte? Here’s his home page. Standard stuff LATEX does math • In-line math −1 = epi: $-1=e^{\pi i}$. • Labeled equations Z dcabin houseboat = (1) cabin \begin{equation} \label{eq:1} \text{houseboat} = \int \frac{d\text{cabin}}{\text{cabin}} \end{equation} You can refer to equation by name: see 1: see \ref{eq:1}. • You can define math (and other) macros \newcommand{\coff}[3]{\ensuremath{\Gamma^{#1#2}_{#3}}} ij for complex expressions such as Christoffel symbols, Gk : \coff{i}{j}{k}. LATEX does lists There are itemized lists: \begin{itemize} • Orange \item \textcolor{orange}{Orange} • Purple \item \textcolor{purple}{Purple} \end{itemize} Enumerated lists: \begin{enumerate} 1. In the beginning . \item In the beginning \dots \item Then \dots 2. Then . \end{enumerate} evans library online research support workshops:LATEX 2# a document preparation system 4 LATEX does tables \begin{center} \begin{tabular}{@{}llr@{}} \toprule Item \multicolumn{2}{c}{Item} \\ \cmidrule(r){1-2} Animal Description Price ($) Animal & Description & Price (\$)\\ \midrule Gnat & per gram & 13.65 \\ Gnat per gram 13.65 & each & 0.01 \\ each 0.01 Gnu & stuffed & 92.50 \\ Gnu stuffed 92.50 Emu & stuffed & 33.33 \\ Emu stuffed 33.33 Armadillo & frozen & 8.99 \\ \bottomrule Armadillo frozen 8.99 \end{tabular} \end{center} Gratuitous examples You can create diagrams of chemical structures. CH3 N N O N N CH3 H3C O You can create Feynman diagrams. e− g v¯ t¯ g b¯ b t g u d¯ evans library online research support workshops:LATEX 2# a document preparation system 5 Here’s LATEXand TikZ code for the dodecahedron calendar on page 6. \documentclass{ article } % Folding + calendar example from the PGF manual. % % Author: Till Tantau \usepackage{ tikz } \usetikzlibrary{calendar ,folding} \begin{document} \sffamily\scriptsize \begin{tikzpicture }[transform shape, every calendar/.style={ at ={(−8ex , 4 ex ) } , week l i s t , month label above centered , month text=\bfseries\textcolor{red}{\%mt } \%y 0 , if={(Sunday) [black! 5 0 ]} }] \tikzfoldingdodecahedron[ folding line length=2.5cm, face 1={ \calendar [dates=\the\year −01−01 to \the\year−01− l a s t ] ; } , face 2={ \calendar [dates=\the\year −02−01 to \the\year−02− l a s t ] ; } , face 3={ \calendar [dates=\the\year −03−01 to \the\year−03− l a s t ] ; } , face 4={ \calendar [dates=\the\year −04−01 to \the\year−04− l a s t ] ; } , face 5={ \calendar [dates=\the\year −05−01 to \the\year−05− l a s t ] ; } , face 6={ \calendar [dates=\the\year −06−01 to \the\year−06− l a s t ] ; } , face 7={ \calendar [dates=\the\year −07−01 to \the\year−07− l a s t ] ; } , face 8={ \calendar [dates=\the\year −08−01 to \the\year−08− l a s t ] ; } , face 9={ \calendar [dates=\the\year −09−01 to \the\year−09− l a s t ] ; } , face 10={\calendar [dates=\the\year −10−01 to \the\year−10− l a s t ] ; } , face 11={\calendar [dates=\the\year −11−01 to \the\year−11− l a s t ] ; } , face 12={\calendar [dates=\the\year −12−01 to \the\year−12− l a s t ] ; } ]; \end {tikzpicture} \end { document } evans library online research support workshops:LATEX 2# a document preparation system 6 6 5 13 4 12 3 20 December 201511 2 19 27 10 18 1 9 26 17 8 25 16 7 24 15 23 31 14 22 30 21 29 28 November 2015 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 2 16 9 23 30 10 3 March 2015 17 24 31 11 4 18 4 February 2015 25 12 5 3 19 11 2 26 2 13 6 10 18 9 3 20 October 20151 9 27 10 4 17 25 16 14 7 8 21 16 17 11 5 28 7 24 23 1 12 6 15 8 15 23 24 18 22 6 31 29 14 19 13 7 1 5 22 30 25 14 8 13 21 29 26 20 15 12 20 28 27 21 19 27 28 22 6 26 13 20 5 27 January 2015 12 19 4 26 1 2 3 4 27 11 30 18 20 23 3 13 25 9 16 5 6 7 8 9 10 11 2 28 10 6 29 17 21 22 2 14 24 8 9 15 12 13 14 15 16 17 18 1 29 7 September 2015 28 16 22 21 1 15 23 7 19 20 21 22 23 24 25 8 14 30 30 8 27 23 15 1 20 2015 April 26 27 28 29 30 31 16 22 6 7 13 29 9 26 24 14 2 19 21 17 5 12 28 10 25 25 3 18 18 4 11 11 2015 August 31 24 26 4 17 19 3 10 12 25 5 30 29 26 18 27 28 27 26 25 24 23 22 19 11 28 20 12 21 20 19 18 17 16 15 4 29 21 13 5 14 13 12 11 10 9 8 30 22 14 6 31 23 15 7 6 5 4 3 2 1 7 24 16 8 2015 June 17 2015 May 9 1 10 2 3 26 31 25 19 30 24 18 12 29 23 17 5 11 28 22 16 4 10 27 21 9 15 3 20 8 14 2 7 13 1 6 2015 July evans library online research support workshops:LATEX 2# a document preparation system 7 A second example shows support for dynamic content.