我有这个身体:
\begin{center}
\includegraphics[scale=0.8]{image.png}
\captionof{figure}{Image Caption}
\end{center}
但我想将其简化为:
\mygraphics[scale=0.8]{image.png}{Image Caption}
和:
\newcommand{\mygraphics}[2][???]{%
\begin{center}%
\includegraphics[???]{#1}%
\captionon{figure}{#2}%
\end{center}%
}
答案1
解决方案:
\newcommand{\mygraphics}[3][]{%
\begin{center}%
\includegraphics[{#1}]{#2}%
\captionon{figure}{#3}%
\end{center}%
}
第一次将我的脚本改为这样之后,我得到了:
! You can't use `macro parameter character #' in horizontal mode.
然而我rm *.{aux,lof,lot,log,toc,out}
随后一切都顺利。