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.

I'm forced to avoid the url package in a proceedings paper (!) but my bibliography includes a long URL. I already


but the URL spills over to the margin as it isn't hyphenated. I would rather not change the bibliography manually to add the hyphens (my current solution) but rather define the new \url command to put in the \- commands before dots and forward slashes. I've seen a few related questions but close enough for my TeX skills...

Also, is there a way to make the hyphenation happen without an actual hyphen?

EDIT: sorry, I should have said, that not only the url package is disallowed...but I cannot include any extra package. the packages that are included are

graphicx multicol footmisc amsmath amsfonts

So I guess this is a plainTeX question.

share|improve this question
@PeterGrill: no extra packages, see my edit. –  Yossi Farjoun Apr 4 '12 at 20:26
@cgnieder: interesting. I'll try it out. –  Yossi Farjoun Apr 4 '12 at 20:26

2 Answers 2

up vote 7 down vote accepted

Without any package, your only hope is that they use a fairly recent TeX distribution:


This will allow breaks after periods and slashes.

If you have some special character in your URLs, they can be taken care of, just present some examples.

share|improve this answer
This works perfect. Thanks! –  Yossi Farjoun Apr 5 '12 at 15:31
I noticed the following \raggedright behavior with both your answer as well as the url package; Namely, while breaks are "allowed" after slashes, it will frequently prefer to move the whole url down to the next line, in preference to breaking at a slash (if the whole url fits on a single line). Is that expected behavior? –  Steven B. Segletes Sep 29 at 19:34
@StevenB.Segletes Yes, with \raggedright hyphenation is essentially suppressed. Use \RaggedRight from ragged2e. A different strategy might be using {/\penalty0 } in the definition instead of {/\discretionary{}{}{}} –  egreg Sep 29 at 19:41

You can adapt the solution from Option to break urls with carriage-return symbol? to define \url:

enter image description here

If you prefer the use a dash at the end of the line then replace the line \discretionary{-}{}{} which yields:

enter image description here

but note that this can be confusing as it is difficult to tell if the trailing dash is part of the URL or not. This is not an issue if the link is to be clicked on with online viewing, but for printed version this may be an issue.

Alternatively, if you use \discretionary{\usebox\MyArrowBox}{}{} then you can have a special character (I used \hookleftarrow, but you can adapt this to use any other symbol) at the end of the line to indicate the continued text so that there is no confusion with a dash.

enter image description here



  %\discretionary{-}{}{}% If want a dash

  \StrLen{#1 }[\stringLength]%



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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