que*_*een 6 latex spacing xspace
假设我的宏是\newcommand{\k}{king\xspace}. 然后是“...表示\k”中的间距。会没事的。但是如果我不想在 \k\k 中间没有间距怎么办?我要“国王”。不是“国王国王”。
有没有办法做到这一点?
\unskip删除之前插入的任何跳过(包括空格),因此\K\unskip\K在您想要删除它的奇怪场合使用它也足够了:

\documentclass{article}
\usepackage{xspace}% http://ctan.org/pkg/xspace
\newcommand{\K}{king\xspace}
\begin{document}
Here is the \K. Here is the \K\K. Here is the \K\unskip\K.
\end{document}
Run Code Online (Sandbox Code Playgroud)
要点\xspace是在单词之间添加空格,而不是在标点符号之前添加空格。因此,如果您不希望宏的两次使用之间有空格,请不要使用\xspace. 但是,当然这需要你{}在最后使用 a :
\documentclass{article}
\newcommand{\K}{king}%
\begin{document}
At end of sentence \K.\par
In between \K\K{} you want one long word.
\end{document}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4148 次 |
| 最近记录: |