
방금 만들었어요답변로 임시 변수를 사용하고 , \write\@auxout
로 범위를 지정하는 것이 좋을 것이라고 생각했습니다 \begingroup
. \endgroup
어떤 이유로 인해 다음과 같은 결과가 발생합니다.
! 정의되지 않은 제어 순서.
<쓰기> \temp변수
MWE
\documentclass{article}
\makeatletter
\newcommand{\abc}{%
\begingroup%
\newcommand\tempvariable{\relax}%
\write\@auxout{\tempvariable}%
\endgroup%
}
\makeatother
\begin{document}
Why isn't this working???
\abc
\end{document}
왜 이런 일이 발생하며 어떻게 해결할 수 있나요?
답변1
추가하면 \immediate
도움이 될 것입니다:
\documentclass{article}
\makeatletter
\newcommand{\abc}{%
\begingroup%
\newcommand\tempvariable{\relax}%
% \write\@auxout{\tempvariable}%
\immediate \write\@auxout{\tempvariable}%
\endgroup%
}
\makeatother
\begin{document}
Why isn't this working???
\abc
\end{document}
링크의 답변에서 command 를 알고 계시 \immediate
므로 추가 설명이 필요하지 않을 것입니다.