0

I'm using flalign to align equations flush-left to the page margin.

I then stumbled on this Switch between leqno and reqno options (of amsmath) in the same document and used it.

Now I have tags overlapping the equations. Notice that the room for tags is still to the right.

Overlapping of tags and equations

\usepackage{amsmath,amssymb,amsthm}
\usepackage{dsfont}

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

\leqnomode
\begin{flalign}
& \forall x, y(x,y\in\mathds{R}\Rightarrow x+y\in\mathds{R}) & P \\
& \forall x,y\left[ x,y\in\mathds{R}\Rightarrow x+y=y+x\right] & P \\
& \forall x,y,z\left[x,y,z\in\mathds{R}\Rightarrow(x+y)+z=x+(y+z)\right] & P
\end{flalign}

How can I have automatic and consistent spacing for tags exactly as if they were set to the default position (right)?

Right tags not overlapping

  • 1
    note the fl in fleqn means flush left but the fl in flalign does not: (it stands for full length: not a good name, but it is what it is) – David Carlisle Oct 26 '18 at 12:05
  • Thanks :D. In fact in my document I'm occasionally using flalign to cover an entire line with flush-left formulas and flush-right text (P in this case) (without considering tags). In other occasions I'm using align to center the equations. The point is that I'd rather keep that layout but with tags on the left. – the_eraser Oct 26 '18 at 12:45
1

\newcommand{\leqnomode}{\tagsleft@true} can't work, if given the fleqn option at load time amsmath uses different definitions for most of its environments. Just in a few simple cases (as shown in the linked answer) the same code is used for centred and flush left equations with a runtime \iftagsleft@ test.

To allow switching in general you would need to copy the amsmath code so that it always loaded both centred and flush left versions, (under distinguished internal names, and then \let the public version of the environment to be either either the centred or flush left version depending on the style required at that point.

0

In the place of the flalign environment, you can use a normal align, nested in the fleq environment from nccmath, which works temporarily like the fleqn option, and can take an optional argument: the distance of the equation left margin from the text left margin:

\documentclass{article}
\usepackage{showframe}
\renewcommand{\ShowFrameLinethickness}{0.3pt}
 \usepackage{amssymb, mathtools, nccmath} %
\usepackage{dsfont}
\makeatletter
\newcommand{\leqnomode}{\tagsleft@true}
\newcommand{\reqnomode}{\tagsleft@false}
\makeatother

\begin{document}

\leqnomode

\begin{fleqn}[2.5em]
\begin{align}
& \forall x, y(x,y\in\mathds{R}\Rightarrow x+y\in\mathds{R}) & P \\
& \forall x,y\left[ x,y\in\mathds{R}\Rightarrow x+y=y+x\right] & P \\
& \forall x,y,z\left[x,y,z\in\mathds{R}\Rightarrow(x+y)+z=x+(y+z)\right] & P
\end{align}
\end{fleqn}

\end{document} 

enter image description here

  • This isn't very different from specifying a space manually before each line, is it? – the_eraser Oct 26 '18 at 14:14
  • I don't know the the internals of the environment, but I think it amounts to changing the value of \displayindent once and for all the environment. – Bernard Oct 26 '18 at 14:18

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.