0

I'm trying to avoid a line break in a middle of a method name as it can be seen here: enter image description here

I want PredRNN++ to remain intact. I tried using

\mbox{PredRNN++}

but then the name gets pushed out into the right margin as this: enter image description here

  1. Why does this happen?
  2. How could I achieve the result of "PredRNN++" not being line-breaked?

2 Answers2

1

To solve the linebreaking problem, insert a tie between the compounds, i.e. Pred~RNN++. If that results in an overfull box (aka the line going into the margin), you have two options.

enter image description here

  1. Rewrite the sentence. Usually is suffices to transpose some words. In the case of the picture above swapping Pred~RNN++ and nunc would fix it.

  2. Wrap the whole paragraph in a sloppypar environment.

    \documentclass{article}
    \begin{document}
    \begin{sloppypar}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur massa turpis,
    semper quis fringilla ut, viverra nec risus. Pellentesque habitant morbi
    tristique senectus et netus et malesuada fames ac turpis egestas. Donec Pred~RNN++ nunc
    lorem, sollicitudin vel sodales eget, vehicula nec mi. Proin ullamcorper rutrum
    nibh, at porttitor nunc euismod et. Donec faucibus nisi faucibus ipsum porttitor
    pharetra. Sed elementum, lectus nec congue imperdiet, ipsum leo viverra nisi, sit
    amet commodo odio odio id nisl. Fusce sagittis lobortis nisi sed consectetur. Nam
    egestas, sem ut fermentum convallis, ipsum tellus venenatis augue, eget
    condimentum risus quam id erat. Sed metus dui, sollicitudin pharetra pellentesque
    sed, placerat eget augue. Mauris sodales pretium tortor vitae rutrum. Proin quam
    sem, lobortis tincidunt pretium vitae, feugiat eu lacus.
    \end{sloppypar}
    \end{document}
    

    But this might lead to excessive spacing between words.

    enter image description here

Henri Menke
  • 109,596
0

You can stop hyphenation altogether by putting

\hyphenpenalty 10000

in the preamble. That is probably not the desired effect. You can stop the hyphenation of acronyms (such as PredRNN++) by putting

\uchyph=0

in the preamble. However, when I tried it, the acronym was not split, but rather extended into the right margins, and I am not sure if this is the desired effect.

Source: https://texfaq.org/FAQ-wdnohyph

  • Disabling hyphenation for an entire document is extreme, and likely to result in even more overfull lines. Avoiding the latter when hyphenation is disabled is often accomplished using ragged right, but that's not an appropriate "solution" here. – barbara beeton Jan 31 '20 at 02:14