16

I have 3 short equations which consume much vertical space, if each one is typeset in a separate line.

  • How can I typeset them in one line in a "mathematically correct" way?
    I do not necessarily need separate labels for each one of them: one label (and equation number would be enough)

example

\documentclass[11pt, a4paper]{scrbook}

\usepackage[ngerman]{babel}
\usepackage{array, amsmath}

\begin{document}

\begin{eqnarray}
x_{1} &= & \frac{A-A_{0}}{\frac{1}{2}\cdot \left( A_{\mathrm{A}} - A_{\mathrm{a}} \right)}
\label{exv:eqn:UmrechnungEingangsgroesse1} \\
x_{2} &= & \frac{B-B_{0}}{\frac{1}{2}\cdot \left( B_{\mathrm{A}} - B_{\mathrm{a}} \right)}
\label{exv:eqn:UmrechnungEingangsgroesse2} \\
x_{3} &= &  \frac{C-C_{0}}{\frac{1}{2}\cdot \left( C_{\mathrm{A}} - C_{\mathrm{a}} \right)}
\label{exv:eqn:UmrechnungEingangsgroesse3}
\end{eqnarray}
\end{document}
21

First of all, Avoid eqnarray.

You can use a normal equation environment and separate the equations with a \qquad.

\documentclass[11pt, a4paper]{scrbook}

\usepackage[ngerman]{babel}
\usepackage{amsmath}

\begin{document}

\begin{equation}
x_{1} = \frac{A-A_{0}}{\frac{1}{2}\cdot \left( A_{\mathrm{A}} - A_{\mathrm{a}} \right)}
\qquad
x_{2} = \frac{B-B_{0}}{\frac{1}{2}\cdot \left( B_{\mathrm{A}} - B_{\mathrm{a}} \right)}
\qquad
x_{3} =  \frac{C-C_{0}}{\frac{1}{2}\cdot \left( C_{\mathrm{A}} - C_{\mathrm{a}} \right)}
\label{exv:eqn:UmrechnungEingangsgroesse3}
\end{equation}
\end{document}

enter image description here

(In my original answer I used an align environment, but this isn't really "correct", as that is meant for aligning equations over more than one line. As this only has one line, it is more appropriate to use an equation environment, as commented by Andrew Stacey.)

  • Thanks for the hint on eqnarray and for your example! Is that "mathematically correct"? Should(n't) I use a kind of separator (like semicolon) between the 3 equations? – MostlyHarmless Nov 2 '11 at 11:18
  • 1
    @Martin To be honest, I don't know what is common practice here, sorry. – Torbjørn T. Nov 2 '11 at 12:03
  • @ Torbjørn T.: thanks for your honesty! So I hope there'll drop in some mathematicians which can tell us. :-) – MostlyHarmless Nov 2 '11 at 12:21
  • 1
    (I am a mathematician.) In this case, I'd say that the whitespace is enough separation. I've tried with commas and semi-colons and they just get lost - they're so small with respect to the fractions that they look more like stray pixels that have lost their way. – Loop Space Nov 2 '11 at 13:38
  • 1
    Incidentally, why are you using align and not equation? There's nothing to align with. Using \qquad between the pieces produces adequate separation, I deem. – Loop Space Nov 2 '11 at 13:39
18

Firstly, I fully support the points avoiding eqnarray and using amsmath environments whenever possible, such as align.

amsmath provides a subequations environment, which might also be useful, though it's more for numbering subequations but not for lining up horizontally.

You could use align such as Torbjørn showed, as it supports several columns. Here the & symbol is both for alignment and for separating columns, as in tabular, alternating.

Another option is flalign, you could use it in the very same way, but the equations would be more spread out, so you would have more space.

You don't need to use a amsmath align environment, since the horizontal positioning is a tabular like issue. So if you would like to have equations with labels you can refer to, you could use for example tabularx with equal column width:

\documentclass[11pt,a4paper]{scrbook}
\usepackage{amsmath}
\usepackage{tabularx}
\begin{document}
\chapter{Equations}
See equations \eqref{eqn:1}, \eqref{eqn:2} and \eqref{eqn:3}.

\noindent\begin{tabularx}{\textwidth}{@{}XXX@{}}
  \begin{equation}
  x_{1} = \frac{A-A_{0}}{\frac{1}{2}
    \cdot \left( A_{\mathrm{A}} - A_{\mathrm{a}} \right)}
    \label{eqn:1}
  \end{equation} &
  \begin{equation}
  x_{2} = \frac{B-B_{0}}{\frac{1}{2}
    \cdot \left( B_{\mathrm{A}} - B_{\mathrm{a}} \right)}
    \label{eqn:2}
  \end{equation} &
  \begin{equation}
  x_{3} = \frac{C-C_{0}}{\frac{1}{2}
    \cdot \left( C_{\mathrm{A}} - C_{\mathrm{a}} \right)}
    \label{eqn:3}
  \end{equation}
\end{tabularx}
\end{document}

three equations in a row

  • thanks, a tabularx is also a good idea - I would also accept your answer if I could, but I'll go with the \qquad this time. – MostlyHarmless Nov 3 '11 at 9:03
  • This doesn't seem to work if I want, say 2 columns of 4 equations each and I try to use align rather than equation. ERROR: Forbidden control sequence found while scanning use of \align. Any suggestions? – Joel Sep 24 '16 at 4:17
  • My equations are not aligned vertically when I do this (one has a fraction and the other doesn't). I've tried centering the text as described here: tex.stackexchange.com/questions/104544/… However, it still is not perfectly aligned due to the presence of the fraction in one but not the other. Any suggestions? – nukeguy Oct 7 '16 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.