![Macro para colocar coisas no apêndice](https://rvso.com/image/400388/Macro%20para%20colocar%20coisas%20no%20ap%C3%AAndice.png)
Estou tentando escrever uma macro para colocar provas do teorema dentro e fora do apêndice, definindo uma variável.
Eu sei fazer o seguinte: No exemplo a seguir, quando defino a variável apêndice como 1, as provas vão para uma nova seção (seção 2). Além disso, se for definido como 0, a prova estará embutida.
\documentclass{article}[11pt]
\usepackage{amsthm, amsmath}
\usepackage{cleveref}
\usepackage[appendix=append]{apxproof}
\usepackage{thmtools, mathtools, thm-restate}\newtheorem*{theorem*}{Theorem}
\newtheorem{fact}{Fact}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}[lemma]{Theorem}
\renewenvironment{proof}{\smallskip\noindent{\bf Proof:}}%
{\hspace*{\fill}\par}
% =========================================================
% Appendix stuff
% =========================================================
\newcommand{\myproof}[4]{
% 1: name of the environment
% 2: command
% 3: label of the theorem
% 4: proof
\begin{proof}
#4
\end{proof}
}
\def\appendixenabled{1}
% Switch to 0 to make the proofs inline
\if\appendixenabled1
\renewcommand{\myproof}[4]{
The proof is provided in Appendix~\ref{sec:proofof#3}
\section{Proof of #1~\ref{#3}}
\label{sec:proofof#3}
\begin{proof}
#4
\end{proof}
}
\fi
% =========================================================
\begin{document}
\section{One}
\begin{restatable}{theorem}{aaa}
\label{thmLabel}
This is a resettable theorem!
\end{restatable}
\myproof{Theorem}{aaa}{thmLabel}{This is the proof.}
\end{document}
Em vez disso, preciso mover a prova para o final do documento em uma seção de apêndice. No entanto, se eu adicionar o ambiente do apêndice (no pacote apxproof) da seguinte maneira, receberei um erro de compilação. Qualquer ideia?
\if\appendixenabled1
\renewcommand{\myproof}[4]{
\begin{toappendix}
The proof is provided in Appendix~\ref{sec:proofof#3}
\section{Proof of #1~\ref{#3}}
\label{sec:proofof#3}
\begin{proof}
#4
\end{proof}
\end{toappendix}
}
\fi
O erro:
! FancyVerb Error:
Extraneous input `The proof is provided in Appendix~\ref {sec:proofofthmLabel} \section {Proof of Theorem~\ref {thmLabel}} \label {sec:proofofthmLabel} \begin {proof} This is the proof. \end {proof} \end {toappendix} \end{document}' between \begin{toappendix}[<key=value>] and line end
.
\FV@Error ...ncyVerb Error:^^J\space \space #1^^J}
l.52 ...hmLabel}{This is the proof.}\end{document}
This input will be discarded. Hit <return> to continue.
)
Runaway argument?
! File ended while scanning use of \FancyVerbGetLine.
<inserted text>
\par
<*>
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
! Emergency stop.
<*>