# new commands, spacing and italic fonts

I have used the \def command for several long scientific terms so that I can have an easy shorthand reference and do not have to keep typing them out every time e.g. \carb for $\delta$$^{13}C (full code \def\carb{\delta$$^{13}$C }). However if I do not include the final space after the C the output runs into the next word. This is problematic if I use the definition before full stops or ) because it adds an extra space, for example (δ13C ) or [δ13C .].

I tried the xspace package which did work for punctuation problems, but it doesn't add a space after words which I would like in italics. I added {} in my document and this did solve the problem, but I was wondering if there was an easier way? An example of a define command I have which has this problem is: \def\geog{\textit{geography\xspace}}

Thank you!


\newcommand\sh[1]{\csname myshorthand@#1\endcsname}
\makeatother

\begin{document}
\sh{carb}, \sh{carb} blblb

\sh{carb-12}, \sh{carb-n}

\end{document}


I wouldn't use \xspace but if you do use it the syntax is

\newcommand\geog{\textit{geography}\xspace}

• I believe that the exponent refers to the subsequent C. – egreg Sep 13 '17 at 14:07
• @egreg I deleted that bit then, but the markup's not great in any case:-) – David Carlisle Sep 13 '17 at 14:21