# newcommand: boldface is extended to next character

I am using a newcommand like this

\newcommand{\gen}{\textbf{P1}\xspace}


and it works just fine. However in the text the boldface is always extended to the next character. For example

lorem ipsum \gen, foo bar


will result in

lorem impsum P1, foo bar

and not

lorem impsum P1, foo bar

as intended.

Any help with this highly appreciated.

Cheers

Philipp

• Erh, not understood at all, that macro does not bleed boldface. Please provide a full minimal example so we can compile the example as you are seeing it. – daleif Nov 28 '14 at 11:36
• Plus those two result lines are the same. – daleif Nov 28 '14 at 11:37
• Please post a complete small document that shows this effect. – David Carlisle Nov 28 '14 at 11:40
• @daleif The comma is bold on the first one. – percusse Nov 28 '14 at 11:40
• @percusse I see no boldface comma. If I try \gen, with \showoutput, I see \OT1/cmr/m/n/10 , which looks like medium series. – egreg Nov 28 '14 at 11:48

As can be seen in the above image, \gen does not make the following character bold.

The modified version \genb does make it bold, and pulls it before any added space (as can be seen with the c).

\documentclass{article}
\usepackage{xspace}
\newcommand{\gen}{\textbf{P1}\xspace}
\newcommand{\genb}[1]{\textbf{P1#1}\xspace}

\begin{document}

aaa \gen, bbb \gen ccc

aaa \genb, bbb \genb ccc

\end{document}

• Hi! For some reason it appears to be solved now, but I am using a different computer. Need to re-check on my machine at home. Thanks! – user2334921 Nov 28 '14 at 12:40
• @user2334921 please (for next time) always make a complete test document to include in the question, as in this answer. If you can't make a test document that reproduces the problem, you don't have a problem:-) – David Carlisle Nov 28 '14 at 12:45