10

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?

  • 1
    Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Don't you mean a prime rather than an apostrophe? – jub0bs Sep 9 '13 at 13:03
  • Possibly, I'm not that familiar with the difference. – innisfree Sep 9 '13 at 13:12
  • +1 for the question, but also for your nickname: I'm a fan of John Ford. ;-) – egreg Sep 9 '13 at 13:47
  • @egreg, I had to do a bit of searching to get that reference. I wasn't familiar with "The Isle of Innisfree", only with "The Lake Isle of Innisfree". – TRiG Sep 9 '13 at 15:51
  • @TRiG “The quiet man” is one of John Ford's many masterpieces. – egreg Sep 9 '13 at 16:02
13

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.

13

a method that will allow both equation numbers to be referenced outside the align uses labels and \ref:

\begin{align}
 x^2+y^2=z^2, \label{firsteq}\\
 x^2=7, \tag{\ref*{firsteq}'} \label{primeq}
\end{align}

the job needs to be run three times to resolve the numbers.

the * on \ref* in the \tag{...} will prevent the equation number in the display from being treated as a link. however, the label for the number with the prime can still be referenced in text by \eqref, and that will be linked.

(not part of the answer, but a suggestion: prime is more usual than an apostrophe; the apostrophe in this context will automatically be set as a prime.)

  • That could be helpful also, but how can I stop \ref being hyperlinked at that label if I use hyperref, which is not desired? – innisfree Sep 9 '13 at 18:00
  • using \ref* for the reference in the \tag{...} will prevent the number on the equation itself from being made into a link. the label for the "derivative" number will still be able to be linked from a reference in text. i presume that's what you want. (i'm adding this to the answer.) – barbara beeton Sep 9 '13 at 18:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.