LaTeX Basics

TeX vs. LaTeX

TeX is a computer program created by D. E. Knuth for typesetting documents. It combines a properly prepared text file and the TeX mark-up language to create a typeset document suitable for many kinds of printers. Word processing applications offer many conveniences, but they fail users seeking greater quality and flexibility of control. Many well-established publishers use TeX to typeset books,  mathematical journals, and newspapers.

latex\normalsize {\LaTeX}, written by L. B. Lamport, is one of sevral dialects of TeX. Macros and code packages come bundled with \normalsize {\LaTeX}, or can be imported from open-source archives.  The macros and packages deliver new operating efficiencies for document layout and production.  Examples of enhanced functionality include predefined document templates, simple to complex page layouts, title pages, automatic numbering (of chapters, sections, equations, figures, etc), and rich facilities for internal cross-referencing. \normalsize {\LaTeX} syntax is easy to learn and well suited for integration with content generating programs, like R and database facilities.

Basic LaTeX Syntax

Anything in \normalsize {\LaTeX} can be expressed in terms of text, commands and environments.

Text: The basic document content.

Commands: \normalsize {\LaTeX} commands are case sensitive, and start with a backslash \ and then have a name consisting of letters only. Some commands support optional parameters, which are added after the command name in square brackets [ ].  Some commands need an argument, which has to be given between curly braces { } after the command name.The general syntax is:

For example, the typesetting command that creates the word {\LaTeX} is:

Environments: Environments in \normalsize {\LaTeX} have a role that is quite similar to commands, but they usually effect targeted “text chunks” or wide parts of the document. The syntax is:

Between the \begin and the \end you can put other commands and nested environments. Environments can also accept optional arguments as well.

Comments: When \normalsize {\LaTeX} encounters a % character while processing an input file, it ignores the rest of the current line, the line break, and all whitespace at the beginning of the next line. % can be used to write comments, which will not show up in the printed document.

Reserved Characters: The following symbols are reserved characters that either have a special meaning under \normalsize {\LaTeX} or are unavailable in all the fonts. If you enter them directly in your text file, they will not print and will trigger a \normalsize {\LaTeX} compile error (or do things you did not intend).

Reserved characters can be used in a text document by adding a prefix backslash \.

Quotation Marks and Dashes:  Single quotation marks are produced in \normalsize {\LaTeX} using and '.  Double quotation marks are produced by typing `and ‘ ‘.  A single dash is created, such as 10-15, is created using – –.  An em-dash, such as —, is created using –  –  –.

 Back | Next