TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}
share|improve this question
    
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 at 12:19
    
(looks like I was thinking along the same lines as Herbert) – cmhughes Feb 18 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 at 14:23
\[
    \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

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

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

share|improve this answer
    
Thanks, this works nicely. Is there a way to make this tabularCenterstack environment page-breakable? – emilG Feb 18 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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