
.tex 파일에는 자체 정의된 명령이 있습니다.
\newcommand{\mycomment}[1]{\textcolor{red}{#1}}
...
\mycomment{blah blah}
...
최종 버전에서 컴파일하는 동안 명령을 건너뛸 수 있기를 바랍니다. 하지만 최종 버전 이전 버전에서는 계속 컴파일할 수 있습니다. 그렇게 할 수 있는 방법이 있나요?
답변1
\newif\iffinal
\newcommand{\mycomment}[1]{\iffinal\else\textcolor{red}{#1}\fi}
...
\mycomment{blah blah}
그리고 부울 값 \finaltrue
과 \finalfalse
. \finalfalse
프리앰블 어딘가에 설정된 개발 버전의 경우~ 후에 \newif\iffinal
, 최종 컴파일 세트의 경우 \finaltrue
또는 두 가지를 모두 설정하고 비활성 부울을 주석 처리합니다.
\finalfalse
% \finaltrue
답변2
상당히 직관적인 또 다른 방법, 특히 일부 편집에는 포함하고 싶지만 다른 편집에는 포함하지 않으려는 여러 개의 큰 코드 블록이 있는 경우 주석 패키지를 사용하는 것이 좋습니다. 한 번에 조금씩). 그러나 작은 토글에도 좋습니다.
\usepackage{comment}
%switches
\excludecomment{versiona}
\excludecomment{versionb}
\includecomment{versionx}
..
\begin{versiona}
\newcommand{\mycomment}[1]{\textcolor{red}{#1}
etc
\end{versiona}
\begin{versionb}
\newcommand{\mycomment}[1]{\textcolor{red}{#1}
etc
\end{versionb}