0

I'm getting a few "overfull \hbox" error with compounded words of the "longword1-longword2" kind, with "longword1-" exceeding the margin. This can be solved by defining custom hyphenation ("\long-word1-longword2").

Issue #1: I have many different occurences with different words and I'd like to avoid to manually fix all of them.

Issue #2: I noticed that

\hyphenation{long-word1-longword2}

does not work, maybe because of the hyphen between the two words.

Issue #3: most of these words are defined using glossary package:

\RequirePackage[toc,acronym]{glossaries}

For example, one of the acronyms is defined as

\newacronym{cbm}{CBM}{Condition-based Maintenance}

and when I call it with

...a component (\textit{``\acrlong{cbm}''}) and detect...

the "on-" is exceeding the margin.

I tried the following solutions:

\newacronym{cbm}{CBM}{Condi\-ti\-on-based Maintenance}

\hyphenation{Condi-ti-on-based Condi-ti-on}

and none of them works, while replacing the \acrlong command with the full text Condi-ti-on-based Maintenance does work.


So my questions are:

  1. is there any way to do an automatic hyphenation for these "longword1-" when I am NOT using \acrlong?

  2. is there any way to use custom hyphenation within the \acrlong command?

  3. how do I use \hyphenation{} with words containing a dash?

PS: If it could matter, I'm using book class.

Thank you!

  • 1
    It's a known 'feature' of TeX that the hyphenation algorithm does not hyphenate words already containing a hyphen. See https://tex.stackexchange.com/q/63232/35864 and https://tex.stackexchange.com/q/2706/35864 – moewe Mar 30 '18 at 15:47
  • I found a working solution for issue #3, which still requires to use "-" in the acronym definition

    https://tex.stackexchange.com/questions/69275/acronym-does-not-hyphenate-in-text

    – Taekwondavide Mar 30 '18 at 17:08
  • 1
    depending on where and how the already hyphenated words are being input, they might be amenable to applying a (manual) workaround xxx\hyph yyy, defining \hyph as \slash is defined by latex; see https://tex.stackexchange.com/q/121955/579 for uses of that command and a pointer to its definition. (\hyph is defined for tugboat for exactly this reason.) – barbara beeton Mar 30 '18 at 21:10

0 Answers0