1

I have been using the solution in Tag placing with amsmath to turn on the leqno option locally for part of a document. However, when using the align environment from amsmath, this leads to spacing problems: the aligned equations are still shifted left to make room for a tag on the right, with the result that they overlap the tag placed on the left. How can I tell amsmath to process the align environment in the same way as if I had specified the leqno option in the documentclass?

MWE:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\leqnos}{\tagsleft@true\let\veqno\@@leqno}
\newcommand{\reqnos}{\tagsleft@false\let\veqno\@@eqno}\makeatother

\begin{document}
\reqnos
\begin{align}
    1+2+3+4+5+6+7&=7+6+5+4+4+3+2+1
    \tag{Boring Equation}       
\end{align}
\leqnos
\begin{align}
    1+2+3+4+5+6+7&=7+6+5+4+4+3+2+1
    \tag{Boring Equation}       
\end{align}
\end{document}

Picture showing bad align

4
  • see fleqn environment eg tex.stackexchange.com/a/633816/1090 Commented May 10, 2023 at 21:19
  • Interesting. I tried loading nnmath and putting it in a fleqn environment but it still overlapped, actually the overlap was even worse!
    – Cian
    Commented May 10, 2023 at 21:53
  • I found a sort-of-solution to my problem by consulting the amsmath sources: there are four separate definitions of the macro calc@shift@align (plus helper macros) depending on which combination of the fleqn and leqno options is in force, and I was able to pull out a 95-line chunk corresponding to the desired combination. However I would welcome a more efficient solution if possible, as the editors of the volume I'm contributing to might not be so happy if my contribution has to contain such a big block of latex code.
    – Cian
    Commented May 10, 2023 at 21:58
  • yes exactly, that is the issue: that fleqn and leqno are load-time options (to save memory in the 1980s....) so the real code for fleqn or leqno is not there if the options are not used. You can fake simple cases but a real fix requires loading the parts of amsmath not loaded. I thought ncmath did that but I must admit I have never really used it Commented May 10, 2023 at 22:11

0

You must log in to answer this question.

Browse other questions tagged .