6

IUPAC by default linebreaks at hyphens.

From the chemmacros v5.8b manual:

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}
Bernard
  • 271,350
Canageek
  • 17,935

2 Answers2

5

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}

enter image description here

  • 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 07 '19 at 20:52
4

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}

enter image description here

egreg
  • 1,121,712