I want to write a custom command to produce a species name but I am having trouble getting it to work with punctuations.
The specifications for my desired output are:
- Text in italic font
- No linebreaks
- if used in text keep space after the name, if punctuation follows no space
I used
\newcommand{\rip}{\mbox{\textit{C. riparius }}}
but this produces spaces before punctuations.
I read about the \xspace package but I cant seem to get it to work correctly.
Whats the correct way to achieve this?

\newcommand{\rip}{\emph{C.~riparius}\xspace}? – frougon Jun 30 '18 at 11:20\xspaceand still had spaces before punctuation. :) – voiDnyx Jun 30 '18 at 11:35