1

I have the following

\documentclass[12pt,a4paper]{article}
\begin{document}
\begin{align}
 a_{m,m} &\overset{(\eqref{eq:masssplitAIndex},\eqref{eq:masssplitLinvIndex})}{=} 1 - a \\
 &\overset{
  \substack{\eqref{eq:masssplitLinvIndex} \\ % too much space here
            \hphantom{\meqref{eq:masssplitAIndex,eq:masssplitLinvIndex}}
            }
          }
  }{=} 1 - a.
 \end{align}

\end{document}

What is the proper solution to stack (with zero skip) a hphantom box above the (0.33) in the figure such that the spacing to the equal sign is correct?)

enter image description here

Gabriel
  • 1,574

2 Answers2

2

The following example uses \stackrel to put the references above the equals sign. The phantom for the second line is set via \ooalign to avoid the explicit measurement of the references of the previous equation.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{hyperref}
\numberwithin{equation}{section}

\begin{document}
\setcounter{equation}{32}
\begin{gather}
  \label{eq:masssplitLinvIndex}
  \text{mass split L inv index}
\\
  \label{eq:masssplitAtIndex}
  \text{mass split at index}
\end{gather}

\begin{align}
  a_{m,m}
  & \stackrel{(\ref{eq:masssplitAtIndex},\,\ref{eq:masssplitLinvIndex})}{=}
  1
\\
  & \stackrel{%
      \ooalign{%
        \phantom{%
          $\scriptstyle
          (\ref{eq:masssplitAtIndex},\,\ref{eq:masssplitLinvIndex})$%
        }\cr
        \hfil$\scriptstyle(\ref{eq:masssplitLinvIndex})$\hfil
      }%
    }{=}
  1
\end{align}
\end{document}

Result

Heiko Oberdiek
  • 271,626
1

You can use alignat together with a hack for centering a column's contents:

\documentclass{article}
\usepackage{amsmath,amssymb}

\numberwithin{equation}{section}

\makeatletter
\newcommand{\Cen}[2]{%
  \ifmeasuring@
    #2%
  \else
    \makebox[\ifcase\expandafter #1\maxcolumn@widths\fi]{$\displaystyle#2$}%
  \fi
}
\makeatother

\begin{document}

\setcounter{equation}{32}
\begin{gather}
x\label{eq:masssplitAIndex}\\
y\label{eq:masssplitLinvIndex}
\end{gather}

Now the main thing:
\begin{alignat}{2}
 a_{m,m} &\Cen{2}{\overset{(\ref{eq:masssplitAIndex},\ref{eq:masssplitLinvIndex})}{=}{}} && 1 - a \\
 &\Cen{2}{\overset{\eqref{eq:masssplitLinvIndex}}{=}}&& 1 - a.
\end{alignat}

\end{document}

enter image description here

See https://tex.stackexchange.com/a/209732/4427 for \Cen

However, I'd prefer a simpler thing:

\begin{alignat}{2}
a_{m,m} &= 1-a &&\qquad\text{by (\ref{eq:masssplitAIndex}, \ref{eq:masssplitLinvIndex})} \\
        &= 1-a &&\qquad\text{by \eqref{eq:masssplitLinvIndex}}
\end{alignat}

enter image description here

egreg
  • 1,121,712