8

I would like to align several lines with respect to a symbol, say an equality sign, above which something else is written (using \overset), while taking that, what is written above the symbol, into account for spacing, like this: enter image description here

However, I cannot put the "&" into the argument of \overset, as this seems to be syntactically forbidden. When placing it next to \overset, the lines are, of course, not aligned with respect to the equality sign: enter image description here

I tried using \mathclap, which provides the alignment I want, but then the spacing gets too tight: enter image description here Here is my minimal working example:

\documentclass[a4paper,12pt,fleqn]{article}

\usepackage[fleqn]{amsmath}
\usepackage{amsmath, amssymb, graphics, setspace}
\usepackage{latexsym}
\usepackage{mathtools}

\begin{document}

Placing "\&" next to overset:
\begin{alignat*}{1}
\textrm{some expression} & \overset{(23.1)}{=}\textrm{other expression}\\
 & \overset{(1.3)}{=}\textrm{other expression}\\
 & \overset{(2.4,3.5)}{=}\textrm{other expression}
\end{alignat*}

Using mathclap:
\begin{alignat*}{1}
\textrm{some expression} & \overset{\mathclap{(23.1)}}{=}\textrm{other expression}\\
 & \overset{\mathclap{(1.3)}}{=}\textrm{other expression}\\
 & \overset{\mathclap{(2.4,3.5)}}{=}\textrm{other expression}
\end{alignat*}

How I want it to look like:
\begin{alignat*}{1}
\textrm{some expression} & \quad\overset{\mathclap{(23.1)}}{=}\quad\textrm{other expression}\\
 & \quad\overset{\mathclap{(1.3)}}{=}\quad\textrm{other expression}\\
 & \quad\overset{\mathclap{(2.4,3.5)}}{=}\quad\textrm{other expression}
\end{alignat*}
Of course, adding spaces manually as done here is not a satisfactory solution to the problem.

\end{document}
  • is the alignat a necessary environment for your purposes? if not, perhaps an arrangement using an array environment may help? e.g \[ \begin{array}{r@{}c@{}l} \textrm{some expression} & \overset{{(23.1)}}{=}&\textrm{other expression}\\ & \overset{{(1.3)}}{=}&\textrm{other expression}\\ & \overset{{(2.4,3.5)}}{=}&\textrm{other expression} \end{array} \] – cmhughes Feb 18 '16 at 12:19
  • (looks like I was thinking along the same lines as Herbert) – cmhughes Feb 18 '16 at 12:20
  • I chose the alignat environment because it is page-breakable and allows numbering single lines. If this is possible with array, then array is fine for me as well. – emilG Feb 18 '16 at 14:23
7
\[
    \begin{array}{r@{}c@{}l}
    \textrm{some expression} & \overset{(23.1)}{=}  &\textrm{other expression}\\
                             & \overset{(1.3)}{=} & \textrm{other expression}\\
                             & \overset{(2.4,3.5)}{=} &\textrm{other expression}
    \end{array}
\]

enter image description here

or for less space:

\begin{array}{r@{\kern-2pt}c@{\kern-2pt}l}

enter image description here

  • 1
    Thanks, this works nicely. Is there a way to make this array environment page-breakable? – emilG Feb 18 '16 at 14:19
  • 1
    Yes, but only in Text mode with a longtable. You have to use the $...$ Notation for math – user2478 Feb 18 '16 at 15:01
3

This uses a \tabularCenterstack from the tabstackengine package. Intercolumn width is controlled by \setstacktabulargap{0pt}. Interrow baselineskip is controlled by \setstackgap{L}{1.4\baselineskip}.

\documentclass[a4paper,12pt,fleqn]{article}

\usepackage[fleqn]{amsmath}
\usepackage{amsmath, amssymb, graphics, setspace}
\usepackage{latexsym}
\usepackage{mathtools}
\usepackage{tabstackengine}
\stackMath
\def\poverset{\protect\overset}
\setstackgap{L}{1.4\baselineskip}
\setstacktabulargap{0pt}
\begin{document}

Using \verb|\tabularCenterstack|:
\[
\tabularCenterstack{rcl}{
\textrm{some expression} & \poverset{(23.1)}{=}&\textrm{other expression}\\
 & \poverset{(1.3)}{=}&\textrm{other expression}\\
 & \poverset{(2.4,3.5)}{=}&\textrm{other expression}
}
\]
\end{document}

enter image description here

  • Thanks, this works nicely. Is there a way to make this tabularCenterstack environment page-breakable? – emilG Feb 18 '16 at 14:19

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.