Difference between revisions of "LaTeX:Math"
Line 15: | Line 15: | ||
Compile the document just as you compiled your [[LaTeX:Basics|first document]]. When you view the output file, you should see | Compile the document just as you compiled your [[LaTeX:Basics|first document]]. When you view the output file, you should see | ||
− | + | [Image:http://www.artofproblemsolving.com/LaTeX/Images/mathsamp1.gif] | |
If you remove the <math> symbols from your source file then try to compile, you should get 'Missing </math> 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). | If you remove the <math> symbols from your source file then try to compile, you should get 'Missing </math> 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). | ||
Revision as of 18:28, 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
[Image:http://www.artofproblemsolving.com/LaTeX/Images/mathsamp1.gif]
If you remove the 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.