3

Consider the following MWE: three boxes, all the same width, in a gather* environment. I expect that all boxes will be centered around the same vertical line. However, the length of the tags messes this up, and alignment looks pretty bad.

\documentclass[preview,margin=10pt]{standalone}
\usepackage{amsmath}
\begin{document}
  \begin{gather*}
    \framebox[.7\linewidth]{} \\
    \framebox[.7\linewidth]{} \tag{short} \\
    \framebox[.7\linewidth]{} \tag{pretty long}
  \end{gather*}
\end{document}

MWE output

Is this expected behaviour, or am I doing something wrong?

Edit: Make MWE compile, add output.

3
  • 2
    this might be helpful: Amsmath: Using \tag{name} when you have a long name Dec 13, 2015 at 21:47
  • If you surround the \framebox with \makebox[0pt]{...}, it will force each box to be centered, but then it collides with the (pretty long) tag. I don't know if this is the answer to your question (I have absolutely no idea if this is intended behavior), though. Dec 14, 2015 at 0:15
  • Thanks @barbara, @Arun for the suggestions. Indeed the zero-width label trick only works if the equations do not need to shift to fit the label. I managed to work around it by creating an align variant with centering columns, but I still would expect gather to behave differently. Dec 14, 2015 at 16:42

1 Answer 1

3

Here is a solution with the \newtagform command from mathtools. Of course it's up to you to ensure equations and tags do not overlap.

\documentclass{article}%[preview,margin=10pt]{standalone}
\usepackage{mathtools}
\newtagform{nowidth}{\llap\bgroup(}{)\egroup}

\begin{document}

\usetagform{nowidth}
  \begin{gather*}
    \framebox[.6\linewidth]{} \\
    \framebox[.6\linewidth]{} \tag{short} \\
    \framebox[.6\linewidth]{} \tag{pretty long}
  \end{gather*}

\end{document} 

enter image description here

You must log in to answer this question.

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