![부록에 내용을 넣는 매크로](https://rvso.com/image/400388/%EB%B6%80%EB%A1%9D%EC%97%90%20%EB%82%B4%EC%9A%A9%EC%9D%84%20%EB%84%A3%EB%8A%94%20%EB%A7%A4%ED%81%AC%EB%A1%9C.png)
변수를 설정하여 정리 증명을 부록에 넣고 빼는 매크로를 작성하려고 합니다.
나는 다음을 수행하는 방법을 알고 있습니다. 다음 예에서 변수appendixenabled를 1로 설정하면 교정이 새 섹션(섹션 2)으로 이동합니다. 또한 0으로 설정되면 증명이 인라인입니다.
\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}
대신, 부록 섹션의 문서 끝 부분으로 증거를 옮겨야 합니다. 그러나 다음과 같이 부록 환경(apxproof 패키지)에 추가하면 컴파일 오류가 발생합니다. 어떤 아이디어?
\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
오류:
! 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.
<*>