2

I've got two equations, the latter is an equivalent form of the former. So instead calling, say, (1) and (2), I want to call (2) as $(1)'$ or $(1)^{*}$ etc. (like some form of (1)) and being able to label it, so I can call it again when needed. How can I achieve this ? Thank you for any suggestions.

2 Answers 2

4

The prime should be inside the parentheses, in my opinion.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Here is an equation
\begin{equation}\label{eq:nice}
0=0
\end{equation}
and a related one
\begin{equation}\label{eq:niceprimed}
1=1 \tag{\ref{eq:nice}$'$}
\end{equation}
Equations \eqref{eq:nice} and \eqref{eq:niceprimed}
are easily seen to be equivalent to one another.

\end{document}

enter image description here

If you have several of these related equations, you can define

\newcommand{\mytag}[2]{\tag{\ref{#1}$#2$}}

and call \mytag{eq:nice}{'} for a single prime, \mytag{eq:nice}{''} for a double prime.

2

A way using my old answer here: https://tex.stackexchange.com/a/377481/120578

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage{pgffor}
\usepackage{pgf}
\usepackage{lipsum}


\makeatletter
\newcommand*\ifcounter[1]{%
  \ifcsname c@#1\endcsname%
    \expandafter\@firstoftwo%
  \else%
    \expandafter\@secondoftwo%
  \fi%
}%
\makeatother

\newcounter{testc}
\def\extendmystring#1{\xdef\mystring{\mystring#1}}
\makeatletter
\newcommand\EqFamTag[1]{%
  \ifcounter{#1}{%
  \expandafter\addtocounter{#1}{1}%
  \xdef\ccc{\arabic{#1}}%
  \xdef\mystring{}%
\foreach \i in {1,...,\ccc}{\extendmystring{'}}%
\xdef\temp{\csname #1 Eq\endcsname\mystring}%
\xdef\ttemp{(\temp)}
\global\expandafter\let\csname #1\arabic{#1}\endcsname\ttemp%
\tag{\temp}%
}{%
\global\expandafter\newcounter{#1}%
\xdef\temp{\theequation}%
\xdef\eqonfamily{\theequation}%
\global\expandafter\let\csname #1 Eq\endcsname\eqonfamily%
\xdef\ttemp{(\temp)}%
\global\expandafter\let\csname #1\endcsname\ttemp%
\tag{\temp}%
%\expandafter\addtocounter{equation}{0}
}%
}%
\makeatother

\begin{document}
\section{Test}
\lipsum[1]
\begin{equation}
  f(x-3)=1\EqFamTag{Const}
\end{equation}
\lipsum[1]

For \(y=x-3\):
\begin{equation}
  f(y)=1 \EqFamTag{Const}\label{Second}
\end{equation}

For \(z=x-2\):
\begin{equation}
  f(z-1)=1 \EqFamTag{Const}
\end{equation}

The \csname Const\endcsname{} equation is same with \csname Const1\endcsname{} and \csname Const2\endcsname{} equations.

Also I can refer with \verb|\ref| or \verb|\eqref| to \eqref{Second}.

\end{document}

The code here produces:

enter image description here

The code of the linked answer can also work and produce:

enter image description here

You must log in to answer this question.

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