I am trying to add equation names besides the equation numbers but, in addition, in such a way that \eqref
inserts just the number.
Inspired by the top answer in Add equation name underneath equation number, I tried the following solution:
\documentclass{article}
\usepackage{amsmath}
\newcommand\mylabel[2]{\label{#1} \\[-\baselineskip] \tag*{#2\ \hphantom{(\ref{#1})}}}
\begin{document}
\begin{align}
f(x) = a \mylabel{eq:a}{Constant} \\
h(x) = ax^2+bx+c \mylabel{eq:b}{Quadratic}
\end{align}
Equations \eqref{eq:a} and \eqref{eq:b} look OK\dots
\begin{align}
j(x) = \varinjlim_{C_j} \mylabel{eq:c}{Way too low!}
\end{align}
\dots but the method fails in style for Equation \eqref{eq:c}.
\end{document}
As you can see, the trick I used is to write the equation name in a new line and then lift it by -\baselineskip
. For simple equations as (1) or (2) I get exactly what I want. But indeed, this is shoddy work and it fails as soon as the equation gets a little more complicated, e.g. for (3).
I don't know whether I could use another length instead of -\baselineskip
so that I always get the correct lift, or whether there is a more elegant (and not too complicated) way to achieve what I want.
Best Answer
Based on the answer at How to put a text label *before* an equation?, I just moved the label from the left to the right. In this MWE, I use the
flalign
environment to accomplish the task. In the linked answer, there is also a method employing stacks, ifflalign
is not right for your need.This process can be streamlined with the macro
and the following usage: