2

How do I include a name beside the equation number? For example, I want (clf, 2) without having to specify the number beside it.

\documentclass{article}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{graphicx}
\usepackage{amsmath}

\begin{document}

\begin{align} a = \label{eq:attentionhead} \tag{clf} \end{align}

\ref{eq:attentionhead}

\end{document}

enter image description here

I also want to refer to it and have it show only has (2). For example

\ref{eq:attentionhead}

shows up as clf in the text and not (2).

Kong
  • 2,313

1 Answers1

3

I would keep the equation's descriptor -- "elf", say -- visually separated from the "standard" equation number, by a small gap. If you're ok with this restriction, an flalign-based solution may be of interest to you.

enter image description here

In the first equation, the \phantom{(\mathrm{elf})\ (2)} string ahead of the first instance of && serves to provide an invisible "balance" to the material displayed at the far right of the equation line. If you're not concerned about keeping the real equation in the middle of the row, you don't need to provide the \phantom{(\mathrm{elf})\ (2)} balancing string; the resulting "look" is shown in the second equation.

\documentclass{article}
\usepackage{amsmath} % for 'flalign' environment
\usepackage{showframe} % draw framelines around text block
\begin{document}
\stepcounter{equation} % just for this example

% first, with balancing (recommended) \noindent \dots\ establishing that: \begin{flalign} \phantom{(\mathrm{elf})\ (2)} && % balance out width of descriptor \alpha_i^t &= g\Bigl(\frac{u}{v}\Bigr) && (\mathrm{elf}) % equationdescriptor \label{eq:attentionhead1} \end{flalign} A cross-reference to equation \eqref{eq:attentionhead1}.

% second, without balancing \bigskip \noindent \dots\ establishing that: \begin{flalign} && % no balancing \alpha_i^t &= g\Bigl(\frac{u}{v}\Bigr) && (\mathrm{elf}) % equation descriptor \label{eq:attentionhead2} \end{flalign} A cross-reference to equation \eqref{eq:attentionhead2}.

\end{document}

Mico
  • 506,678