TeX/endinput
外觀
< TeX
\endinput
- 該命令在檔案中間終止輸入過程。在檔案末尾它是多餘的。
- 遇到該命令後,TeX 會繼續讀取直到行尾。這使得將
\endinput包含在\if單行中成為可能。
\def\false{false}
\def\students{false}
% Questions, for teachers and students ...
\ifx\students\true\endinput\fi
% Answers, for teacher only
如果 \if 語句不能是一行程式碼(例如,出於可讀性原因),那麼可以使用 \expandafter
\ifx\students\true
% ... various other statements ...
\expandafter\endinput
\fi