3

My purpose is the following: I have a series of equations labelling as 1.1, 1.2, 1.3, and etc. However, in the middle of these equations, I would love an extra equation which is labelled as 1.1', placing it between 1.1 and 1.2 for example. I know that I can do it by \tag{1.1'}, but is there a way to return or get the label of Equation 1.1, and add the symbol ' behind it?

PS, of course other solutions serving the same demand are welcomed.

PPS, if I use \tag{\ref{eq1}'}, there will be a hyperlink directed to equation 1. Is there a way to prevent that, i.e., is there a way to turn the reference to plain text?

Here is a sample code that illustrates the idea.

\documentclass{article}
\usepackage{amsmath}

\title{test}
\begin{document}

\maketitle
this is the equation labelled 1
\begin{equation}
    a=b \label{eq:eq1}
\end{equation}

here is the equation in between, and I need to label it as 1'.
\begin{equation*}
    b=c \tag{1'}
\end{equation*}

this is the equation labelled 2
\begin{equation}
    a=c
\end{equation}

\end{document}
9
  • Are you able to provide an example for people to play with? The details of your set up matter.
    – cfr
    Apr 24 at 4:42
  • @cfr Hi, I just added one.
    – Tab1e
    Apr 24 at 5:37
  • 2
    \tag{\theequation'}?
    – cfr
    Apr 24 at 5:53
  • 2
    \theequation displays the value of the current equation number. So \tag{\theequation'}, as proposed by cfr, should give you the expected result.
    – jlab
    Apr 24 at 7:20
  • 2
    You don't want to \ref it. Just \theequation. You're fitting it between, so the number will automatically refer to the correct one.
    – cfr
    Apr 24 at 7:25

4 Answers 4

3

You can use \ref. No need to make assumption on where the specially tagged equation ends up.

\documentclass{article}
\usepackage{amsmath}

\title{test}
\begin{document}

\maketitle
this is the equation labelled 1
\begin{equation}
    a=b \label{eq:eq1}
\end{equation}

here is the equation in between, and I need to label it as 1'.
\begin{equation*}
    b=c \tag{\ref{eq:eq1}$'$}
\end{equation*}

this is the equation labelled 2
\begin{equation}
    a=c
\end{equation}

\end{document}

In order to get a prime (not an apostrophe) you need $'$.

enter image description here

Note. If you also load \hyperref, \ref should become \ref* in order to avoid an unwanted link.

Can we write a special command for this? Yes.

\documentclass{article}
\usepackage{amsmath}
%\usepackage{hyperref}

\makeatletter
\AtBeginDocument{%
  \@ifpackageloaded{hyperref}{%
   % with hyperref use \ref*
   \NewDocumentCommand{\repeateq}{O{$'$}m}{\tag{\ref*{#2}#1}}%
  }{% without hyperref use \ref
   \NewDocumentCommand{\repeateq}{O{$'$}m}{\tag{\ref{#2}#1}}%
  }%
}
\makeatother

\title{test}
\begin{document}

\maketitle
this is the equation labelled 1
\begin{equation}
    a=b \label{eq:eq1}
\end{equation}

here is the equation in between, and I need to label it as 1'.
\begin{equation*}
    b=c \repeateq{eq:eq1}
\end{equation*}

this is the equation labelled 2
\begin{equation}
    a=c
\end{equation}

Another variant of the first equation
\begin{equation}
c=a \repeateq[*]{eq:eq1}
\end{equation}

\end{document}

enter image description here

If I uncomment the call to hyperref, the links are right.

2
  • +1 Addressing the PPS of OP: With hyperref you might want to use \ref* to avoid creating an hyperlink.
    – campa
    Apr 24 at 8:51
  • @campa Yes, I'll add the remark.
    – egreg
    Apr 24 at 9:13
3

If it's certain that equation n' will always follow immediately after equation n, i.e., without any intervening numbered equations, you could indeed use \tag{\theequation$'$}. Note that I'd render ' ("prime") in math mode, not text mode.

In addition, you may want to execute

\DeclareMathOperator{\numer}{num}
\DeclareMathOperator{\E}{E}

in the preamble, as E_t is the (time-t conditional) expectations operator; it's conventional to use upright (aka "roman") letters for math "operators" such as \sin, \exp, \det, and \log. Also, writing \numer (for "numeraire") is easier than \operatorname{num}, isn't it?

enter image description here

\documentclass{article}
\usepackage{amsmath} % for '\DeclareMathOperator' macro
\DeclareMathOperator{\numer}{num}
\DeclareMathOperator{\E}{E}
\usepackage{mleftright} \mleftright % better spacing around tall delimiters
\usepackage[colorlinks,allcolors=blue]{hyperref}

\begin{document}

The formula holds for every non-dividend-paying asset. Multiplying through by
$S(t)$, we obtain
\begin{equation} \label{eq:fund_pricing_formula}
    Y(t)=S(t) \E_t^S \left[\frac{Y(T)}{S(T)}\right]
\end{equation}
It is a present value relation: the value at time $t$ of the asset is the
expectation of its value $Y(T)$ at time $T$ ``discounted'' by the (possibly
random) factor $S(t) / S(T)$.

The formula can be written as
\begin{equation*}
    Y(t)=\numer(t) \E_t^{\numer}
    \left[\frac{Y(T)}{\numer(T)}\right]
    \tag{$\theequation'$}
\end{equation*}
where now $\numer(t)$ denotes the price of the (non-dividend-paying)
numeraire asset at time $t$.

Letting $R(t)$ denote the value $\mathrm{e}^{r t}$ of the risk-free asset and
using it as the numeraire, the equation becomes
\begin{equation}
    Y(t)=\mathrm{e}^{r t} \E_t^R
    \left[\frac{Y(T)}{\mathrm{e}^{r T}}\right]
    =\exp(-r(T-t)) \E_t^R[Y(T)]
\end{equation}
which means that $Y(t)$ is the expected value of $Y(T)$ discounted at the
risk-free rate for the remaining time $T-t$, when the expectation is computed
under the risk-neutral probability measure.

\end{document}
3
  • Tags, including equation numbers are treated as text. So you should do \theequation$'$. But what if you move the equation up or down?
    – egreg
    Apr 24 at 8:43
  • @egreg - I've updated the answer to use \theequation$'$.
    – Mico
    Apr 24 at 9:05
  • @egreg I thought in that case the value was supposed to move because it was meant to come 'in between'?
    – cfr
    Apr 24 at 13:45
1

The following example illustrates what we can do with OpTeX:

\def\prevmark[#1]{\ea\prevmarkA\expanded{\cs{_lab:#1}}}
\def\prevmarkA(#1){#1} 
% \prevmark[label] expands to previously used \eqmark[label] without ().

\noindent
this is the equation labelled 1
$$
   a=b \eqmark[first]
$$
here is the equation in between, and I need to label it as 1'.
$$
  b=c \eqno (\prevmark[first]')
$$
this is the equation labelled 2
$$
  a=c \eqmark[second]
$$
Another variant of the first equation
$$
  c=a \eqno (\prevmark[first]\hbox{*})
$$

\bye
0

As @jlab and @cfr commented, use \tag{\theequation'} because \theequation displays the value of the current equation number.

Not the answer you're looking for? Browse other questions tagged .