# Math mode and beamer

I have some difficulties with math mode in beamer.

At the moment if I add a newline it gives the error message:

Missing inserted. \end{frame}  What am I doing wrong? In another question it has something to do with versions of math-package and beamer, but I have a fresh install. \documentclass[aspectratio=1610]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amssymb,amsmath} \begin{document} \begin{frame}{Example Quadratic Formula} \begin{columns} \column{0.5\textwidth} Dicriminant \begin{math} \text{function } \left[d\right]=\text{dicriminant}(a, b, c) d = b\wedge 2 - 4*a*c \end{math} \column{0.5\textwidth} some text \end{columns} \end{frame} \end{document}  This doesn't work: \documentclass[aspectratio=1610]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{amssymb,amsmath} \begin{document} \begin{frame}{Example Quadratic Formula} \begin{columns} \column{0.5\textwidth} Dicriminant \begin{math} \text{function } \left[d\right]=\text{dicriminant}(a, b, c)\\ d = b\wedge 2 - 4*a*c \end{math} \column{0.5\textwidth} some text \end{columns} \end{frame} \end{document}  • \\  is not intended for use in math , better to use a multi-line math environment such as align* or gather* – David Carlisle Mar 11 '17 at 10:13 • Should it not be b squared instead of b wedge 2? Or am I missing some of the math here? – BMWurm Mar 11 '17 at 12:26 • You should write \operatorname{discriminant} rather than \text{discriminant}. Besides the discriminant is given byd = b^2 - 4ac\$. – user94293 Mar 11 '17 at 17:22
• @BMWurm No you don't missing something. I need it for visual needs – Jan-Bert Mar 11 '17 at 20:32
• @Jan-Bert Thanks for the explanation :D – BMWurm Mar 11 '17 at 21:42

You need some math environment with multi-line support. There is align*, gather*, split, multline, aligned, alignat, and the list continues..

\documentclass[aspectratio=1610]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amssymb,lmodern}

\begin{document}
\begin{columns}
\column{0.5\textwidth}
Dicriminant
\begin{align*}
\text{function } \left[d\right]&=\text{dicriminant}(a, b, c)\\
d &= b\wedge 2 - 4*a*c
\end{align*}
\column{0.5\textwidth}
some text
\end{columns}
\end{frame}

\end{document}


The math-environment is designed to show "inline" math formulae. The word "inline" implies, that the math is presented in the normal running text. Therefore it can't break lines by using Ret or \\. You have to encounter each line in a \begin{math} ... \end{math}environment of its own, like so:

\documentclass[aspectratio=1610]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb,amsmath}

\begin{document}
\begin{columns}
\column{0.5\textwidth}
Dicriminant
\begin{math}
\text{function } \left[d\right]=\text{dicriminant}(a, b, c)
\end{math}
\begin{math}
d = b\wedge 2 - 4*a*c
\end{math}
\column{0.5\textwidth}
some text
\end{columns}
\end{frame}
\end{document}


This works without compilation error.

Despite that, in your case, I would ask you, to use an environment, which was designed for displayed formulae, as you display the formulae as a paragraph of is own right.

A displayed formulae is typeset different, compared to an inline formulae. The font is bigger, the position of the sub- and superscripts is different, ... Do yourself the favour and enjoy the typographic enhancement.

Therefore, I suggest you use something like an eqnarray environment or something similar from the AMS packages, e. g. align:

\documentclass[aspectratio=1610]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb,amsmath}

\begin{document}
\begin{columns}
\column{0.5\textwidth}
Discriminant
\begin{align}
\text{function} \left[d\right] &= \text{discriminant}(a, b, c)\\
\Delta &= b^2 - 4\cdot a\cdot c
\end{align}
\column{0.5\textwidth}
some text
\end{columns}
\end{frame}
\end{document}


Which compiles without error and results in