2

In my thesis I use chemical names containing dashes and numbers in section titles. Additionally, each compound is numbered by using the \cmpd{} command from chemnum-package. To prevent the label from being printed on a new line, \usepackage{ragged2e} \let\raggedsection\RaggedRight is used.

This seems to prevent proper hyphenation of the compound's name, which then runs into the margin. I tried to insert hyphenation markers via \- which has no effect as well as \protect\linebreak and \newline, which will produce weird spacing and hyphenation in the table of contents. Also, using chemmacros's \iupac{}-command and inserting breaking points manually won't work.

How can I hyphenate the work correctly (after the dash and before 2,3,6,7) while keeping the modification done with ragged2e?

MWE:

\documentclass[abstracton, twoside, listof=totoc]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{chemnum}
\usepackage{ragged2e}
 \let\raggedsection\RaggedRight

\begin{document}

 \tableofcontents

 \section{Synthese von 9,10-Dihydro-9,10-etheno\-an\-thra\-cen-2,3,6,7-tetra\-carbon\-säure\-tetra\-methylester \cmpd+{a}}

 \section{Synthese von 9,10-Dihydro-9,10-ethenoanthracen-\protect\linebreak 2,3,6,7-tetracarbonsäuretetramethylester \cmpd+{a}}

 \section{Synthese von 9,10-Dihydro-9,10-ethenoanthracen-\newline2,3,6,7-tetracarbonsäuretetramethylester \cmpd+{a}}

\end{document}
  • 1
    ragged2e sets a rather small rightskip, you can enlarge it a bit to allow latex more freedom when looking for a hyphenation point \RaggedRightRightskip 0pt plus 4em (default is plus 2em). – Ulrike Fischer Jul 4 '15 at 15:16
  • How do you insert breakpoints in \iupac – clemens Jul 4 '15 at 15:18
  • The following code is used trying to indicate breaking points: \iupac{9,10\-Di|hy|dro\-9,10\-etheno|an|thra|cen\-2,3,6,7\-te|tra|car|bon|säure|te|tra|methyl|ester}. Ulrike's answer seems to do the trick for me, but as I'm not fully aware of what this option does I'm wondering if there are unwanted side effects to this solution? – Mundus Jul 4 '15 at 16:43
  • @Mundus are you aware that | in \iupac also inserts a thin space (and disables ligatures)? – clemens Jul 4 '15 at 17:53
  • Actually I was not, which makes this approach even more unsuitable for me. – Mundus Jul 4 '15 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.