# How to prevent linebreak in a command

I am using the package biocon, which allows to define species names at the beginning of the document, which can be used by writing e.g. \plant{At} which would be translated into "A. thaliana". However, linebreaking is allowed in between the "A." and the "thaliana". How can I prevent this? I tried to renew the command, but this produces an error ( my line of code is the one uncommented). How would one solve this correctly?

\documentclass{article}
\usepackage{biocon}
%\renewcommand{\plant}{\mbox{\plant}}
\begin{document}
\newplant{At}{genus=Arabidopsis,epithet=thaliana,author=Heynh.,oldauthor=L.}

\plant{At}
Many plants are very beautiful. However, there are \plant{At} is such a plant, only having white flowers.

\end{document}


Here's a modified style that adds \nolinebreak after the period in the abbreviated form. I added also the “original” test in order to see our redefined setting works.

\documentclass{article}
\usepackage{biocon}

\newtaxastyle{a+}
{\taxit{\taxonfirst{!genus!.\nolinebreak}\taxon{ !epithet!}}}
\defaultabbr{a+}

\newplant{At}{genus=Arabidopsis,epithet=thaliana,author=Heynh.,oldauthor=L.}

\begin{document}

\plant{At}
Many plants are very beautiful. However, there are \plant{At} is such a plant, only having white flowers.

\bigskip

A test with the default setting to see that our replacement works

\newplant{Atx}{genus=Arabidopsis,epithet=thaliana,author=Heynh.,oldauthor=L.} % the same as before
\defaultabbr{a}% this is the default

\plant{Atx}
Many plants are very beautiful. However, there are \plant{Atx} is such a plant, only having white flowers.

\end{document}


• the space after "A." in the first example seems wider than necessary (as if it's an end-of-sentence space). how about {!genus!.~\ignorespaces}? – barbara beeton Sep 16 '14 at 21:14
• @barbarabeeton I don't think so: I get exactly the same space if I type \textit{A. thaliana} and here the period is definitely not sentence ending. It's an optical illusion due to italic type. – egreg Sep 16 '14 at 21:26

You can redefine the a-style used for abbreviations and add an ~:

\documentclass{article}
\usepackage{biocon}

\newtaxastyle{a}
{\taxit{\taxonfirst{!genus!.}\taxon{~!epithet!}}}

\begin{document}
\newplant{At}{genus=Arabidopsis,epithet=thaliana,author=Heynh.,oldauthor=L.}

\plant{At}
Many plants are very beautiful. However, there are \plant{At} is such a plant, only having white flowers.

\end{document}

• can you show the output, please? @egreg's approach results in a space that i think is too wide, and would benefit from a ~ instead, but what i suggested won't work. if the placement of the ~ as you've done it gives better spacing, it's a better answer. – barbara beeton Sep 16 '14 at 21:24
• @barbarabeeton: After an "A." (uppercase A!) there is no larger space after the period regardless of the frenchspacing settings. So egreg's solution should work fine too. I only find ~ before the ephitet more logical: It will work as expected even if there is no ephitet, while with egreg solution the line break after the plant is suppressed. – Ulrike Fischer Sep 17 '14 at 8:11
• obviously, you are correct about the space, and i really should know that. thanks for keeping me honest. – barbara beeton Sep 17 '14 at 14:28