Text FormattingHelp with \hyphenation{}

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
hekoushui
Posts: 8
Joined: Sat Jul 31, 2010 6:38 pm

Help with \hyphenation{}

Post by hekoushui »

I created a new word: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa". That's 80 'a's.

In the preamble I have

Code: Select all

\hyphenation{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
--that is, I specified a hyphen after the 40th 'a'.

In the body I have nothing but my new word. No hyphen is inserted; instead I get one line and a bad box. Why?

Same problem occurs if I comment out the \hyphenation{} part and instead use a '\-' directly after the 40th 'a'.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: Help with \hyphenation{}

Post by localghost »

It could be helpful to know what you are after (DNA sequences?). At the moment I see no sense in what you are doing so I'm toiling with a solution.


Best regards and welcome to the board
Thorsten
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Help with \hyphenation{}

Post by frabjous »

I suspect the problem has something to do with the fact that unless the text width were exactly right that 40 a's fit it perfectly, LaTeX wouldn't hyphenate it, because hyphenating it would just replace an overfull box with an underfull box.

I agree that it would be nice to know why you're doing this, and for what purpose. Without that, it's very difficult to suggest an alternative.
hekoushui
Posts: 8
Joined: Sat Jul 31, 2010 6:38 pm

Help with \hyphenation{}

Post by hekoushui »

localghost wrote:It could be helpful to know what you are after (DNA sequences?). At the moment I see no sense in what you are doing so I'm toiling with a solution.


Best regards and welcome to the board
Thorsten
It's just a simple example I made up to test the function of \hyphenation{}. I don't understand why specifying a hyphen after the 40th 'a' doesn't lead to insertion of this hyphen and instead results in an overfull hbox.
hekoushui
Posts: 8
Joined: Sat Jul 31, 2010 6:38 pm

Help with \hyphenation{}

Post by hekoushui »

frabjous wrote:I suspect the problem has something to do with the fact that unless the text width were exactly right that 40 a's fit it perfectly, LaTeX wouldn't hyphenate it, because hyphenating it would just replace an overfull box with an underfull box.

I agree that it would be nice to know why you're doing this, and for what purpose. Without that, it's very difficult to suggest an alternative.
Assuming hyphenation would result in an underfull box: shouldn't LaTeX err on the side of the underfull box in these kinds of situations? Because it doesn't, I have 40 extra characters on one line that are unreadable in the .dvi output.
Post Reply