[Tex/LaTex] how can I use “\newproof{pot}{Proof of Theorem \ref{thm2}}” in elsarticle

elsarticle

For refering a proof to a theory I know there are other ways to use but I want to know how to use by this " \newproof{pot}{Proof of Theorem \ref{thm2}}". If I put this in preamble and make proof environment by \begin{pot} … \end{pot}, it will refer all proof to thm2.

Best Answer

You can define a generic environment using \newproof that has a text depending on a macro that can be redefined.

\documentclass{elsarticle}

\newtheorem{theorem}{Theorem}

\newcommand{\proofofref}{}
\newproof{zproofof}{Proof of \proofofref}
\newenvironment{proofof}[1]
 {\renewcommand{\proofofref}{#1}\zproofof}
 {\endzproofof}

\begin{document}

\begin{theorem}\label{1+1}
$1+1=2$
\end{theorem}

\begin{theorem}\label{twins}
There exist infinitely many twin primes.
\end{theorem}

\begin{proofof}{Theorem \ref{twins}}
It's really easy, isn't it?
\end{proofof}

\begin{proofof}{Theorem \ref{1+1}}
Too difficult.
\end{proofof}

\end{document}

enter image description here