Amsmath: Using \tag{name} when you have a long name

One option is to hide the tag width using, for example, a \makebox; inside the Dequation environment, the tag width will not be taken into account:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newenvironment{Dequation}
  {%
  \def\tagform@##1{%
    \maketag@@@{\makebox[0pt][r]{(\ignorespaces##1\unskip\@@italiccorr)}}}%
  \ignorespaces
  }
  {%
  \def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr)}}%
  \ignorespacesafterend
  }
\makeatother    

\begin{document}

A regular \texttt{align*} with long tags:
\begin{align*}
  1 &= 1\\
  2 &= 2\tag{This is a long tag}\\
  3 &= 3\tag{This is an even longer tag}
\end{align*}
A regular \texttt{align*} without tags, for comparison:
\begin{align*}
  1 &= 1\\
  2 &= 2\\
  3 &= 3
\end{align*}
An \texttt{align*} with long tags inside \texttt{Dequation}:
\begin{Dequation}
\begin{align*}
  1 &= 1\\
  2 &= 2\tag{This is a long tag}\\
  3 &= 3\tag{This is an even longer tag}
\end{align*}
\end{Dequation}
The initial regular \texttt{align*} with long tags, for comparison:
\begin{align*}
  1 &= 1\\
  2 &= 2\tag{This is a long tag}\\
  3 &= 3\tag{This is an even longer tag}
\end{align*}

\end{document}

enter image description here


You could add the longest tag on the opposite side as a \phantom in order to "restore" the horizontal shift:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  1 &= 1 \\
  2 &= 2 \\
  3 &= 3
\end{align*}
\begin{align*}
  1 &= 1 \\
  2 &= 2 \tag{This is a long tag} \\
  3 &= 3
\end{align*}
\begin{align*}
  1 &= 1 \\
  \phantom{\text{(This is a long tag)}}2 &= 2 \tag{This is a long tag} \\
  3 &= 3
\end{align*}
\end{document}