Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

LaTeX in a Nutshell

FLOSSystems
October 08, 2012

LaTeX in a Nutshell

Brief (and quick) introduction to LaTeX.

FLOSSystems

October 08, 2012
Tweet

More Decks by FLOSSystems

Other Decks in Education

Transcript

  1. What is (La)TEX Basic Structures References L A TEX in

    a Nutshell Master on Free Software 2012-13 Miguel Vidal http://flossystems.com Twitter: @mvidallopez October 5th, 2012 1 / 49 Miguel Vidal L ATEX in a Nutshell
  2. What is (La)TEX Basic Structures References (cc) 2010-2012 Miguel Vidal

    This work is licensed under a Creative Commons Attribution 3.0 License http://creativecommons.org/licenses/by/3.0 2 / 49 Miguel Vidal L ATEX in a Nutshell
  3. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 3 / 49 Miguel Vidal L ATEX in a Nutshell
  4. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document What is TEX A computer program (language and interpreter) created by Donald Knuth in 1977. Knuth wrote the TEX typesetting engine to explore potential of the digital printing equipment. He aimed to revert trend of deteriorating typographical quality that affected his own books and articles. Two main aims: highest quality and highest durability. 4 / 49 Miguel Vidal L ATEX in a Nutshell
  5. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document THe Art of Computer Programming Knuth prepared a 2nd edition of Volume 2 (1977). The style of type in 1st edition was no longer available (result was “horrible”). 700 pages of 2nd ed. written in TEX (Jul. 1980) and published! (Jan. 1981) It’s currently used for all volumes. 5 / 49 Miguel Vidal L ATEX in a Nutshell
  6. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document What is TEX TEX as we use it today was released in 1982, with some slight enhancements added in 1989 (8-bit characters support). One of the most sophisticated digital typographical systems (“The greatest contribution in the printing world since Gutenberg”). Popular in academia, especially in mathematics, computer science, engineering, and physics. Free software (“public domain” dedication): but any modified version must not be called TEX! 6 / 49 Miguel Vidal L ATEX in a Nutshell
  7. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document What is TEX TEX understands about 300 low-level commands (“primitives”). Primitives are rarely used directly by users. The smallest unit of length handled by TeX is 0,000005356mm! (scaled point, 1 mm = 186712sp) Functionality is provided by format files (predumped memory images of TEX after large macro collections have been loaded). 7 / 49 Miguel Vidal L ATEX in a Nutshell
  8. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document What is TEX Written in a ‘literate’ programming language called Web. TRIP and TRAP tests (“conformance test”): portable, same output with all versions. The design was frozen (and dedicated to Public Domain) in October 1990 (v3.1* –π–, no new features, only bug fixes). 8 / 49 Miguel Vidal L ATEX in a Nutshell
  9. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document METAFONT Font description language to describe characters (glyphs) algorithmically with geometrical equations. It uses B´ ezier curves (vector graphics). Also created by Knuth but not strictly part of TEX. It is possible to use TEX and L A TEX without METAFONT. Adobe PostScript fonts may be used instead. 9 / 49 Miguel Vidal L ATEX in a Nutshell
  10. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 10 / 49 Miguel Vidal L ATEX in a Nutshell
  11. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document What is L A TEX Set of macros from TEX primitives that abstracted away many of the TEX complexities. A “format” originally developed by Leslie Lamport. It incorporates document styles for books, letters, slides, etc. The current version is L A TEX2e. L A TEX is free software (LaTeX Project Public License - LPPL), OSI-compliant, no-copyleft. 11 / 49 Miguel Vidal L ATEX in a Nutshell
  12. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document How to pronounce and spell “L A TEX” “TEX”, “L A TEX”, or “LaTeX” (ASCII), not “Latex”. Pronounced /l´ atej/ or /l´ atek/, not ‘latex’! It derives from the Ancient Greek: τ χνη (tejn´ e: “skill, art, technique”) χ: Ji letter (voiceless velar fricative, as “ojo” or “Bach”), Chi /kai/ in English. IPA (International Phonetic Alphabet): [x] phonem 12 / 49 Miguel Vidal L ATEX in a Nutshell
  13. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 13 / 49 Miguel Vidal L ATEX in a Nutshell
  14. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Advantages Control Quality Flexibility Portability Scalability Stability 14 / 49 Miguel Vidal L ATEX in a Nutshell
  15. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Advantages (2) Typesetting, not “word processing” (LibreOffice, MS Office, etc.). Accurate, precise output (device independent). It prevents formatting errors (by forcing to declare logical structure). Separate content and styling. 15 / 49 Miguel Vidal L ATEX in a Nutshell
  16. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Advantages (3) Modular (add-on packages), powerful and highly portable (text files). Easy to make global changes; encourage content reuse. Complex structures (footnotes, references, table of contents, and bibliographies) can be generated easily. Professional output: look as if “printed”. 16 / 49 Miguel Vidal L ATEX in a Nutshell
  17. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Caveats Not WYSIWIG. Hard learning curve. Absolute space/positioning is tricky (it’s very hard to write disorganized documents). Design of a whole new layout is difficult and takes a lot of time. Need to be compiled. 17 / 49 Miguel Vidal L ATEX in a Nutshell
  18. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX Compare kerning: 18 / 49 Miguel Vidal L ATEX in a Nutshell
  19. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX Compare kerning: 18 / 49 Miguel Vidal L ATEX in a Nutshell
  20. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX Compare kerning: Compare Small Caps: 18 / 49 Miguel Vidal L ATEX in a Nutshell
  21. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX Compare kerning: Compare Small Caps: 18 / 49 Miguel Vidal L ATEX in a Nutshell
  22. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX MS Word (wrong default kerning) L A TEX (correct kerning) 19 / 49 Miguel Vidal L ATEX in a Nutshell
  23. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX MS Word (wrong default kerning) L A TEX (correct kerning) MS Word (fake small caps) L A TEX (real small caps) 19 / 49 Miguel Vidal L ATEX in a Nutshell
  24. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX MS Word (wrong default kerning) L A TEX (correct kerning) MS Word (fake small caps) L A TEX (real small caps) Source images: Dario Taraborelli http://nitens.org/taraborelli/latex (CC-by-sa) 19 / 49 Miguel Vidal L ATEX in a Nutshell
  25. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX: ligatures 20 / 49 Miguel Vidal L ATEX in a Nutshell
  26. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX: ligatures 20 / 49 Miguel Vidal L ATEX in a Nutshell
  27. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX: ligatures MS Word (wrong use of ligatures) L A TEX(correct use of ligatures) 21 / 49 Miguel Vidal L ATEX in a Nutshell
  28. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document MS Word vs L A TEX: ligatures MS Word (wrong use of ligatures) L A TEX(correct use of ligatures) Source images: Dario Taraborelli: http://nitens.org/taraborelli/latex (CC by-sa) Wikimedia Commons: http://en.wikipedia.org/wiki/File:Fi_garamond_sort_001.png (CC by-sa) 21 / 49 Miguel Vidal L ATEX in a Nutshell
  29. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 22 / 49 Miguel Vidal L ATEX in a Nutshell
  30. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Installing L A TEX For using L A TEX you need: A text editor for editing your L A TEX source files. A L A TEX distribution for processing (compiling) your L A TEX source files into PDF or DVI documents. A PDF/DVI viewer for previewing and printing documents. 23 / 49 Miguel Vidal L ATEX in a Nutshell
  31. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 24 / 49 Miguel Vidal L ATEX in a Nutshell
  32. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document The simplest document § % Example #1 \ documentclass { a r t i c l e } \ begin {document} Hello World ! This i s a minimal \LaTeX{} document . \end{document}  ¦ ¥ 25 / 49 Miguel Vidal L ATEX in a Nutshell
  33. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document Document workflow Editor (‘foobar.tex’) → L A TEX processor (‘foobar.dvi’) → display (viewer/screen) → drivers (‘foobar.ps’, printer) § $ l a t e x foobar . tex ( ‘ tex &l a t e x foobar . tex ’ ) $ dvips −o foobar . ps foobar . dvi ( ps output ) $ p d f l a t e x foobar . tex ( pdf output ) $ hevea foobar . tex ( html output )  ¦ ¥ 26 / 49 Miguel Vidal L ATEX in a Nutshell
  34. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document DVI Output Device independent file format (.dvi) Binary data independent on any specific image format, display hardware or printer. A L A TEX distribution for processing (compiling) your L A TEX source files into PDF or DVI documents. DVI is not a document encryption format. Not support embedded fonts (fonts must be already installed). 27 / 49 Miguel Vidal L ATEX in a Nutshell
  35. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document xdvi: DVI Previewer 28 / 49 Miguel Vidal L ATEX in a Nutshell
  36. What is (La)TEX Basic Structures References TEX L ATEX Advantages

    and caveats Installing L ATEX Creating a basic document L A TEX Distributions There are pre-compiled L A TEX distributions for different OS: TeX Live (Unix-like systems): Linux, BSD, Solaris, etc. MacTeX (TeX Live with the addition of Mac specific programs): http://www.tug.org/mactex MiKTeX (Windows): http://www.miktex.org 29 / 49 Miguel Vidal L ATEX in a Nutshell
  37. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 30 / 49 Miguel Vidal L ATEX in a Nutshell
  38. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Document Structure Two main environments: Preamble: commands and macros that affect the entire document. Top matter: author, title, date, institution, etc. Document environment: body text 31 / 49 Miguel Vidal L ATEX in a Nutshell
  39. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Preamble Everything from the start of the L A TEX source file until the begin{document} command It normally contains global commands that affect the entire document. § \ documentclass [ options ]{ c l a s s } \ usepackage [ options ]{ package }  ¦ ¥ class (mandatory): book, article, report package (optional): to utilize external macros (inputenc, amssymb...) 32 / 49 Miguel Vidal L ATEX in a Nutshell
  40. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Top Matter Title, date Information about the authors, such as name, address, email etc. § \ documentclass [11 pt , a4 paper , oneside ]{ r e p o r t } \ usepackage [ u t f 8]{ inputenc } % utf −8 encoding \ usepackage {amssymb} % math symbols \ begin {document} \ t i t l e {How to S t r u c t u r e a LaTeX Document} \ author {Andrew Roberts } \ date {December 2004} \ m a k e t i t l e  ¦ ¥ 33 / 49 Miguel Vidal L ATEX in a Nutshell
  41. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Body text Abstract Parts, chapters, sections, subsections, Appendices, Bibliography... § \ begin {document} . . . t e x t mixed with l o c a l commands . . . \end{document}  ¦ ¥ 34 / 49 Miguel Vidal L ATEX in a Nutshell
  42. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document How to Structure a L A TEX Document L A TEX allows to structure documents with a variety of hierarchical constructs: § \ part { Part T i t l e } \ chapter { Chapter T i t l e } %only books and r e p o r t s \ s e c t i o n { Section T i t l e } \ s u b s e c t i o n { Subsection T i t l e } \ subsubsection { Subsubsection T i t l e }  ¦ ¥ 35 / 49 Miguel Vidal L ATEX in a Nutshell
  43. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 36 / 49 Miguel Vidal L ATEX in a Nutshell
  44. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Font Styles § \ t e x t i t { . . . } % i t a l i c s \ t e x t b f { . . . } % bold \ t e x t t t { . . . } % monospace − t e l e t y p e \ t e x t s c { . . . } % small c a p i t a l s  ¦ ¥ Example: § \LaTeX{} was \ t e x t t t { o r i g i n a l l y } w r i t t e n i n \ t e x t b f {1984} by \ t e x t s c { L e s l i e Lamport} and has become the \ t e x t i t { dominant } method f o r using \TeX .  ¦ ¥ Output: 37 / 49 Miguel Vidal L ATEX in a Nutshell
  45. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Font Sizes § \ t i n y \ s c r i p t s i z e \ f o o t n o t e s i z e \ small \ normalsize \ l a r g e \ Large \LARGE \huge \Huge  ¦ ¥ Size related to font size default, declared in preamble (documentclass) 38 / 49 Miguel Vidal L ATEX in a Nutshell
  46. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Font Sizes. Example § \LaTeX{} was \ t i n y o r i g i n a l l y w r i t t e n \ normalsize in \ l a r g e 1984 \ normalsize by \LARGE L e s l i e Lamport \ normalsize and has become the \ f o o t n o t e s i z e dominant method \ normalsize f o r using \huge \TeX.  ¦ ¥ Output: L A TEX was originally written in 1984 by Leslie Lamport and has become the dominant method for using TEX. 39 / 49 Miguel Vidal L ATEX in a Nutshell
  47. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Some special features Text aligned n > 1 blank lines and empty spaces: one line or one space Start a new paragraph: \\ Hyphenate the word (exceptional cases): man\-u\-script \newline, \newpage 40 / 49 Miguel Vidal L ATEX in a Nutshell
  48. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 41 / 49 Miguel Vidal L ATEX in a Nutshell
  49. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Environments § \ begin { environment name} \end{ environment name}  ¦ ¥ Environments: center, itemize, enumerate, figure, flushright, quotation... 42 / 49 Miguel Vidal L ATEX in a Nutshell
  50. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Environments: example § Some FOSS L i c e n s e s : \ begin { enumerate } \ item BSD l i c e n s e \ item GPL l i c e n s e \ item CDDL l i c e n s e \end{ enumerate }  ¦ ¥ Output: 43 / 49 Miguel Vidal L ATEX in a Nutshell
  51. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document Table of Contents 1 What is (La)TEX TEX L A TEX Advantages and caveats Installing L A TEX Creating a basic document 2 Basic Structures Document Structure Fonts Environments A complete document 3 References 44 / 49 Miguel Vidal L ATEX in a Nutshell
  52. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document A complete document § \ usepackage [ u t f 8]{ inputenc } \ t i t l e {The beauty of \TeX} \ author {Donald E . Knuth} \ date {\1979} \ begin {document} \ m a k e t i t l e % This i s the comment body . ‘ ‘ Mathematical books and j o u r n a l s do not look as b e a u t i f u l as they used to . I t i s not that t h e i r mathematical content i s u n s a t i s f a c t o r y , r a t h e r that the old and well −developed t r a d i t i o n s of t y p e s e t t i n g have become too e x p e n s i v e . Fortunately , i t now appears that mathematics i t s e l f can be used to s o l v e t h i s problem . ’ ’ \end{document}  ¦ ¥ 45 / 49 Miguel Vidal L ATEX in a Nutshell
  53. What is (La)TEX Basic Structures References Document Structure Fonts Environments

    A complete document A complete document 46 / 49 Miguel Vidal L ATEX in a Nutshell
  54. What is (La)TEX Basic Structures References References Lamport, Leslie. L

    A TEX: A document preparation system, Addison-Wesley, Reading, Massachusetts, second edition, 1994. Knuth, Donald E. The TEXbook, Volume A of Computers and Typesetting, Addison-Wesley, Reading, Massachusetts, second edition, 1984. CTAN: the authoritative collection of materials related to the TeX typesetting system. http://www.ctan.org Guide to the L A TEXmarkup language: http://en.wikibooks.org/wiki/LaTeX 47 / 49 Miguel Vidal L ATEX in a Nutshell
  55. What is (La)TEX Basic Structures References References (Spanish) Sanguino-Botella, Javier.

    Iniciaci´ on a L A TEX2e: Un sistema para preparar documentos, Addison-Wesley, 1997. VV.AA. L A TEX: Una imprenta en sus manos, ADI, 2000. TEX y tipograf´ ıa (web de Javier Bezos): http://www.tex-tipografia.com CervanTeX: Grupo de usuarios hispanohablantes de TEX: http://www.cervantex.es/ 48 / 49 Miguel Vidal L ATEX in a Nutshell
  56. What is (La)TEX Basic Structures References L A TEX in

    a Nutshell Master on Free Software 2012-13 Miguel Vidal http://flossystems.com Twitter: @mvidallopez October 5th, 2012 49 / 49 Miguel Vidal L ATEX in a Nutshell