[Tex/LaTex] Extra Space After newcommand

spacing

I was trying to write a macro to bold a name. I used:

\newcommand{\authorship}[2]{\textbf{#1 #2}}

then in the text used

\authorship{Dave Bridges}

Unfortunately when run through pdflatex I get an extra space after the name. So for example the line

\authorship{Bridges, D.}, M. E. Fraser and G. B. G. Moorhead.  2005.  Cyclic Nucleotide Binding Domains in the Arabidopsis thaliana and Oryza satviva Genomes.  BMC Bioinformatics 6(1): 6.

adds an extra space between the period after D and the comma. How do I get rid of that extra space?

Best Answer

Although you specify you command \authorship to take two arguments, you actually only supply it with one during a call like:

\authorship{Dave Bridges}

As such, #2 is the following token (a , in this case), but TeX still prints #1, followed by a space, followed by #2 (a bold comma). Using a macro like this

\newcommand{\authorship}[1]{\textbf{#1}}%

or even just

\let\authorship\textbf

would suffice. Of course, if you intend to highlight (bold) certain parts of a name, then something else needs to be done, like keeping your original definition, but with usage of the form:

\authorship{Bridges}{Dave}
Related Question