[Tex/LaTex] Equation number with an apostrophe

alignamsmathequationsnumbering

I am writing two equations in an align environment:

\begin{align}
x^2+y^2=z^2, \\
x^2=7,
\end{align}

I would like the first equation to be labelled with e.g. (1.1) and the second equation to be labelled (1.1'), rather than (1.2).

Is this possible to automate? Do I need to use a hack to manually place the equation number after my second equation? e.g.

\newcommand{\hack}{\hfill({\eqnum}')} % Sketch - I don't know what command to use.
\begin{align}
x^2+y^2=z^2, \\\nonumber
x^2=7,\hack
\end{align}

If so, what command can I use to get the equation number? i.e. what should my command \hack be?

Best Answer

I would recommend using the \tag macro to directly insert the equation number.

\documentclass{article}
\usepackage{amsmath,amssymb}
\numberwithin{equation}{section}
\begin{document}

\section{Section A}

\begin{align}
 z^2&= x^2 + y^2     \\
 z^2 &=  x^2 + y^2  \tag{\theequation'}
\end{align}

\end{document}

enter image description here

As per @barbarabeeton 's answer, the ' should be \prime as:

\documentclass{article}
\usepackage{amsmath,amssymb}
\numberwithin{equation}{section}
\begin{document}

\section{Section A}

\begin{align}
 z^2&= x^2 + y^2     \\
 z^2 &=  x^2 + y^2  \tag{\theequation${}^\prime$}
\end{align}

\begin{equation}
 z^2= x^2 + y^2     
\end{equation}
\end{document}

enter image description here

Incidentally, the \theequation is the way to access directly the formatted equation counter. This works with any counter you're using, \the<counter_name> will call the formatted counter. This is the reason \theequation resulted in 1.1 and not just 1, which is the value of the counter equation.

Related Question