Some fundamental rules to follow when using LaTeX.
- The name of your .tex file should include only characters and numbers. Avoid spaces, apostrophes, commas etc.
- Each of the expressions "\begin{blah}", "\[", "$" denote the start of an "environment". Every environment must be closed. A \begin{blah} is closed by a \end{blah}. Every \[ is closed by a \]. A $ is closed by another $.
- All environments must be properly nested. An environment that is begun within another must be closed before the outer environment is closed. For example,
\begin{center}
blah blah blah
\begin{equation}
math math math
\end{center}
\end{equation}
will cause trouble. In contrast,
\begin{center}
blah blah blah
\begin{equation}
math math math
\end{equation}
\end{center}
is ok. Notice that by indenting each environment relative to the one enclosing, it is much easier to see that the nesting is correct.
- The curly braces { and } can be used to open and close environments with no pre-specified features. These can be used to change the appearance of parts of text. For example, the word {\it cool} would appear in italic and the word {\bf hot} would appear as boldface. The nesting rule above applies to these so do not leave stray { or } lying around.
- Math expressions must be inside a math environment: \[ math goes here \] or $ math goes here $ or \begin{equation} math goes here \end{equation}. Some expressions you might consider math are ok in text mode (e.g. the expression "2=3" will be typeset differently in text and math mode but will not cause a fatal error). Some expressions that you might think should work in text mode do not (e.g. "the 5^{th} of August" will cause a fatal error when placed in math mode - a solution to this is described here).