L A in a Nutshell Master on Libre Software 2011-12 Miguel Vidal http://gsyc.urjc.es/~mvidal Twitter: @mvidallopez September 22, 2011 1 / 48 Miguel Vidal LA in a Nutshell
(cc) 2011 Miguel Vidal This work is licensed under a Creative Commons Attribution 3.0 License http://creativecommons.org/licenses/by/3.0 2 / 48 Miguel Vidal LA in a Nutshell
Table of Contents LA Installing LA 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 3 / 48 Miguel Vidal LA in a Nutshell
What is LA Installing LA A computer program (language and interpreter) created by Donald Knuth in 1977. Knuth wrote the 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 / 48 Miguel Vidal LA in a Nutshell
What is LA Installing LA 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. Open Source Software ( public domain dedication): but any modified version must not be called! 5 / 48 Miguel Vidal LA in a Nutshell
What is LA Installing LA 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 after large macro collections have been loaded). 6 / 48 Miguel Vidal LA in a Nutshell
What is LA Installing LA 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). 7 / 48 Miguel Vidal LA in a Nutshell
METAFONT LA Installing LA Font description language to describe characters (glyphs) algorithmically with geometrical equations. It uses Bézier curves (vector graphics). Also created by Knuth but not strictly part of. It is possible to use and L A without METAFONT. Adobe PostScript fonts may be used instead. 8 / 48 Miguel Vidal LA in a Nutshell
Table of Contents LA Installing LA 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 9 / 48 Miguel Vidal LA in a Nutshell
What is L A LA Installing LA Set of macros from primitives that abstracted away many of the complexities. A format originally developed by Leslie Lamport. It incorporates document styles for books, letters, slides, etc. The current version is L A 2e. L A is Open Source Software (LaTeX Project Public License - LPPL), OSI-compliant. 10 / 48 Miguel Vidal LA in a Nutshell
LA Installing LA How to pronounce and spell L A, L A, or LaTeX (ASCII), no Latex. Pronounced /látej/ or /látek/, no latex! It derives from the Ancient Greek: τ ɛχνη (tejné: skill, art, technique ) χ: Ji letter (voiceless velar fricative, as ojo or Bach ), Chi /kai/ in English. IPA (International Phonetic Alphabet): [x] phonem 11 / 48 Miguel Vidal LA in a Nutshell
Table of Contents LA Installing LA 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 12 / 48 Miguel Vidal LA in a Nutshell
Advantages LA Installing LA Control Quality Flexibility Portability Scalability Stability 13 / 48 Miguel Vidal LA in a Nutshell
Advantages (2) LA Installing LA 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. 14 / 48 Miguel Vidal LA in a Nutshell
Advantages (3) LA Installing LA 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. 15 / 48 Miguel Vidal LA in a Nutshell
Caveats LA Installing LA 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. 16 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA Compare kerning: 17 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA Compare kerning: 17 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA Compare kerning: Compare Small Caps: 17 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA Compare kerning: Compare Small Caps: 17 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA MS Word (wrong default kerning) L A (correct kerning) 18 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA MS Word (wrong default kerning) MS Word (fake small caps) L A (real small caps) L A (correct kerning) 18 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A LA Installing LA MS Word (wrong default kerning) MS Word (fake small caps) L A (real small caps) L A (correct kerning) Source images: Dario Taraborelli http://nitens.org/taraborelli/latex (CC-by-sa) 18 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A : ligatures LA Installing LA 19 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A : ligatures LA Installing LA 19 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A : ligatures LA Installing LA MS Word (wrong use of ligatures) L A (correct use of ligatures) 20 / 48 Miguel Vidal LA in a Nutshell
MS Word vs L A : ligatures LA Installing LA MS Word (wrong use of ligatures) L A (correct use of ligatures) Source images: Dario Taraborelli http://nitens.org/taraborelli/latex (CC-by-sa) 20 / 48 Miguel Vidal LA in a Nutshell
Table of Contents LA Installing LA 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 21 / 48 Miguel Vidal LA in a Nutshell
Installing L A LA Installing LA For using L A you need: A text editor for editing your L A source files. A L A distribution for processing (compiling) your L A source files into PDF or DVI documents. A PDF/DVI viewer for previewing and printing documents. 22 / 48 Miguel Vidal LA in a Nutshell
Table of Contents LA Installing LA 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 23 / 48 Miguel Vidal LA in a Nutshell
The simplest document LA Installing LA % Example #1 \ d o c u m e n t c l a s s { a r t i c l e } \ b e g i n { document } H e l l o World! This i s a minimal \LaTeX{} document. \ end { document } 24 / 48 Miguel Vidal LA in a Nutshell
Document workflow LA Installing LA Editor ( foobar.tex ) L A processor ( foobar.dvi ) display (viewer/screen) drivers ( foobar.ps, printer) $ l a t e x f o o b a r. t e x ( t e x &l a t e x f o o b a r. tex ) $ d v i p s o f o o b a r. ps f o o b a r. d v i ( ps output ) $ p d f l a t e x f o o b a r. t e x ( pdf output ) $ hevea f o o b a r. t e x ( html output ) 25 / 48 Miguel Vidal LA in a Nutshell
DVI Output LA Installing LA Device independent file format (.dvi) Binary data independent on any specific image format, display hardware or printer. A L A distribution for processing (compiling) your L A source files into PDF or DVI documents. DVI is not a document encryption format. Not support embedded fonts (fonts must be already installed). 26 / 48 Miguel Vidal LA in a Nutshell
xdvi: DVI Previewer LA Installing LA 27 / 48 Miguel Vidal LA in a Nutshell
L A Distributions LA Installing LA There are pre-compiled L A 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 28 / 48 Miguel Vidal LA in a Nutshell
Table of Contents Document Structure Fonts Environments A complete document 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 29 / 48 Miguel Vidal LA in a Nutshell
Document Structure Document Structure Fonts Environments A complete document Two main environments: Preamble: commands and macros that affect the entire document. Top matter: author, title, date, institution, etc. Document environment: body text 30 / 48 Miguel Vidal LA in a Nutshell
Preamble Document Structure Fonts Environments A complete document Everything from the start of the L A source file until the begin{document} command It normally contains global commands that affect the entire document. \ d o c u m e n t c l a s s [ o p t i o n s ] { c l a s s } \ usepackage [ o p t i o n s ] { package } class (mandatory): book, article, report package (optional): to utilize external macros (inputenc, amssymb...) 31 / 48 Miguel Vidal LA in a Nutshell
Top Matter Document Structure Fonts Environments A complete document Title, date Information about the authors, such as name, address, email etc. \ d o c u m e n t c l a s s [ 1 1 pt, a4 paper, o n e s i d e ] { r e p o r t } \ usepackage [ u t f 8 ] { i n p u t e n c } % utf 8 e ncoding \ usepackage {amssymb} % math symbols \ b e g i n { document } \ t i t l e {How to S t r u c t u r e a LaTeX Document} \ a u t h o r {Andrew R o b e r t s } \ date {December 2004} \ m a k e t i t l e \end{ document } 32 / 48 Miguel Vidal LA in a Nutshell
Body text Document Structure Fonts Environments A complete document Abstract Parts, chapters, sections, subsections, Appendices, Bibliography... \ b e g i n { document }... t e x t mixed with l o c a l commands... \ end { document } 33 / 48 Miguel Vidal LA in a Nutshell
Document Structure Fonts Environments A complete document How to Structure a L A Document L A allows to structure documents with a variety of hierarchical constructs: \ p a r t { Part T i t l e } \ c h a p t e r { Chapter T i t l e } %o n l y books and r e p o r t s \ s e c t i o n { S e c t i o n T i t l e } \ s u b s e c t i o n { S u b s e c t i o n T i t l e } \ s u b s u b s e c t i o n { S u b s u b s e c t i o n T i t l e } 34 / 48 Miguel Vidal LA in a Nutshell
Table of Contents Document Structure Fonts Environments A complete document 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 35 / 48 Miguel Vidal LA in a Nutshell
Font Styles Document Structure Fonts Environments A complete document \ 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 {... } % s m a l l 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 u s i n g \TeX. Output: 36 / 48 Miguel Vidal LA in a Nutshell
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 \ s m a l l \ n o r m a l s i z e \ l a r g e \ Large \LARGE \ huge \Huge Size related to font size default, declared in preamble (documentclass) 37 / 48 Miguel Vidal LA in a Nutshell
Font Sizes. Example Document Structure Fonts Environments A complete document \LaTeX{} was \ t i n y o r i g i n a l l y w r i t t e n \ n o r m a l s i z e i n \ l a r g e 1984 \ n o r m a l s i z e by \LARGE L e s l i e Lamport \ n o r m a l s i z e and has become the \ f o o t n o t e s i z e dominant method \ n o r m a l s i z e f o r u s i n g \ huge \TeX. Output: L A was originally written in 1984 by Leslie Lamport and has become the dominant method for using. 38 / 48 Miguel Vidal LA in a Nutshell
Some special features Document Structure Fonts Environments A complete document 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 39 / 48 Miguel Vidal LA in a Nutshell
Table of Contents Document Structure Fonts Environments A complete document 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 40 / 48 Miguel Vidal LA in a Nutshell
Environments Document Structure Fonts Environments A complete document \ b e g i n { environment name} \ end { environment name} Environments: center, itemize, enumerate, figure, flushright, quotation... 41 / 48 Miguel Vidal LA in a Nutshell
Environments: example Document Structure Fonts Environments A complete document Some FOSS L i c e n s e s : \ b e g i n { 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: 42 / 48 Miguel Vidal LA in a Nutshell
Table of Contents Document Structure Fonts Environments A complete document 1 L A Installing L A 2 Document Structure Fonts Environments A complete document 3 43 / 48 Miguel Vidal LA in a Nutshell
A complete document \ usepackage [ u t f 8 ] { i n p u t e n c } \ t i t l e {The beauty o f \TeX} \ a u t h o r { Donald E. Knuth} \ date {\1979} Document Structure Fonts Environments A complete document \ b e g i n { 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 l o o k as b e a u t i f u l as t h e y used to. I t i s not t h a t t h e i r mathematical c o n t e n t i s u n s a t i s f a c t o r y, r a t h e r t h a t the o l d and w e l l d e v e l o p e d t r a d i t i o n s o f t y p e s e t t i n g have become too e x p e n s i v e. F o r t u n a t e l y, i t now a p p e a r s t h a t mathematics i t s e l f can be used to s o l v e t h i s problem. \ end { document } 44 / 48 Miguel Vidal LA in a Nutshell
A complete document Document Structure Fonts Environments A complete document 45 / 48 Miguel Vidal LA in a Nutshell
Lamport, Leslie. L A : A document preparation system, Addison-Wesley, Reading, Massachusetts, second edition, 1994. Knuth, Donald E. The book, 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 markup language: http://en.wikibooks.org/wiki/latex 46 / 48 Miguel Vidal LA in a Nutshell
(Spanish) Sanguino-Botella, Javier. Iniciación a L A 2e: Un sistema para preparar documentos, Addison-Wesley, 1997. VV.AA. L A : Una imprenta en sus manos, ADI, 2000. y tipografía (web de Javier Bezos): http://www.tex-tipografia.com CervanTeX: Grupo de usuarios hispanohablantes de : http://www.cervantex.es/ 47 / 48 Miguel Vidal LA in a Nutshell
L A in a Nutshell Master on Libre Software 2011-12 Miguel Vidal http://gsyc.urjc.es/~mvidal Twitter: @mvidallopez September 22, 2011 48 / 48 Miguel Vidal LA in a Nutshell