LaTeX Wiki
(Asterisk is part of command name. Syntax [*] can be confused for optional arguments)
 
(21 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The LaTeX language consists of a "preamble" followed by "document text".
+
The LaTeX language consists of a "preamble" followed by "document text". This page describes, at a high level, what goes into these two sections.
 
<div style="padding-left:1cm">
 
<div style="padding-left:1cm">
 
<code>
 
<code>
Line 5: Line 5:
 
… your preamble goes here …<br>
 
… your preamble goes here …<br>
 
\begin{document}<br>
 
\begin{document}<br>
… your text goes here …<br>
+
… your document text goes here …<br>
 
\end{document}<br>
 
\end{document}<br>
 
</code>
 
</code>
Line 11: Line 11:
 
{{stub}}
 
{{stub}}
 
__TOC__
 
__TOC__
 
==Document classes==
  +
{{Main|LaTeX document class}}
  +
Document classes include
  +
* {{Lcls|article}}
  +
* {{Lcls|book}}
  +
* {{Lcls|letter}}
  +
* {{Lcls|report}}
  +
* {{Lcls|slides}}
  +
 
==Preamble==
 
==Preamble==
  +
{{main|LaTeX preamble}}
 
{{Improve|write section}}
 
{{Improve|write section}}
  +
==Document text==
 
 
==Environments==
The '''document text''' consists nested [[environment]]s which are created by matching <code>{{Lcmd|begin}}</code> and <code>{{Lcmd|end}}</code> commands.
 
  +
{{main|List of LaTeX environments}}
===Environments===
 
 
The '''document text''' consists of nested [[environment]]s which are created by matching <code>{{Lcmd|begin}}</code> and <code>{{Lcmd|end}}</code> commands. Inside an environment the text itself, which is a series of [[commands]] (which control how text is formatted) and [[symbols]] (which provide the content).
The highest level environment is the {{Lenv|document}} environment, within which all other environments are nested.
 
  +
 
The highest level environment is the {{Lenv|document}} environment, within which all other environments are nested. Environments can be "[[paragraph mode]]", "[[math mode]]", or "[[LR mode]]". The mode controls which commands and sub-environments are allowed.
  +
  +
Within some environments, special characters or commands have specific meanings. Common examples of these are:
  +
* & ends a column in an array, matrix, or table.
  +
* \\ ends a line
  +
* a completely blank line ends a paragraph (in paragraph mode) and is forbidden in math mode.
  +
  +
==Symbols==
  +
{{main|List of LaTeX symbols}}
  +
Symbols have the form
  +
<code>
  +
:\symbolname{body text} _{subscript} ^{superscript}
  +
</code>
  +
The _subscript and ^superscript are optional. If the body, subscript or superscript is just one character, the braces can be omitted.
  +
  +
Symbols can be [[extensible]], which means variable-sized, or not.
  +
  +
Some symbols, e.g. \lim and \sum can take [[limits]], which means the subscript and superscript are rendered directly below and above the symbol, rather than to the right of the symbol.
  +
  +
Some symbols, such as parentheses, are [[paired]]. A right version of the symbol must be present if the left version is present, and the nesting must be correct for a mathematical formula.
  +
  +
==Commands==
  +
{{main|List of LaTeX commands}}
  +
Commands have the form
  +
<code>
  +
:\commandname{required parameter(s)}[optional parameters]
  +
</code>
  +
  +
See the [[List of LaTeX commands]].
  +
  +
==See also==
  +
* [[Using LaTeX]]
  +
* [[List of LaTeX symbols]]
  +
* [[List of LaTeX environments]]<!--
  +
  +
==External references== page is transcluded from the following source: -->
  +
{{LaTeX Wiki:External references}}
  +
[[Category:Language reference]]

Latest revision as of 11:38, 31 January 2022

The LaTeX language consists of a "preamble" followed by "document text". This page describes, at a high level, what goes into these two sections.

\documentclass{class}
… your preamble goes here …
\begin{document}
… your document text goes here …
\end{document}

Document classes

Main article: LaTeX document class

Document classes include

Preamble

Main article: LaTeX preamble

[improvement needed: write section]

Environments

Main article: List of LaTeX environments

The document text consists of nested environments which are created by matching begin and end commands. Inside an environment the text itself, which is a series of commands (which control how text is formatted) and symbols (which provide the content).

The highest level environment is the document environment, within which all other environments are nested. Environments can be "paragraph mode", "math mode", or "LR mode". The mode controls which commands and sub-environments are allowed.

Within some environments, special characters or commands have specific meanings. Common examples of these are:

  • & ends a column in an array, matrix, or table.
  • \\ ends a line
  • a completely blank line ends a paragraph (in paragraph mode) and is forbidden in math mode.

Symbols

Main article: List of LaTeX symbols

Symbols have the form

\symbolname{body text} _{subscript} ^{superscript}

The _subscript and ^superscript are optional. If the body, subscript or superscript is just one character, the braces can be omitted.

Symbols can be extensible, which means variable-sized, or not.

Some symbols, e.g. \lim and \sum can take limits, which means the subscript and superscript are rendered directly below and above the symbol, rather than to the right of the symbol.

Some symbols, such as parentheses, are paired. A right version of the symbol must be present if the left version is present, and the nesting must be correct for a mathematical formula.

Commands

Main article: List of LaTeX commands

Commands have the form

\commandname{required parameter(s)}[optional parameters]

See the List of LaTeX commands.

See also

External references