[Tex/LaTex] LaTeX locally change equation numbering

equationsnumbering

I want my document to look like this:

Normal document text.

equation (1)

Definition Definition text.

equation (D1)

More definition text.

Normal document text.

equation (2)

More document text.

So the numbering changes inside the definition, and remains unaltered outside the definition.

Best Answer

If you only want a temporary change, use the \tag command, loaded by the amsmath package. Here's the code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

Equation the first, normally numbered.
\begin{equation}
a=b+c
\end{equation}

A special equation.
\begin{equation}\tag{D1}
d=e+f
\end{equation}

A second, normally numbered equation.
\begin{equation}
g=h+i
\end{equation}

\end{document}

If you use \label to reference the equations later, \tag doesn't have to have the same argument as \label. This is the result:

enter image description here