# Properly align text and equation (single line, three column mixed text and equation)

I have what feels like an very odd problem.

My goal is to simply create a simple single line equation of the following form:

(equation) (text) (equation)


I tried several approaches to achieve this with the align environment, provided by the amsmath package.

My first approach looked something like this:

\begin{align}
a &= b & \text{or} & a &= b
\end{align}


However it returns:

If I replace the text in the middle this problem becomes easily solvable by just putting an extra '&' in its middle. Also having multiple lines seem to solve it. Yet I couldn't find a way to achieve this in this very setting. Any Ideas?

Thank you very much for your help!

• Try using the aligned environment instead of align. Note that it has to be in mathmode: \begin{aligned}\end{aligned} – Andreas Storvik Strauman Apr 13 '18 at 15:17
• alignis for alignment, while you say you want to create a single line. What about simple and plain $a=b \qquad\text{or}\qquad a=b$? – campa Apr 13 '18 at 15:24

What you missed is that you need 5 & for 3 alignment points: each column of alignment, except the first, requires one & to start a new column, and another & to mark the alignment point inside that column:

\documentclass{article}

\usepackage{mathtools}

\begin{document} %

\begin{align}
a &= b & & \text{or} & a &= b
\end{align}

\end{document}


I suggest you use the following setup:

\documentclass{article}
\usepackage{amsmath} % for '\text' macro
\begin{document}
$$a = b \qquad \text{or} \qquad c = d$$
\end{document}


If \qquad doesn't provide enough horizontal separation, give \qquad\quad or \qquad\qquad a try.

If you don't need the equation to be numbered, replace equation with equation*.

Note that there's little point in deploying the heavy-duty machinery of the align environment, since no alignment across rows is going to be performed, right?