I noticed that if I've got something like this:

one::two::three::four one::two::three::four one::two::three::four

something weird happen:

%                      the right page margin would be here |
%                                                          |
%                                                          v
one::two::three::four one::two::three::four one::two::three::four

the page margin is where I marked, but the line doesn't get broken, ::four goes out of the page, although it is aligned so that the first colon is exactly after the margin, like if it had to be splitted.

Why doesn't the line gets broken between one::two::three and ::four?
And then why does it get aligned that way, so that ::four goes out of the page?


You could define


Now just write \:: and :: would be splitted into : and : at the end of a line. You could easily change it to behave differently, such as


That's a benefit of a LaTeX macro: once you defined and used it, you might easily change it consistently.

A minimal example, as requested in a comment:

| improve this answer | |
  • Thanks, I'm using your second directive, the result is exactly what I wanted. – peoro Jan 15 '11 at 15:18
  • 1
    @peoro Could you mark this as the "selected" answer then? :) – mpr Oct 30 '11 at 4:28
  • It should be remarked that this overrides the definition of \:, which might be used for spacing in math formulas. – egreg Jan 14 '12 at 21:18

It doesn't get broken there because TeX breaks lines only at white space, hyphenation points, or at explicitly inserted invocations of \discretionary. You could put \discretionary{}{}{} before each double colon if you wish to allow a line break there. If you need this a lot, make a shorter macro for it.

| improve this answer | |
  • Yeah, need it quite a lot, will create a command for it, thanks! Anyway why does LaTeX put ::four after the right page margin, rather than putting the whole word (one::two::three::four) on a new line? That looked quite weird to me. – peoro Jan 15 '11 at 13:23
  • @peoro: I'm pretty sure it's coincidence. – Hendrik Vogt Jan 15 '11 at 13:27
  • @peoro: I guess that you typeset your text justified and that TeX couldn't find an acceptable solution for line-breaking (putting the whole third "word" on a new line would have created too much whitespace in the first line). – lockstep Jan 15 '11 at 13:35
  • Uh, yeah, it looks like you guys are right. I am such a newbie with LaTeX, although I'm using it quite a lot... – peoro Jan 15 '11 at 15:17

Just to add to Harald's answer. TeX will hyphenate at a space or at a letter in a word that is an acceptable hyphenation point as per the patterns provided for the language.

There are no patterns that would allow a colon in a word, as no such words exist in English! For example the following non-sense word will hyphenate. Remember also that the very first word is never hyphenated.

The very first word is not hyphenated at all fortymenpageturnthreeonefouronetwothreefour
| improve this answer | |
  • Yeah, that is what I meant by “hyphenation point”. Sorry, I tend to be overly terse sometimes. – Harald Hanche-Olsen Jan 15 '11 at 16:21

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.