Difference between revisions of "LaTeX:LaTeX on AoPS"

(Beyond the Basic Expressions)
(Beyond the Basic Expressions)
Line 53: Line 53:
 
<b>Grouping Expressions</b>: Our ordinary parentheses <code>(...)</code> and brackets <code>[...]</code> work to group expressions in <math>\LaTeX</math>. For instance, <code>$(x+y)[z+w]$</code> gives us <math>(x+y)[z+w].</math> We can also group expressions using curly braces, but we can't just type <code>{...}</code>. Rather, we must type <code>\{...\}</code>. This is because <math>\LaTeX</math> uses plain curly braces for other things, such as fractions and superscripts and subscripts.
 
<b>Grouping Expressions</b>: Our ordinary parentheses <code>(...)</code> and brackets <code>[...]</code> work to group expressions in <math>\LaTeX</math>. For instance, <code>$(x+y)[z+w]$</code> gives us <math>(x+y)[z+w].</math> We can also group expressions using curly braces, but we can't just type <code>{...}</code>. Rather, we must type <code>\{...\}</code>. This is because <math>\LaTeX</math> uses plain curly braces for other things, such as fractions and superscripts and subscripts.
  
<br>
+
<br><br>
  
 
When we put (vertically) large expressions inside of parentheses (or brackets, or curly braces, etc.), the parentheses don't resize to fit the expression and instead remain relatively small. For instance, <code>$$f(x) = \pi(\frac{\sqrt{x}}{x-1})$$</code> comes out as <cmath>f(x) = \pi(\frac{\sqrt{x}}{x-1}).</cmath> To automatically adjust the size of parentheses to fit the expression inside of them, we type <code>\left(...\right)</code>. If we do this for our <math>f</math> equation above, we get <cmath>f(x) = \pi\left(\frac{\sqrt{x}}{x-1}\right).</cmath>
 
When we put (vertically) large expressions inside of parentheses (or brackets, or curly braces, etc.), the parentheses don't resize to fit the expression and instead remain relatively small. For instance, <code>$$f(x) = \pi(\frac{\sqrt{x}}{x-1})$$</code> comes out as <cmath>f(x) = \pi(\frac{\sqrt{x}}{x-1}).</cmath> To automatically adjust the size of parentheses to fit the expression inside of them, we type <code>\left(...\right)</code>. If we do this for our <math>f</math> equation above, we get <cmath>f(x) = \pi\left(\frac{\sqrt{x}}{x-1}\right).</cmath>

Revision as of 16:18, 1 October 2015

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

This article explains how to use LaTeX in the AoPSWiki, the AoPS Community, and the AoPS Classroom. See Packages to know which packages are prebuilt into the AoPS site.



Getting Started with LaTeX

The Very Basics

LaTeX uses a special "math mode" to display mathematics. There are two types of this "math mode":

  • In-line math mode. In in-line math mode, we use $ signs to enclose the math we want to display, and it displays in-line with our text. For example, typing $\sqrt{x} = 5$ gives us $\sqrt{x} = 5.$

  • Display math mode. In display math mode, we enclose our code in double dollar signs, and it displays the math centered and on its own line. For example, $$\sqrt{x} = 5$$ gives us \[\sqrt{x} = 5.\] Besides displaying in-line vs. displaying centered and on a new line, the two modes render differently in other ways. Note that $\sum_{k=1}^n k^2$ gives us $\textstyle\sum_{k=1}^n k^2,$ whereas $$\sum_{k=1}^n k^2$$ gives us \[\sum_{k=1}^n k^2.\]

Basic Expressions

  • Multiplication: Sometimes, when we're multiplying, we don't need a multiplication symbol. For instance, we can write $xy$ instead of $x\cdot y$ without ambiguity. However, when you're multiplying numbers, for instance, a multiplication symbol comes in handy. The standard symbol is given by $\cdot$. For example, $12\cdot\frac{1}{2}$ gives us $\textstyle 12\cdot \frac 12.$

  • Fractions: We can make fractions via $\frac{...}{...}$. For instance, $\frac{x+y}{2}$ will give us $\textstyle\frac{x+y}{2}.$

  • $n^\text{th}$ Roots: Square roots in $\LaTeX$ are pretty simple; we just type $\sqrt{...}$. For instance, $\sqrt{2}$ gives us $\sqrt 2.$ Cube roots, fourth roots, and so on are only slightly more difficult; we type $\sqrt[n]{...}$. For instance, $\sqrt[4]{x-y}$ gives $\sqrt[4]{x-y}.$

  • Superscripts and Subscripts: To get superscripts (or exponents), we use the caret symbol ^. Typing $x^2+y^2$ gives $x^2+y^2.$ Subscripts are obtained via an underscore (holding shift and the minus sign on most keyboards). For instance, $a_k$ yields $a_k.$

  • Groups:

Beyond the Basic Expressions

  • Grouping Expressions: Our ordinary parentheses (...) and brackets [...] work to group expressions in $\LaTeX$. For instance, $(x+y)[z+w]$ gives us $(x+y)[z+w].$ We can also group expressions using curly braces, but we can't just type {...}. Rather, we must type \{...\}. This is because $\LaTeX$ uses plain curly braces for other things, such as fractions and superscripts and subscripts.

    When we put (vertically) large expressions inside of parentheses (or brackets, or curly braces, etc.), the parentheses don't resize to fit the expression and instead remain relatively small. For instance, $$f(x) = \pi(\frac{\sqrt{x}}{x-1})$$ comes out as \[f(x) = \pi(\frac{\sqrt{x}}{x-1}).\] To automatically adjust the size of parentheses to fit the expression inside of them, we type \left(...\right). If we do this for our $f$ equation above, we get \[f(x) = \pi\left(\frac{\sqrt{x}}{x-1}\right).\]

Making Figures Using Asymptote

LaTeX can also be used to draw figure and diagrams on the AoPS site using a language called Asymptote. See Asymptote to learn more.

That's all there is to invoking LaTeX on the AoPS site. Of course, you'll want to do more than square roots! You can read through the Symbols and Commands pages to learn how to render other symbols with LaTeX. You can also click on formulas created by others to see the code they've used.

Invalid username
Login to AoPS