# eLyXer Math Showcase

## Alex Fernández (elyxer@gmail.com)

Table of Contents

# 1Introduction

This document is intended as a showcase of the mathematical abilities of eLyXer; for more information be sure to visit the main page.

## 1.1Versions

There are several versions of this page:

- A non-Unicode version of this page with midspaces.
- A Unicode version with mathematical spaces (generated with `--unicode`).
- An ISO-8859-15 version (generated with `--iso885915`).
- An HTML version (generated with `--html`).
- A jsMath version that uses jsMath (generated with `--jsmath`).
- A MathJax version with MathJax (generated with `--mathjax`).

All of them are generated from the same `.lyx` source file; they should help you decide which rendering options suit you best.
Also available online is the eLyXer translation of the latest LyX’s detailed Math manual, which contains a lot more examples of LyX maths.

# 2Typography

Math formulae use a lot of different symbols and fonts.

## 2.1Greek Symbols

Greek symbols are very important in equations: \phi, \pi, \Xi. eLyXer offers a complete set in both upper case: \Gamma\ldots\Omega and lower case: \alpha\ldots\omega. Also the AMS italicized upper case: \varGamma\ldots\varOmega.

## 2.2Math Symbols

eLyXer supports the whole set of math symbols in John D. Cook's list: \exists\partial\nabla\geq. It can also render a few more: \propto\times. You also get all symbols from Markus Kuhn's list: \bigodot\amalg.

## 2.3Other Symbols

There are other symbols like arrows: \leftarrow\rightarrow, or geometrical shapes: \circ, \square. eLyXer offers limited support for them. You might also want to use financial symbols in formulae: \yen\euro\$.

## 2.4Spacing

Equations look good when items are properly separated. The main separation is the Medium Mathematical Space: x=3. Note: if you are viewing the non-Unicode version math.html of this page then you are in fact seeing midspaces, which are very similar but not exactly the same: \frac{4}{18}\mathrm{em} for medium mathematical spaces versus \frac{1}{2}\mathrm{en}, where 1\mathrm{em}=2\mathrm{en}. Try out the Unicode version math-unicode.html — and viceversa. You can check out what version this page is in the page title.
The command `\raisebox` is useful to, surprisingly, raise a little box,
\raisebox{2mm}{raised}over\raisebox{-2mm}{lowered}\textrm{and back}.
Like `\mbox`, it puts its content in a text box. It can also be used just for spacing:
\raisebox{5mm}{}B^{V}.
There are other spacing commands: `\hspace`: a\hspace{4mm}b, protected space: a\ b, and (at “block level”)`\vspace`: a\vspace{1cm}b.
There should be 1 cm of vertical space above this paragraph.

## 2.5Fonts

By default, letters denote variables and are taken from the `\mathnormal` font, which is italic, \alpha x+\alpha y=\alpha(x+y), with the exception of upright capital Greek letters, G\ne\Gamma.
Function names should be upright: \sin(2\pi),\log(x),\tan\delta.
Mathematical fonts used in equations include \mathrm{Roman} (`\mathrm`), \mathsf{Sans\: Serif} (`\mathsf`), \mathtt{Typewriter} (`\mathtt`), \mathbf{Bold} (`\mathbf`), \mathscr{SCRIPT} (`\mathscr`), \mathcal{CALLIGRAPHIC} (`\mathcal`), \mathbb{BLACKBOARD\: BOLD} (`\mathbb`), and \mathfrak{Fraktur} (`\mathfrak`). For the latter, some single characters are translated to their Unicode equivalents: \mathscr{F}, \mathbb{F}, \mathfrak{F}.
Regular text in a formula can be achieved via text font commands like `\textrm`: 5\:\textrm{to}\:10, via boxes like \mbox (prevents line breaks): 6\mbox{ is more than }5, or the AMSmath `\text` macro (scales like math symbols) \text{base}_{\text{sub}}^{\text{super}}. The content of an mbox is processed in LaTeX text mode. This allows text font commands, e.g. a switch to sans-serif-bold-italic, or the phonetic alphabet: \mbox{\textbf{\textsf{\textbf{\textit{sfbfit}}}}, \textipa{tipa}}.
Units should be written upright, either with `\mathrm` or with macros from the `units` package, e.g. as simple unit, \unit{km}, with magnitude, \unit[57]{km}, with fractional unit, \unitfrac[200]{km}{h}, or with a fraction before the units, \unit[\nicefrac{3}{2}]{km}, \unit[\frac{7}{16}]{s}.

# 3Numeration

Equations can be numbered, like (↓)
\begin{equation} y=x\label{eq:first}\end{equation}
And also like (↓).
\begin{equation} x=3\label{eq:second}\end{equation}
Some equations can be numbered even if they don’t have a label.
\begin{equation} x=2y\end{equation}
Notice that equation (↓) comes after (↓).

# 4Simple Structures

Let’s now see a few of the simpler structures that eLyXer can output.

## 4.1Fractions

A simple fraction:
\frac{1}{2}.
Inlined: \frac{2}{3}.
A big recursive fraction:
\frac{1}{\left(1+\left(\frac{1}{1+\left(\frac{1}{1+2x}\lyxlock\right)}\lyxlock\right)\right)}\lyxlock
A nice fraction: \nicefrac{5}{6}. A non-diminishing fraction containing alignments:
\cfrac{1}{1+\left(\cfrac[l]{1}{1+x}\times\cfrac[r]{1}{1+x}\right)}.
A similar concept is a binomial coefficient: \binom{A+1}{B}. It can be prettily presented:
\dbinom{A}{B+1}.
A symbol can be stacked over another using `\stackrel`: x\stackrel{R}{\rightarrow}y. Anything can be stacked:
d\stackrel{x>3}{\lim}x,\quad\stackrel{\mathrm{head}}{\mathrm{heels}}.

## 4.2Limits

\lim_{x\rightarrow\infty}f(x) should appear as x\rightarrow\infty in italics, and «lim» in plain style. In display mode, a limit must appear below the main symbol:
\lim_{x\rightarrow\infty}\lyxlock f(x).
Limits are also used in sums and integrals:
\sum_{i=1}^{\infty}x,\;\int_{0}^{\infty}f(x)\,\mathrm{d}x
where the sum’s limits should appear below (i=1) and above (\infty) the \sum. The placement of the integral limits depends on the document class: LaTeX standard classes place them right to the \int. Limits are shown to the right in inline formulae: \sum_{i=1}^{\infty}x and \intop_{i=1}^{\infty}x.
The placing of limits can be configured with the `\limits` and `\nolimits` macros:
\lim\nolimits _{x\rightarrow\infty}\lyxlock f(x),\;\sum\nolimits _{i=1}^{\infty}x,\;\int\limits _{0}^{\infty}f(x)\,\mathrm{d}x

## 4.3Roots

A square root: \sqrt{3}. A more complex root in a fraction:
\frac{1}{\left(1+\sqrt{2}\left(\frac{1}{1+\sqrt{2}}\lyxlock\right)+\sqrt{\frac{1}{2}}\right)}\lyxlock.
eLyXer can also do higher-order roots: \sqrt[3]{x+y}. A devilish case mixing everything we have seen so far:
\frac{\sqrt[\nicefrac{7}{8}]{\frac{8}{4}x}+\sum_{i=1}^{\infty}x}{\sqrt[s+5]{\frac{(78x+45y)\times\sqrt{\Omega}}{\sin(x+1)}+\unit[38]{km}}}\lyxlock.

# 5Complex Structures

In this section we will explore arrays and related constructs.

## 5.1Arrays

An inline array \left[\begin{array}{cc} a & b\\ c & d\end{array}\right] is always shown in the same line. In display mode, the array is shown on its own line:
\left[\begin{array}{lc} 12 & 2\\ 3 & 4\times y^{x}\end{array}\right]
Apart from that the appearance should be the same.

## 5.2Brackets

Arrays are separated by variable-size brackets: \left(\begin{array}{cc} a & b\\ c & d\end{array}\right) \left[\begin{array}{cc} a & b\\ c & d\end{array}\right] \left\{ \begin{array}{cc} a & b\\ c & d\end{array}\right\} \left\langle \begin{array}{cc} a & b\\ c & d\end{array}\right\rangle \left|\begin{array}{cc} a & b\\ c & d\end{array}\right|which might also differ on right and left \left(\begin{array}{cc} a & b\\ c & d\end{array}\right) or use the empty opening \left\{ \begin{array}{cc} a & b\\ c & d\end{array}\right. or closing: \left.\begin{array}{cc} a & b\\ c & d\end{array}\right|. There are also fixed-size big brackets, e.g. \bigl\langle f\bigr\rangle.

## 5.3Cases

Used to switch between several values.
y=\begin{cases} x & i=0,\\ x+1 & i<3\end{cases}
Cases may have more than two rows:
f(x)=\begin{cases} 0 & x<0,\\ \infty & x=0\\ 0 & x>0\end{cases}

## 5.4Braces

Values can be underbraced or overbraced.
\underbrace{a-b}=\overbrace{b+c+d+e}.

# 6Macros

Now it’s time for user-defined commands (sometimes called “macros”).
Definitions can be added as macros \renewcommand{\stupidroot}[2]{\sqrt[#1]{#2}} {\sqrt[#1]{#2}} . Then they can be used in formulae: \stupidroot 12. They can accept default parameters \renewcommand{\defaultroot}[2][4][5]{\sqrt[#1]{#2}} {#1\sqrt{#2}} . Again, useful in formulae: \defaultroot.
Other definitions from the preamble can be used: \preambleroot{3}{4}.
Definitions on the fly are also possible: \newcommand{\ontheflyroot}[2]{\sqrt[#1]{#2}}\ontheflyroot{7}{8}, and used with different values: \ontheflyroot{a}{b}.