[Tex/LaTex] Using \tag in align environment in \[…\]

alignmath-mode

Is there any way to use \tag in side the \align environment inside \[...\]?

With MathJax, it seems that if you have something like this:

\[
\begin{aligned}
x &= 1 \tag{tag}\\
\end{aligned}
\]

it is rendered properly. However, putting the same thing in a TeX document and trying to compile it throws errors:

\documentclass[]{article}
\usepackage{amssymb,amsmath}

\begin{document}

\[
\begin{align}
x &= 1 \tag{tag}\\
\end{align}
\]

\end{document}

The two errors I get are "erroneous nesting of equation structures" and "\tag not allowed here."

So essentially my question is: is it possible in any way to use the \tag in a \align environment inside \[...\]?

Best Answer

This works.

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{amsmath}



\begin{document}

Text text text.
% \[\begin{aligned}
% x &= 1 \tag{tag}\\
% \end{aligned}\]
Text text text.
\begin{align*}
    x&=1\tag{tag}\\
    y&=2\tag{tug}
\end{align*}
Text text text.

\end{document}

Note that you must not surround an align environment with \[...\]