Difference between revisions of "LaTeX:Math"

Line 21: Line 21:
 
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.
 
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.
  
== Style ==
+
== Display Math ==
  
== Eqnarray ==
+
== Display Style (\displaystyle) ==
  
== Additional packages ==
+
== Equation Arrays (\eqnarray) ==
  
[[LaTeX:Style | Next: Style]]
+
==See Also==
 +
*[[LaTeX:Symbols | Next: Symbols]]
 +
*[[LaTeX:Basics | Previous: Basics]]

Revision as of 17:34, 10 July 2007

LaTeX
About - Getting Started - Diagrams - Symbols - Downloads - Basics - Math - Examples - Pictures - Layout - Commands - Packages - Help

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