4

I would like to make an 2-line equation tag, for a single equation. I am using the \tag command, and it works as long as I don't store a label for the equation. The moment I store a label, LaTeX barfs at me. In other words this code fails:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{mylabel}
\tag{\parbox[c][3em][c]{4em}{1st tag \\ 2nd tag}}
x = y^2
\end{equation}
\end{document}

But this code works:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
%\label{mylabel}
\tag{\parbox[c][3em][c]{4em}{1st tag \\ 2nd tag}}
x = y^2
\end{equation}
\end{document}

Any ideas?

9

The value for \label is written into the .aux file, thus you need \protect for the fragile \parbox:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{mylabel}
\tag{\protect\parbox[c][3em][c]{4em}{1st tag \\ 2nd tag}}
x = y^2
\end{equation}
\end{document}

Result

A tabular fixes at least the right white space:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{mylabel}
\tag{\protect\begin{tabular}{@{}l@{}}1st tag \\ 2nd tag\protect\end{tabular}}
x = y^2
\end{equation}
\end{document}

Result

But I would avoid two line tags, too many problems remain:

  • Confusion for the reader: two tags for one equation.
  • The parentheses are too small.
  • Two line references would not look too well.

Therefore I would use one line, e.g.:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\label{mylabel}
\tag{1st tag/2nd tag}
x = y^2
\end{equation}
\end{document}

Result

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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