
저는 다음과 같은 간단한 매크로를 만들었습니다.
\documentclass{ltxdoc}
\newcommand\Q{\textbf{Q}}
\begin{document}
I like to type my \Q's in bold quickly, but sometimes I also end my line with \Q.
This doesn't have it's intended effect.
\end{document}
매크로에 앞에 공백(또는 문자)을 확인하고 \textbf{Q}
정상적으로 입력한 것처럼 따르도록 지시할 수 있나요? 앞에 점(.)이 있든 공백( )이 있든 상관없이 정상적으로 동작했으면 좋겠습니다.
답변1
최근에는 생각조차 금기시되고 있지만 xspace
패키지는 다음과 같이 합니다.
암호:
\documentclass{ltxdoc}
\usepackage{xspace}
\newcommand\Q{\textbf{Q}\xspace}
\begin{document}
I like to type my \Q's in bold quickly, but sometimes I also end my line with \Q.
This doesn't have it's intended effect.
In a sentence \Q works now.
\end{document}