自訂編譯訊息

自訂編譯訊息

有沒有辦法建立自訂編譯訊息?例如

\msg{Compiling Chapter 1}
\input{chapter1.tex}
\msg{Finished chapter compilation}

答案1

因為在評論中您表示您不想使用日誌,所以在序言中開啟一個新文件並寫入該文件

\documentclass{article}

\makeatletter
\newwrite\mylog
\immediate\openout\mylog=\jobname.mylog

\newcommand\writelog[1]{%
  \protected@write
   \mylog
   {\let\tmp\write\def\write{\immediate\tmp}}%
   {#1}}
\makeatother


\begin{document}


\writelog{one}

\writelog{two}



\end{document}

將把一和二寫入.mylog文件/

相關內容