LaTeX:Math

Revision as of 18:36, 10 July 2007 by Chris_bayhill (talk | contribs)
LaTeX
About - Getting Started - Diagrams - Symbols - Downloads - Basics - Math - Examples - Pictures - Layout - Commands - Packages - Help

This article will detail how to work with math mode in LaTeX and how to display equations, formulas, and mathematical expressions in general.

Math Mode

LaTeX uses a special math mode to display mathematics. To place something written in TeX in math mode, use $ signs to enclose the math you want to display. For example, open a new source file in TeXnicCenter and type or copy/paste the following:

For example, look at the following segment of code:

\documentclass{article}
\begin{document}
The solution to $\sqrt{x} = 5$ is $x=25$.
\end{document} 

Save the document (press Ctrl-S or click File, then Save) as 'mymath' (don't include the quote marks in the name) in a folder of your choice. The file will appear in your folder as 'mymath.tex.'

Compile the document just as you compiled your first document. When you view the output file, you should see

Mathsamp1.gif

If you remove the $ symbols from your source file then try to compile, you should get 'Missing $ inserted' error messages in the Output window of TeXnicCenter (try it and see - you may have to scroll up in the Output window to see the errors).

Nearly all mathematical items, such as variables, expressions, equations, etc., should be written in math mode. In fact, most math will generate errors if you don't remember to put it in math mode.

Display Math

Display Style (\displaystyle)

Equation Arrays (\eqnarray)

See Also