1

In my text, I use (un)conditional (s. here if you wonder why), which causes the text to exceed the right margin - the text is no longer justified.

In minimal working example below, I used (UGLY) which will not cause a line break - in contrast to (PROBLEMATIC), what get's broken after (PROB.

So, in some sense it is the opposite of this question, where the aim was to prevent a line break via \mbox{(UGLY)tempor}. Here I could solve the problem by adding \linebreak in front of (UGLY)tempor, which is not a satisfying solution because some words before the \linebreak might change in future, leading to a misplaced linebreak. To wrap it up: How do I make LaTeX treating (UGLY)tempor as a normal word?

\documentclass[12pt]{article}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod (UGLY)tempor incidunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquid ex ea commodi consequat.
\end{document}
3

Adding \nobreak\hspace{0pt} prevents a word break, but re-enables hyphenation for what follows.

Alternately, you can make () and [] not break hyphenability, using \lccode (first revealed to me in David's answer to this question, hyphenation next to a parenthesis)

\documentclass{article}
\usepackage{lipsum}
\begin{document}
blah blah blah blah blah blah blah blah blah blah blah blah blah 
(un)conditional 
blah blah blah blah blah blah blah 

blah blah blah blah blah blah blah blah blah blah blah blah blah 
(un)\nobreak\hspace{0pt}conditional 
blah blah blah blah blah blah blah 

blah blah blah blah blah blah blah blah blah blah blah blah bl  
(un)\nobreak\hspace{0pt}conditional 
blah blah blah blah blah blah blah 

\lipsum[1]

\lccode`\(`\(
\lccode`\)`\)
\lccode`\[`\[
\lccode`\]`\]
blah blah blah blah blah blah blah blah blah blah blah blah blah 
(un)conditional 
blah blah blah blah blah blah blah 
\end{document}

enter image description here

  • (un)\nobreak\hspace{0pt}conditional did the job. For lccode my sense of LaTeX is too bad. If you want, you can try to explain it, but you don't need to. – Qaswed Apr 3 '18 at 16:59
  • 1
    @Qaswed It is a technicality, which causes the hyphenation algorithm to think of () as letters and, therefore, not to branch to the "I came across a non-letter" part of the algorithm. – Steven B. Segletes Apr 3 '18 at 17:07
  • 1
    @Qaswed I would add that the hyphenation algorithm (Appendix H in the TeXbook) does not seek actual words, but rather, starting at the beginning of the word, for hyphenation patterns, groups of common adjacent letters that occur at syllable boundaries. So, using the \lccode for () means that (un)conditional is now considered a 15-letter word to the hyphenation algorithm, and the presence of ( and ) do not prevent the algorithm from looking for patterns in what follows the ). – Steven B. Segletes Apr 3 '18 at 17:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.