I am writing a paper where I have a stated a theorem, and then a short time later I state another theorem which is equivalent to the first. Is it possible to number them so that the second is a primed version of the first? In other words, if the first gets numbered as Theorem 7, I would like its equivalent version to be numbered as Theorem 7'. Ideas? Thanks.
2 Answers
\documentclass[a4paper]{article}
\newtheorem{thm}{Theorem}
\newenvironment{thmbis}[1]
{\renewcommand{\thethm}{\ref{#1}$'$}%
\addtocounter{thm}{-1}%
\begin{thm}}
{\end{thm}}
\begin{document}
\begin{thm}
$1+1=2$
\end{thm}
\begin{thm}\label{comm}
$a+b=b+a$
\end{thm}
\begin{thmbis}{comm}
$x+y=y+x$
\end{thmbis}
\begin{thm}
$0\ne0$
\end{thm}
\end{document}
In this way the "primed" theorem doesn't need to be near the main one. The thmbis
environment takes as argument the label given to the main one.
If the "primed" theorem is always immediately after the main one, you can say
\newenvironment{thmbis}
{\addtocounter{thm}{-1}%
\renewcommand{\thethm}{\arabic{thm}$'$}%
\begin{thm}}
{\end{thm}}
If hyperref is used, one has to hack its automatic mechanism for creating hyperlinks; the following seems to work:
\makeatletter
\newcommand{\neutralize}[1]{\expandafter\let\csname c@#1\endcsname\count@}
\makeatother
\newtheorem{thm}{Theorem}
\newenvironment{thmbis}[1]
{\renewcommand{\thethm}{\ref{#1}$'$}%
\neutralize{thm}\phantomsection
\begin{thm}}
{\end{thm}}
Use \ref*{#1}
if you don't want to make a link pointing to the "main theorem".
-
-
3it's a bad idea to use
\addtocounter{thm}{-1}
as it doesn't work well withhyperref
. Here, in your second example, if you use the \label/ref mechanism to refer to the primed theorem, the hyperlink will go to the wrong place (the unprimed theorem). Jun 24, 2011 at 12:13 -
-
Is there any chance to have this or one of the like solutions have hyperref jump to the primed theorem (and not the original one)?– BubayaMar 27, 2020 at 11:49
-
An idea but ... finally I undelete
\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{amssymb,amsmath,latexsym}
\newtheorem{theo}{Theorem}
\newcounter{biscompt}
\newtheorem{bis}[biscompt]{Theorem}
\renewcommand{\thebiscompt}{%
\setcounter{biscompt}{\thetheo}
\arabic{theo}'}
\usepackage{hyperref}
\begin{document}
\chapter{}
\section{}
\begin{theo}
On vérifie que : $1\not= 1$
\end{theo}
\newpage
\section{}
\begin{theo}
On vérifie que : $2\not= 3$
\end{theo}
\newpage
\section{}
\begin{theo}
On vérifie que : $1\not= 1$
\end{theo}
\begin{bis}\label{bis}
On vérifie que : $1\not= 1$
\end{bis}
\newpage
\section{}
With \ref{bis}
\end{document}