17

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}
David Carlisle
  • 757,742

2 Answers2

22

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.)

Torbjørn T.
  • 206,688
  • 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 02 '11 at 11:18
  • 1
    @Martin To be honest, I don't know what is common practice here, sorry. – Torbjørn T. Nov 02 '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 02 '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. – Andrew Stacey Nov 02 '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. – Andrew Stacey Nov 02 '11 at 13:39
  • @AndrewStacey Good point about align, I was actually questioning my own judgment on that one a little. I'll edit my answer. – Torbjørn T. Nov 02 '11 at 13:43
21

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

Stefan Kottwitz
  • 231,401
  • 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 03 '11 at 09: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 04: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: http://tex.stackexchange.com/questions/104544/vertically-center-text-in-tabularx-table/105671#105671 However, it still is not perfectly aligned due to the presence of the fraction in one but not the other. Any suggestions? – nukeguy Oct 07 '16 at 19:48