10

I would like to prove all my theorems in the appendix. To do that, I would like to remind the readers what the theorem is, by reprinting it in the appendix.

However, I have not figured out a way to do this without directly copy and pasting. The the problem with copy and pasting is that the theorem number is completely off. Take for example:

enter image description here

Does anyone know how to deal with this problem elegantly?

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{amsthm}     
\setlength\parindent{0pt}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{thm}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{cor}{Corollary}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{claim}{Claim}[section]

\theoremstyle{remark}
\newtheorem{remark}{Remark}[section]
\newtheorem{example}{Example}[section]

\newcommand{\thmautorefname}{Theorem}
\newcommand{\propautorefname}{Proposition}
\newcommand{\lemautorefname}{Lemma}
\newcommand{\corautorefname}{Corollary}
\newcommand{\conjautorefname}{Conjecture}
\newcommand{\claimautorefname}{Claim}


\begin{document}


\section{Introduction}

\begin{thm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{thm}
This is a remarkable theorem indeed!

\section{Appendix}
In the Appendix, we will prove theorem

We will reprint the theorem here:

\begin{thm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{thm}

\begin{proof}
2 - 1 = 1. 
\end{proof}


\bibliographystyle{plain}
\bibliography{references}
\end{document}
Ethan Bolker
  • 9,333
  • 3
  • 42
  • 69
Fraïssé
  • 3,139

2 Answers2

10

The thmtools defines restatable theorems. Here is how it goes. B.t.w., the thm theorem style does not exist, as this is defined by thmtools. I suppose you meant the plain style. Also, I had to comment the autorefnames, as they're already defined by thmtools.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{amsthm,thmtools}%
\setlength\parindent{0pt}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{plain}
\declaretheorem[name=Theorem, numberwithin=section]{thm}
\declaretheorem[name=Lemma, numberwithin=section]{lem}
\declaretheorem[name=Proposition, numberwithin=section]{prop}
\declaretheorem[name=Corollary, numberwithin=section]{cor}
\declaretheorem[name=Conjecture, numberwithin=section]{conj}
\declaretheorem[name=Claim, numberwithin=section]{claim}

\theoremstyle{remark}
\newtheorem{remark}{Remark}[section]
\newtheorem{example}{Example}[section]

%\newcommand{\thmautorefname}{Theorem}
%\newcommand{\propautorefname}{Proposition}
%\newcommand{\lemautorefname}{Lemma}
%\newcommand{\corautorefname}{Corollary}
%\newcommand{\conjautorefname}{Conjecture}
%\newcommand{\claimautorefname}{Claim}

\begin{document}

\section{Introduction}

\begin{restatable}{thm}{universe}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{restatable}
This is a remarkable theorem indeed!

\section{Appendix}
In the Appendix, we will prove theorem

We will reprint the theorem here:

\universe*

\begin{proof}
$ 2 - 1 = 1 $.
\end{proof}

\bibliographystyle{plain}
\bibliography{references}

\end{document} 

enter image description here

Bernard
  • 271,350
9

You can \label the theorem that has to be dublicated and then reuse its counter when you rewrite it via \ref:

\newenvironment{usethmcounterof}[1]{%
  \renewcommand\thethm{\ref{#1}}\thm}{\endthm\addtocounter{thm}{-1}}

A basic example would be so to speak:

...
\begin{thm}\label{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{thm}
...
\begin{usethmcounterof}{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{usethmcounterof}
...

showcase

Complete Code

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{amsthm}     
\setlength\parindent{0pt}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{thm}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{cor}{Corollary}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{claim}{Claim}[section]

\theoremstyle{remark}
\newtheorem{remark}{Remark}[section]
\newtheorem{example}{Example}[section]

\newcommand{\thmautorefname}{Theorem}
\newcommand{\propautorefname}{Proposition}
\newcommand{\lemautorefname}{Lemma}
\newcommand{\corautorefname}{Corollary}
\newcommand{\conjautorefname}{Conjecture}
\newcommand{\claimautorefname}{Claim}

\newenvironment{usethmcounterof}[1]{%
  \renewcommand\thethm{\ref{#1}}\thm}{\endthm\addtocounter{thm}{-1}}

\begin{document}


\section{Introduction}

\begin{thm}\label{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{thm}
Theorem \ref{mythm} is a remarkable theorem indeed!

\section{Appendix}
In the Appendix, we will prove theorem

We will reprint the theorem here:

\begin{usethmcounterof}{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{usethmcounterof}

\begin{proof}
2 - 1 = 1. 
\end{proof}
\end{document}

Addendum

As you are dealing with multiple theorem environments you could define a patcher as follows to not have to copy and paste the code for every of your environments.

\newcommand\MakeReplicatable[1]{%
  \newenvironment{use#1counterof}[1]{%
    \expandafter\renewcommand\csname the#1\endcsname{\ref{##1}}\csname #1\endcsname}{%
      \csname end#1\endcsname\addtocounter{#1}{-1}}}

Then you could declare

\MakeReplicatable{thm}
\MakeReplicatable{lem}
...

If you want to allow this feature by default you could even flick it into the environment definition process:

\let\ams@newtheorem\newtheorem
\renewcommand\newtheorem[1]{%
  \MakeReplicatable{#1}\ams@newtheorem{#1}}

The order in the preamble would then need to be

...
\usepackage{amsthm}

\makeatletter
\newcommand\MakeReplicatable[1]{%
  \newenvironment{use#1counterof}[1]{%
    \expandafter\renewcommand\csname the#1\endcsname{\ref{##1}}\csname #1\endcsname}{%
      \csname end#1\endcsname\addtocounter{#1}{-1}}}
\let\ams@newtheorem\newtheorem
\renewcommand\newtheorem[1]{%
  \MakeReplicatable{#1}\ams@newtheorem{#1}}
\makeatother

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{thm}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}{Lemma}[section]
...

However, even more elegant (in my opinion) is to define the replication environment in such way that you call it like \begin{usecounterof}{<thm-env>}{<label>}...\end{usecounterof}:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
  \theoremstyle{definition}
    \newtheorem{definition}{Definition}[section]
  \theoremstyle{thm}
    \newtheorem{thm}{Theorem}[section]
    \newtheorem{lem}{Lemma}[section]
    \newtheorem{prop}{Proposition}[section]
    \newtheorem{cor}{Corollary}[section]
    \newtheorem{conj}{Conjecture}[section]
    \newtheorem{claim}{Claim}[section]
  \theoremstyle{remark}
    \newtheorem{remark}{Remark}[section]
    \newtheorem{example}{Example}[section]
  \newcommand{\thmautorefname}{Theorem}
  \newcommand{\propautorefname}{Proposition}
  \newcommand{\lemautorefname}{Lemma}
  \newcommand{\corautorefname}{Corollary}
  \newcommand{\conjautorefname}{Conjecture}
  \newcommand{\claimautorefname}{Claim}

\makeatletter
\newenvironment{usecounterof}[2]{%
  \def\@tempb{#1}%
  \expandafter\renewcommand\csname the#1\endcsname{\ref{#2}}\@nameuse\@tempb}{%
    \@nameuse{end\@tempb}\addtocounter\@tempb{-1}}
\makeatother

\setlength\parindent{0pt}

\begin{document}
\section{Introduction}

\begin{thm}\label{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{thm}
Theorem \ref{mythm} is a remarkable theorem indeed!

\section{Appendix}
In the Appendix, we will prove theorem

We will reprint the theorem here:

\begin{usecounterof}{thm}{mythm}
We'd like to introduce the \bfseries{theorem of the universe}, the theorem says that $1+1 = 2$
\end{usecounterof}

\begin{proof}
2 - 1 = 1. 
\end{proof}
\end{document}
Ruben
  • 13,448
  • The problem I see with this answer is that the OP must paste the text of the theorem into the appendix. That's error prone when the text is edited where it first appears. – Ethan Bolker Jan 16 '17 at 14:38
  • @EthanBolker -- I agree. I would definitively use thmtools as @touhami suggested in the comments to the OP. But, also the OP premised the markup given in my answer (i.e. repeating the theorems text). I guess the answer is a legitimate supplement then. – Ruben Jan 16 '17 at 14:46