# How do I insert a non-breaking hyphen into an \iupac name?

IUPAC by default linebreaks at hyphens.

The character - inserts a small space before the hyphen and removes a small space after it. Also usually words with hyphens are only allowed to break at the hyphen. Inside \iupac the hyphen will not prevent further hyphenation. The amount of inserted space can be customized.

Is there a way to prevent this? For example, in \iupac{2-alkenyl-1-alkynylbenzenes} I don't want a line break after the initial 2.

(Contrived) example of the problem:

\documentclass[letterpaper]{article}
\usepackage[left= 10 cm, right=5 cm]{geometry}

\usepackage{chemmacros}

\begin{document}
Gold-catalyzed (4+3)-annulations of \iupac{2-alkenyl-1-alkynylbenzenes} with anthranils with alkyne-dependent chemoselectivity: skeletal rearrangement versus non-rearrangement
\end{document}


You can define a new shorthand.

\documentclass[letterpaper]{article}
\usepackage[left= 10 cm, right=5 cm]{geometry}
\usepackage{chemmacros}

\DeclareChemIUPACShorthand{!}{\nbhyphen}
\newcommand{\nbhyphen}{\mbox{-}}

\begin{document}

Gold-catalyzed (4+3)-annulations of
\iupac{2-alkenyl-1-alkynylbenzenes}
with anthranils with alkyne-dependent
chemoselectivity: skeletal rearrangement
versus non-rearrangement

Gold-catalyzed (4+3)-annulations of
\iupac{2!alkenyl-1-alkynylbenzenes}
with anthranils with alkyne-dependent
chemoselectivity: skeletal rearrangement
versus non-rearrangement

\end{document}


I just enclosed the - in an \mbox to prevent hyphenation.

\documentclass[letterpaper]{article}
\usepackage[left= 10 cm, right=5 cm]{geometry}

\usepackage{chemmacros}

\begin{document}
Gold-catalyzed (4+3)-annulations of \iupac{2\mbox{-}alkenyl-1-alkynylbenzenes} with
anthranils with alkyne-dependent chemoselectivity: skeletal rearrangement versus
non-rearrangement
\end{document}


• Cool. I'm going to leave it open for a bit to see if there is a dedicated way to do this through chemmacros (say, a more semantic way?) but thank you! – Canageek Jan 7 at 20:52