Commands and Special Characters

Commands are what LaTeX uses to translate plain text into a formatted document. Also known as control sequences, commands usually begin with a backslash, \ .

Using Commands

Commands generally fall into one of two categories: commands which take arguments, and those which do not. Arguments are data given to the command in order for it to run. Most commands which do not take arguments are symbols, such as \epsilon. Others, such as the ubiquitous \begin, always take an argument. Some, like the \newcommand command, take two required arguments and one optional argument.

Optional arguments are included in square brackets. Optional arguments are not necessary for the command to be evaluated, and add more functionality to otherwise limited arguments.

The square root command, \sqrt{x}, can be made into an arbitrary root by using its optional argument \sqrt[10]{x}.

Special Characters

Nine special characters within LaTeX are

\ { } $ ^ _ % ~ # &

See the symbols page for the correct ways to typeset these in documents. If used incorrectly can cause LaTeX to give very cryptic errors.


The \ is used to designate a command. Alphabetic characters and curly and square braces following the backslash are parsed into a command. See below for details. The double backslash, \\, is used to start new lines. It is bad form to use it to start new lines in text mode - only use it in the align environment. To start new paragraphs, just insert a blank line. If the succeeding line should not be indented, use \noindent before the first word of the line.

Curly Braces

The { and } create tokens from the enclosed text. Normally, each character is a single token passed to the interpreter one at a time. When placed in curly braces, the text within the curly braces becomes one token. For example in \begin{align}, they tell the begin command to begin the align environment by passing a token containing the information align. In order to typeset fractions (which requires the \frac command), curly braces need to be placed around numerators and denominators of more than one character or else the interpreter will assume only the first and second non whitespace characters following \frac are the numerator and denominator respectively. So \frac1234 creates \(\frac1234\), while \frac{12}{34} creates \(\frac{12}{34}\). This is because rather than accepting 1 and 2 as tokens, the curly braces pass 12 and 34 as tokens to fill the two arguments which \frac takes. While it is faster to type \frac xy, it is preferred to use \frac{x}{y} to improve readability. Note that the xy in the former requires a space after \frac, as otherwise the interpreter will search for the \fracxy command, which does not exist.

Dollar Sign

The $ is mainly used to invoke inline math mode. Inline equations require dollar signs before and after. Think of them as binary switches, where each one changes the state of the switch. A very common error in LaTeX is to have an odd number, causing the interpreter to interpret math code as regular text and text as math. The dollar sign is a control sequence, a shorthand stand in for \begin{math}. For every situation I have encountered, just using dollar signs is sufficient.

Caret and Underscore

The ^ and _ are used to create superscripts and subscripts respectively. They are considered control sequences, and act on the following token. They only work in math mode. Since LaTeX does not include native subscripts and superscripts in text mode, I use these commands as a workaround.


To use, pass the desired token to the appropriate command. For example, a\subs{0} will produce \(\text{a}_\text{0}\) and a\supe{0} will produce \(\text{a}^\text{0}\).


The percent symbol creates comments. Everything following the percent sign on the same line will not be typeset.


The tilde is a non-breaking space character. It is a typography tool which prevents the insertion of a line break between tokens. So water~main will never allow the words water and main to be placed on separate lines. More accurately, between the tokens r and m as LaTeX will not normally break the words water and main into multiple lines. The non-breaking space also cannot be enlarged or shrunk, so it will force a standard space size. Normally, LaTeX automatically modifies individual spaces to justify the text.


The poundsign is essential for creating new commands, indicating where the arguments of a command to be placed. See the New Commands lesson for more information.


This is used within the align environments defined in the amsmath package. They allow equations to be precisely aligned. When just one ampersand is used in each line of equations, the characters immediately succeeding the ampersands will have their left sides lined up. There are more complex relations when more than one ampersand is used per line, and these are described in the amsmath package lesson.