Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Line break in lines with colons

I have Perl package name defined as command:

\newcommand{\myperlpackage}{\texttt{XXXXX::YYYYY::ZZZZZ}}

How can I tell LaTeX to hyphen package name after double colon but without any hyphen char eg.

XXXXX::-
YYYYY::ZZZZZ

should be

XXXXX::
YYYYY::ZZZZZ
share|improve this question
1  
Maybe your question is answered here: Line break in lines with colons. (Possible duplicate?) –  Hendrik Vogt Mar 22 '11 at 13:59
    
Yes, the main point of both questions is the same, but that question is more general - that's why I probably can't find it. –  jesper Mar 22 '11 at 14:07
    
@jesper: So do the answers to that question answer yours? –  Andrew Stacey Mar 22 '11 at 14:09
    
Yes, but not as straight as this answers. I think this topic shouldn't be delete If you ask about this. –  jesper Mar 22 '11 at 14:17
    
@Andrew: So what do you think? –  Hendrik Vogt Mar 22 '11 at 14:28
show 3 more comments

marked as duplicate by Andrew Stacey, Hendrik Vogt, Caramdir, lockstep, Martin Scharrer Mar 22 '11 at 22:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 3 down vote accepted

I usually define a command \dbr for discretionary breakpoints like this: \newcommand\dbr{\disretionary{}{}{}}. Then you can write XXXX::\dbr YYYY::\dbr ZZZZ, which should have the effect you desire.

To explain, \discretionary<arg1><arg2><arg3> tells TeX that a line break is permissible and that it should put <arg1> before the breakpoint, <arg2> after the breakpoint (in the next line), and <arg3> in the case that no line break is performed. See the TeXbook (page 95) for more details.

share|improve this answer
add comment

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