我不确定我是否重复了一个已经存在的问题,但我想知道如何处理以下情况:
我想定义一个宏作为某个单词或文本片段的别名。当我定义它时,命令后面的空格将被忽略,因此该单词与下一个单词之间的空格将被删除,如下面的 MWE 所示。
下面的代码
\documentclass{report}
\newcommand{\alias}{Paulo}
\newcommand{\altalias}{Paulo }
\newcommand{\formatalias}{%
{\fontfamily{ptm}\selectfont\textsc{Paulo}}%
}
\newcommand{\altformatalias}{%
{\fontfamily{ptm}\selectfont\textsc{Paulo}} %
}
\begin{document}
This is \alias, who is just checking \LaTeX's behaviour.\par
This is \alias who is just checking \LaTeX's behaviour.\par
This is \altalias who is just checking \LaTeX's behaviour.\par
This is \formatalias who is just checking \LaTeX's behaviour.\par
This is \altformatalias who is just checking \LaTeX's behaviour.
\end{document}
输出如下:
所以我的问题是,仅在宏末尾添加一个空格是否正确,还是我应该做其他事情?