# Lines too long due to text inside custom command not being hyphenated

I'm having some problems with lines that turn out to be too long. There are correct hyphenation rules for the word but they aren't being applied.

Let me first give the sentence that is too long:

An isomorphism that maps a graph to itself is called an \concept{automorphism}.


The command concept is defined as follows

\newcommand{\concept}[1]{\index{#1}\marginpar{\raggedright\textbf{#1}}\textbf{#1}}


The problem seems to be that words inside \concept aren't being hyphenated. How can I fix this? If I type

An isomorphism that maps a graph to itself is called an \textbf{automorphism}.


then the word is hyphenated perfectly. So I would now like to have the command \concept behave the same way, i.e. allow concepts to be hyphenated according to the standard rules.

-

The first word is never hyphenated, unless something before it makes TeX think it's not the first word

\newcommand{\concept}[1]{%
\textbf{#1}%
\marginpar{\raggedright\hspace{0pt}\textbf{#1}}%
\index{#1}}


The \hspace{0pt} is the trick.

\marginpar and \index should follow the word they refer to, being attached to it, in order not to leave a legal break point that could cause misalignment of the marginal note and off-by-one errors in the index. If put before the word, they inhibit its hyphenation.

-
Thanks for this fast response. And thank you for a solution. I might a small edit to your code, because the \hspace{0pt} was needed in two places. – nvcleemp Sep 21 '11 at 12:56
The second \textbf{#1} is typeset in the normal text, so there's no need to give a zero space there. – egreg Sep 21 '11 at 13:06
Actually the \index should go after the word, just for that reason. – egreg Sep 21 '11 at 13:17
Hmm, strange. If I don't place that second \hspace{0pt}, then the text isn't hyphenated. – nvcleemp Sep 21 '11 at 13:30
@nvcleemp Look at the edited answer. I overlooked at the \index command. – egreg Sep 21 '11 at 14:46