latex in a nutshell - urjcmvidal/docs/latex_nutshell.pdf4/48 miguel vidal latex in a nutshell what...

55
What is (La)T E X Basic Structures References L A T E X 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 L A T E X in a Nutshell

Upload: others

Post on 07-Jul-2020

13 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

LATEX in a NutshellMaster on Libre Software 2011-12

Miguel Vidal

http://gsyc.urjc.es/~mvidal

Twitter: @mvidallopez

September 22, 2011

1 / 48 Miguel Vidal LATEX in a Nutshell

Page 2: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

(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 LATEX in a Nutshell

Page 3: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

3 / 48 Miguel Vidal LATEX in a Nutshell

Page 4: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

What is TEX

A computer program (language and interpreter) created byDonald Knuth in 1977.

Knuth wrote the TEX typesetting engine to explore potentialof the digital printing equipment.

He aimed to revert trend of deteriorating typographical qualitythat affected his own books and articles.

Two main aims: highest quality and highest durability.

4 / 48 Miguel Vidal LATEX in a Nutshell

Page 5: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

What is TEX

TEX as we use it today was released in 1982, with some slightenhancements added in 1989 (8-bit characters support).

One of the most sophisticated digital typographical systems(“The greatest contribution in the printing world sinceGutenberg”).

Popular in academia, especially in mathematics, computerscience, engineering, and physics.

Open Source Software (“public domain” dedication): but anymodified version must not be called TEX!

5 / 48 Miguel Vidal LATEX in a Nutshell

Page 6: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating 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 is0,000005356mm! (scaled point, 1 mm = 186712sp)

Functionality is provided by format files (predumped memoryimages of TEX after large macro collections have been loaded).

6 / 48 Miguel Vidal LATEX in a Nutshell

Page 7: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

What is TEX

Written in a ‘literate’ programming language called Web.

TRIP and TRAP tests (“conformance test”): portable, sameoutput with all versions.

The design was frozen (and dedicated to Public Domain) inOctober 1990 (v3.1* –π–, no new features, only bug fixes).

7 / 48 Miguel Vidal LATEX in a Nutshell

Page 8: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

METAFONT

Font description language to describe characters (glyphs)algorithmically with geometrical equations.

It uses Bezier curves (vector graphics).

Also created by Knuth but not strictly part of TEX.

It is possible to use TEX and LATEX without METAFONT.Adobe PostScript fonts may be used instead.

8 / 48 Miguel Vidal LATEX in a Nutshell

Page 9: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

9 / 48 Miguel Vidal LATEX in a Nutshell

Page 10: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

What is LATEX

Set of macros from TEX primitives that abstracted away manyof the TEX complexities.

A “format” originally developed by Leslie Lamport.

It incorporates document styles for books, letters, slides, etc.

The current version is LATEX2e.

LATEX is Open Source Software (LaTeX Project Public License- LPPL), OSI-compliant.

10 / 48 Miguel Vidal LATEX in a Nutshell

Page 11: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

How to pronounce and spell “LATEX”

“TEX”, “LATEX”, or “LaTeX” (ASCII), no “Latex”.

Pronounced /latej/ or /latek/, no ‘latex’ !

It derives from the Ancient Greek: τεχνη (tejne: “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 LATEX in a Nutshell

Page 12: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

12 / 48 Miguel Vidal LATEX in a Nutshell

Page 13: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Advantages

Control

Quality

Flexibility

Portability

Scalability

Stability

13 / 48 Miguel Vidal LATEX in a Nutshell

Page 14: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating 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 logicalstructure).

Separate content and styling.

14 / 48 Miguel Vidal LATEX in a Nutshell

Page 15: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating 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”.

15 / 48 Miguel Vidal LATEX in a Nutshell

Page 16: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Caveats

Not WYSIWIG.

Hard learning curve.

Absolute space/positioning is tricky (it’s very hard to writedisorganized documents).

Design of a whole new layout is difficult and takes a lot oftime.

Need to be compiled.

16 / 48 Miguel Vidal LATEX in a Nutshell

Page 17: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

Compare kerning:

Compare Small Caps:

17 / 48 Miguel Vidal LATEX in a Nutshell

Page 18: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

Compare kerning:

Compare Small Caps:

17 / 48 Miguel Vidal LATEX in a Nutshell

Page 19: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

Compare kerning: Compare Small Caps:

17 / 48 Miguel Vidal LATEX in a Nutshell

Page 20: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

Compare kerning: Compare Small Caps:

17 / 48 Miguel Vidal LATEX in a Nutshell

Page 21: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

MS Word (wrong defaultkerning)

LATEX (correct kerning)

MS Word (fake small caps)

LATEX (real small caps)

Source images: Dario Taraborellihttp://nitens.org/taraborelli/latex (CC-by-sa)

18 / 48 Miguel Vidal LATEX in a Nutshell

Page 22: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

MS Word (wrong defaultkerning)

LATEX (correct kerning)

MS Word (fake small caps)

LATEX (real small caps)

Source images: Dario Taraborellihttp://nitens.org/taraborelli/latex (CC-by-sa)

18 / 48 Miguel Vidal LATEX in a Nutshell

Page 23: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX

MS Word (wrong defaultkerning)

LATEX (correct kerning)

MS Word (fake small caps)

LATEX (real small caps)

Source images: Dario Taraborellihttp://nitens.org/taraborelli/latex (CC-by-sa)

18 / 48 Miguel Vidal LATEX in a Nutshell

Page 24: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX: ligatures

19 / 48 Miguel Vidal LATEX in a Nutshell

Page 25: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX: ligatures

19 / 48 Miguel Vidal LATEX in a Nutshell

Page 26: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX: ligatures

MS Word (wrong use of ligatures)

LATEX(correct use of ligatures)

Source images: Dario Taraborellihttp://nitens.org/taraborelli/latex (CC-by-sa)

20 / 48 Miguel Vidal LATEX in a Nutshell

Page 27: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

MS Word vs LATEX: ligatures

MS Word (wrong use of ligatures)

LATEX(correct use of ligatures)

Source images: Dario Taraborellihttp://nitens.org/taraborelli/latex (CC-by-sa)

20 / 48 Miguel Vidal LATEX in a Nutshell

Page 28: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

21 / 48 Miguel Vidal LATEX in a Nutshell

Page 29: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Installing LATEX

For using LATEX you need:

A text editor for editing your LATEX source files.

A LATEX distribution for processing (compiling) your LATEXsource files into PDF or DVI documents.

A PDF/DVI viewer for previewing and printing documents.

22 / 48 Miguel Vidal LATEX in a Nutshell

Page 30: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

23 / 48 Miguel Vidal LATEX in a Nutshell

Page 31: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

The simplest document

�% 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 ! Th i s i s a min imal \LaTeX{} document .\end{document}� �

24 / 48 Miguel Vidal LATEX in a Nutshell

Page 32: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

Document workflow

Editor (‘foobar.tex’) → LATEX 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 LATEX in a Nutshell

Page 33: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

DVI Output

Device independent file format (.dvi)

Binary data independent on any specific image format, displayhardware or printer.

A LATEX distribution for processing (compiling) your LATEXsource 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 LATEX in a Nutshell

Page 34: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

xdvi: DVI Previewer

27 / 48 Miguel Vidal LATEX in a Nutshell

Page 35: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

TEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

LATEX Distributions

There are pre-compiled LATEX distributions for different OS:

TeX Live (Unix-like systems): Linux, BSD, Solaris, etc.

MacTeX (TeX Live with the addition of Mac specificprograms): http://www.tug.org/mactex

MiKTeX (Windows): http://www.miktex.org

28 / 48 Miguel Vidal LATEX in a Nutshell

Page 36: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

29 / 48 Miguel Vidal LATEX in a Nutshell

Page 37: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Document Structure

Two main environments:

Preamble: commands and macros that affect the entiredocument.

Top matter: author, title, date, institution, etc.

Document environment: body text

30 / 48 Miguel Vidal LATEX in a Nutshell

Page 38: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Preamble

Everything from the start of the LATEX source file until thebegin{document} command

It normally contains global commands that affect the entiredocument.�

\ 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, reportpackage (optional): to utilize external macros (inputenc, amssymb...)

31 / 48 Miguel Vidal LATEX in a Nutshell

Page 39: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Top Matter

Title, date

Information about the authors, such as name, address, emailetc.�

\ 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 } % u t f−8 e n c o d i n g\ usepackage {amssymb} % math symbol s

\ 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 }\ da te {December 2004}\m a k e t i t l e\end{document}� �

32 / 48 Miguel Vidal LATEX in a Nutshell

Page 40: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Body text

Abstract

Parts, chapters, sections, subsections,

Appendices, Bibliography...�\ b e g i n {document}

. . . t e x t mixed w i t h l o c a l commands . . .\end{document}� �

33 / 48 Miguel Vidal LATEX in a Nutshell

Page 41: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

How to Structure a LATEX Document

LATEX allows to structure documents with a variety of hierarchicalconstructs:�\ 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 LATEX in a Nutshell

Page 42: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

35 / 48 Miguel Vidal LATEX in a Nutshell

Page 43: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Font Styles

�\ t e x t i t { . . . } % i t a l i c s\ t e x t b f { . . . } % b o l d\ 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 becomethe \ t e x t i t {dominant} method f o r u s i n g \TeX .� �Output:

36 / 48 Miguel Vidal LATEX in a Nutshell

Page 44: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA 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 LATEX in a Nutshell

Page 45: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA 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\ 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 hasbecome t he \ 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:

LATEX was originally written in 1984 by Leslie Lamport and has

become the dominant method for using TEX.

38 / 48 Miguel Vidal LATEX in a Nutshell

Page 46: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA 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

39 / 48 Miguel Vidal LATEX in a Nutshell

Page 47: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

40 / 48 Miguel Vidal LATEX in a Nutshell

Page 48: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Environments

�\ b e g i n { e n v i r o n m e n t name}\end{ e n v i r o n m e n t name}� �Environments: center, itemize, enumerate, figure,

flushright, quotation...

41 / 48 Miguel Vidal LATEX in a Nutshell

Page 49: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Environments: example

�Some FOSS L i c e n s e s :\ b e g i n { enumerate }\ i t em BSD l i c e n s e\ i t em GPL l i c e n s e\ i t em CDDL l i c e n s e\end{ enumerate }� �Output:

42 / 48 Miguel Vidal LATEX in a Nutshell

Page 50: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

Table of Contents

1 What is (La)TEXTEXLATEXAdvantages and caveatsInstalling LATEXCreating a basic document

2 Basic StructuresDocument StructureFontsEnvironmentsA complete document

3 References

43 / 48 Miguel Vidal LATEX in a Nutshell

Page 51: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

A complete document�\ usepackage [ u t f 8 ]{ i n pu t en c }\ t i t l e {The beauty o f \TeX}\ autho r {Donald E . Knuth}\ date {\1979}

\ beg in {document}\mak e t i t l e

% This i s the comment body .‘ ‘ Mathemat ica l books and j o u r n a l s do not l ook asb e a u t i f u l as they used to . I t i s not t ha t t h e i rmathemat i ca l con t en t i s u n s a t i s f a c t o r y , r a t h e r t ha t theo l d and we l l−deve l oped t r a d i t i o n s o f t y p e s e t t i n g havebecome too e x p e n s i v e . Fo r t una t e l y , i t now appea r s t ha tmathemat ics 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 LATEX in a Nutshell

Page 52: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

Document StructureFontsEnvironmentsA complete document

A complete document

45 / 48 Miguel Vidal LATEX in a Nutshell

Page 53: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

References

Lamport, Leslie. LATEX: A document preparation system,Addison-Wesley, Reading, Massachusetts, second edition,1994.

Knuth, Donald E. The TEXbook, Volume A of Computersand Typesetting, Addison-Wesley, Reading, Massachusetts,second edition, 1984.

CTAN: the authoritative collection of materials related to theTeX typesetting system. http://www.ctan.org

Guide to the LATEXmarkup language:http://en.wikibooks.org/wiki/LaTeX

46 / 48 Miguel Vidal LATEX in a Nutshell

Page 54: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

References (Spanish)

Sanguino-Botella, Javier. Iniciacion a LATEX2e: Unsistema para preparar documentos, Addison-Wesley, 1997.

VV.AA. LATEX: 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/

47 / 48 Miguel Vidal LATEX in a Nutshell

Page 55: LATEX in a Nutshell - URJCmvidal/docs/LaTeX_nutshell.pdf4/48 Miguel Vidal LATEX in a Nutshell What is (La)TEX Basic Structures References TEX LATEX Advantages and caveats Installing

What is (La)TEXBasic Structures

References

LATEX in a NutshellMaster on Libre Software 2011-12

Miguel Vidal

http://gsyc.urjc.es/~mvidal

Twitter: @mvidallopez

September 22, 2011

48 / 48 Miguel Vidal LATEX in a Nutshell