9

I'm using amsmath and its \tag command to tag equations. I remember having a situation where I liked having the tag on the left better than on the right. So I gave my class (which is report btw) the leqno options. Now, however, I find myself wanting to revert to reqno. However, I fear actually removing leqno will make the above mentioned situation look worse. I found that the solution in Switch between leqno and reqno options (of amsmath) in the same document does not work with equation:

\documentclass{report}
\usepackage[leqno]{amsmath}

\makeatletter
\newcommand{\leqnomode}{\tagsleft@true}
\newcommand{\reqnomode}{\tagsleft@false}
\makeatother
\begin{document}

\begin{align}
  f(x) &= ax^2 + bx + c \\
  g(x) &= dx^2 + ex + f
\end{align}

\reqnomode

\begin{align}
  f(x) &= ax^2 + bx + c \\
  g(x) &= dx^2 + ex + f \tag{e}
\end{align}

\begin{equation}
  a^2+b^2=c^2.\tag{1}
\end{equation}

\leqnomode

\begin{equation}
  -\Delta\phi=4\pi k\rho.\tag{2}
\end{equation}


\end{document}

Output:

enter image description here

The first equation should still be in \reqnomode (alias \tagsleft@false) from the second align, yet the tag is on the left. How do I solve the problem without using an align or such which are for multiline display and would therefore be out of place on a single one-line equation?

4
  • And yes, I should not use two \[\]s in a row, but rather use a multiline environment. I usually do, but that is an MWE so I kept it as short as possible.
    – MickG
    Nov 13, 2014 at 21:43
  • @tohecz why is that so?
    – MickG
    Nov 13, 2014 at 21:46
  • @tohecz OK, but the problem persists with equation.
    – MickG
    Nov 13, 2014 at 21:49
  • Interesting. I cleaned up the question, I hope you don't mind, and voted for re-opening.
    – yo'
    Nov 13, 2014 at 21:52

1 Answer 1

15
\documentclass{report}


\usepackage[leqno]{amsmath}



\makeatletter
\newcommand{\leqnomode}{\tagsleft@true\let\veqno\@@leqno}
\newcommand{\reqnomode}{\tagsleft@false\let\veqno\@@eqno}
\makeatother
\begin{document}

\begin{align}
  f(x) &= ax^2 + bx + c \\
  g(x) &= dx^2 + ex + f
\end{align}

\reqnomode

\begin{align}
  f(x) &= ax^2 + bx + c \\
  g(x) &= dx^2 + ex + f \tag{e}
\end{align}


\begin{equation}
  a^2+b^2=c^2.\tag{1}
\end{equation}


\leqnomode

\begin{equation}
  -\Delta\phi=4\pi k\rho.\tag{2}
\end{equation}


\end{document}
2
  • 1
    Great, that works @DavidCarlisle. Could you expand on why \let\veqno\@@eqno makes it work with equation and without that extra command it doesn't?
    – MickG
    Nov 14, 2014 at 7:27
  • 4
    equation is really $$ unlike align which is really a table with $\displaystyle in each cell. \eqno and \leqno are the tex primitives to set eqn numbers in $$ amsmath sets \veqno to one or the other depending on leqno option @MickG Nov 14, 2014 at 8:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .