0

I want to include an additional text (say the equation name), along with the equation number. The equation name is to be displayed only at the place where the equation is displaced, i.e. when I use \eqref, I should only get the equation number.

I tried a few solutions from the forum, but could not find a satisfactory solution. Here's the code that I have so far

\usepackage{amsmath}
\makeatletter
\newcommand{\owntag}[2][\relax]{% \owntag[short label]{tag}
  \ifx#1\relax\relax\def\owntag@name{#2}\else\def\owntag@name{#1}\fi% base label
  \refstepcounter{equation}\tag{\theequation, #2}%
  \expandafter\ltx@label\expandafter{eq:\owntag@name}%
  \edef\@currentlabel{\theequation, #2}\expandafter\ltx@label\expandafter{Eq:\owntag@name}%
  \def\@currentlabel{#2}\expandafter\ltx@label\expandafter{tag:\owntag@name}%
}
\makeatother

\begin{align}
    \frac{\partial u_i}{\partial x_i} = 0 \qquad \mathrm{or} \qquad \vec{\nabla} \cdot \vec{u} = 0 
    \owntag[example]{Mass conservation}
\end{align}

the mass conservation equation \eqref{mass}.

this is the output thus far. enter image description here

1
  • Welcome to TeX.SE! Commented Jan 30, 2024 at 15:30

1 Answer 1

0

What eventually worked for me is the following:

\refstepcounter{equation}\label{eq:mass}
\begin{equation}
    \frac{\partial u_i}{\partial x_i} = 0 \qquad \mathrm{or} \qquad \vec{\nabla} \cdot \vec{u} = 0 
    \tag{\theequation ,\ Mass\ Conservation}
    \label{dummy}
\end{equation}

This is the mass conservation equation \eqref{eq:mass}. This is its dummy label \eqref{dummy}.

gives the output: enter image description here

The idea is to correctly step and reference (using \refstepcounter) the equation before it is typeset, and use the equation number in \tag (via \theequation) for appropriate labelling and referencing.

Thanks to Werner's answer in this post! Adding letters to equation numbers

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.