Help:LaTeX
- Help:LaTeX
This page provides a beginner's guide to using LaTeX within MediaWiki. LaTeX is a powerful typesetting system, particularly well-suited for mathematical formulas, scientific notation, and complex symbols. MediaWiki, the software powering this wiki, offers robust support for rendering LaTeX code. This guide will cover everything from basic inline formulas to more complex displayed equations, common symbols, and troubleshooting tips. Understanding LaTeX will greatly enhance your ability to contribute high-quality, technically accurate content to this wiki, especially in articles related to Technical analysis, Trading strategies, and financial modeling.
What is LaTeX?
LaTeX (pronounced "LAY-tek" or "LAH-tek") is a document preparation system. Unlike "What You See Is What You Get" (WYSIWYG) editors, LaTeX focuses on *content* rather than formatting. You write plain text with markup tags that describe the structure and appearance of your document. A LaTeX processor then takes this code and produces a beautifully typeset output, typically a PDF file.
Within MediaWiki, we don’t generate full documents; instead, we use LaTeX to render *mathematical expressions* within web pages. This is achieved using a specific syntax that MediaWiki recognizes and translates into visually appealing equations. This is particularly crucial for topics like Candlestick patterns where precise mathematical definitions are important.
Basic Inline LaTeX
To include a simple mathematical expression *within* a sentence, enclose your LaTeX code within single dollar signs (`$`). For example:
`The area of a circle is $A = \pi r^2$.`
This will render as:
The area of a circle is $A = \pi r^2$.
Notice how the LaTeX code is interpreted and displayed as a formatted equation within the text flow. This is ideal for incorporating equations into explanations of Moving averages or Bollinger Bands.
Displayed LaTeX Equations
For equations that need to stand alone, or require more space and clarity, use double dollar signs (`$$`). This will render the equation on a separate line, centered on the page.
`$$E(X) = \sum_{i=1}^{n} x_i p_i$$`
This will render as:
$$E(X) = \sum_{i=1}^{n} x_i p_i$$
Displayed equations are perfect for defining complex formulas used in Options pricing models or explaining Fibonacci retracements.
Common LaTeX Symbols and Commands
Here’s a table of common LaTeX symbols and commands, categorized for easier reference. Remember that LaTeX is case-sensitive, so `\pi` is different from `\Pi`.
| Symbol/Concept | LaTeX Code | Rendered | |---|---|---| | **Basic Math Operators** | | | | Plus | `+` | + | | Minus | `-` | - | | Multiplication | `\times` or `*` | × or * | | Division | `\div` or `/` | ÷ or / | | Exponentiation | `^` | ^ | | Subscript | `_` | _ | | Square Root | `\sqrt{x}` | √x | | nth Root | `\sqrt[n]{x}` | ⁿ√x | | **Greek Letters** | | | | Alpha | `\alpha` | α | | Beta | `\beta` | β | | Gamma | `\gamma` | γ | | Delta | `\delta` | δ | | Epsilon | `\epsilon` | ε | | Pi | `\pi` | π | | Sigma | `\sigma` | σ | | Omega | `\omega` | ω | | **Sets and Logic** | | | | Union | `\cup` | ∪ | | Intersection | `\cap` | ∩ | | Not | `\neg` | ¬ | | Infinity | `\infty` | ∞ | | Element of | `\in` | ∈ | | Not an element of | `\notin` | ∉ | | **Other Common Symbols** | | | | Degree | `^\circ` | ° | | Percent | `%` | % | | Approximately equal to | `\approx` | ≈ | | Less than or equal to | `\leq` | ≤ | | Greater than or equal to | `\geq` | ≥ | | Integral | `\int` | ∫ | | Summation | `\sum` | Σ | | Fraction | `\frac{a}{b}` | a/b | | | `\pm` | ± |
This is just a starting point. A vast library of LaTeX symbols and commands exists. You can find comprehensive lists at websites like [1](https://www.latex-project.org/) and [2](https://en.wikibooks.org/wiki/LaTeX/Mathematics).
More Complex LaTeX Structures
LaTeX allows for creating intricate mathematical expressions. Here are a few examples:
- **Matrices:**
`$$ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} $$`
This renders as:
$$ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} $$
- **Fractions:**
`$$\frac{x+1}{y-2}$$`
This renders as:
$$\frac{x+1}{y-2}$$
- **Integrals and Limits:**
`$$\int_0^\infty e^{-x^2} dx$$`
This renders as:
$$\int_0^\infty e^{-x^2} dx$$
- **Subscripts and Superscripts:**
`$$x_{i,j}^2$$`
This renders as:
$$x_{i,j}^2$$
- **Brackets and Parentheses:** LaTeX automatically handles paired brackets, parentheses, and braces. For larger brackets, use `\left(` and `\right)`.
`$$\left( \frac{a}{b} \right)$$`
This renders as:
$$\left( \frac{a}{b} \right)$$
These structures are invaluable when discussing Quantitative trading algorithms or complex Risk management techniques.
Using Environments
LaTeX environments provide structured ways to format your equations. Some useful environments include:
- **`align`:** Used for aligning multiple equations.
```latex \begin{align} x &= y + z \\ y &= z + x \\ z &= x + y \end{align} ```
This renders as:
\begin{align} x &= y + z \\ y &= z + x \\ z &= x + y \end{align}
- **`equation`:** Used for a single numbered equation.
```latex \begin{equation} E = mc^2 \end{equation} ```
This renders as:
\begin{equation} E = mc^2 \end{equation}
- **`cases`:** Used for defining piecewise functions.
```latex f(x) = \begin{cases} 0 & \text{if } x < 0 \\ 1 & \text{if } x \geq 0 \end{cases} ```
This renders as:
f(x) = \begin{cases} 0 & \text{if } x < 0 \\ 1 & \text{if } x \geq 0 \end{cases}
Environments are crucial for presenting detailed mathematical derivations in articles about Elliott Wave Theory or Chaos theory.
Escaping Special Characters
Sometimes, you need to display a character that LaTeX interprets as a command. For example, if you want to display a literal dollar sign (`$`) within your equation, you need to *escape* it using a backslash (`\`).
`\$100` will render as `$100`.
Other characters that may require escaping include:
- `\` (backslash)
- `{` (left brace)
- `}` (right brace)
- `$` (dollar sign)
- `#` (hash symbol)
- `%` (percent sign)
- `&` (ampersand)
- `_` (underscore)
- `^` (caret)
LaTeX Editors and Previewers
While you can write LaTeX directly within the MediaWiki editor, it can be helpful to use a dedicated LaTeX editor to test and preview your code before pasting it into the wiki. Some popular options include:
- **Overleaf:** [3](https://www.overleaf.com/) (Online, collaborative LaTeX editor)
- **TeXstudio:** [4](https://www.texstudio.org/) (Desktop LaTeX editor)
- **TeXmaker:** [5](https://www.xm1math.net/texmaker/) (Desktop LaTeX editor)
These editors provide features like syntax highlighting, error checking, and PDF previews, making it easier to create complex equations.
Troubleshooting LaTeX in MediaWiki
- **Rendering Errors:** If your LaTeX code doesn't render correctly, check for the following:
* **Missing Dollar Signs:** Ensure that inline formulas are enclosed in single dollar signs and displayed equations are enclosed in double dollar signs. * **Incorrect Syntax:** Double-check your LaTeX code for typos and syntax errors. Refer to a LaTeX reference guide. * **Unsupported Commands:** MediaWiki may not support all LaTeX commands. Try simplifying your code or finding alternative commands. * **Conflicting Characters:** Make sure you've properly escaped any special characters.
- **Display Issues:** Sometimes, equations may not display correctly due to browser compatibility issues or CSS conflicts. Try a different browser or clearing your browser cache.
- **Long Equations:** Very long equations can sometimes cause rendering problems. Consider breaking them into smaller parts or using environments like `align`.
- **Use the Preview Feature:** Always use the "Show preview" button in the MediaWiki editor to check how your LaTeX code will be rendered before saving your changes. This can save you a lot of time and effort. See also Help:Editing for more on wiki editing.
Advanced LaTeX Techniques
- **Defining Custom Commands:** For frequently used expressions, you can define custom commands using `\newcommand`.
- **Using Packages:** While MediaWiki doesn’t allow you to directly include LaTeX packages, it supports many common commands that are typically provided by packages.
- **Creating Tables:** LaTeX provides powerful tools for creating tables. However, MediaWiki's own table syntax is often simpler for basic tables. See Help:Tables.
Resources for Learning LaTeX
- **LaTeX WikiBook:** [6](https://en.wikibooks.org/wiki/LaTeX)
- **LaTeX Project:** [7](https://www.latex-project.org/)
- **Detexify:** [8](https://detexify.kirelabs.org/) (Helps you find the LaTeX code for a symbol by drawing it)
- **ShareLaTeX Documentation:** [9](https://www.sharelatex.com/learn/) (Now part of Overleaf)
Mastering LaTeX is a valuable skill for anyone contributing technical content to this wiki. It allows you to present complex information in a clear, concise, and professional manner, improving the overall quality of our articles on topics such as Ichimoku Cloud, Harmonic patterns, Volume Spread Analysis, Support and Resistance levels, Trend lines, Chart patterns, MACD, RSI, Stochastic Oscillator, ATR, Parabolic SAR, Donchian Channels, Average True Range, Heikin Ashi, Keltner Channels, VWAP, Money Flow Index, On Balance Volume, Accumulation/Distribution Line, ADX, DMI, Position Sizing, Kelly Criterion, and Monte Carlo Simulation.
Help:Contents Help:Math Help:Formatting Help:Editing Technical analysis Trading strategies Options pricing models Risk management Quantitative trading Candlestick patterns Moving averages Bollinger Bands Fibonacci retracements Elliott Wave Theory Chaos theory Ichimoku Cloud Harmonic patterns Volume Spread Analysis Support and Resistance levels Trend lines MACD RSI
Start Trading Now
Sign up at IQ Option (Minimum deposit $10) Open an account at Pocket Option (Minimum deposit $5)
Join Our Community
Subscribe to our Telegram channel @strategybin to receive: ✓ Daily trading signals ✓ Exclusive strategy analysis ✓ Market trend alerts ✓ Educational materials for beginners