I have been using the following pattern to allow a date in MM/DD/YYYY format to be broken after each solidus.


I never want extra space after the solidus; I want it to be translated into either a line break or nothing (the equivalent of "no-width optional break" as applied in MS Word, I believe). But does the TeX system allow additional space to be inserted? Should I be using a different pattern to allow for optional line breaks?

If I enter the date as


there are cases when its rendered form violates the margin.

  • You could try \allowbreak. Apr 23 '17 at 2:43
  • \hspace{0pt} ultimately expands to \hskip 0pt\relax which has no stretch nor shrink. Apr 23 '17 at 3:37

A skip (hspace) with any amount of stretch will over stretch if the surrounding box has not enough content to fill its width, this is the infamous "underfull hbox" warning. However a skip with no stretch or shrink component as in your example is never stretched.

That said, you do not want to have a space here, so using \hspace just to allow line breaking as a side effect is not the best markup, you could use


which adds a penalty of 0 allowing, but neither encouraging or discouraging a break, or use the provided macro

01\slash 01

which uses the same penalty as an explicit hyphen which (in most classes) allows, but mildly discourages, a break there.

Or you could use the url package and


as that package allows line breaking on / (the relax just says to do nothing about switching fonts)


Try this: 01/\penalty0{}01/\penalty0{}2001

\penalty0 allows easy break.

  • See @DavidCarlisle’s answer; /\penalty\exhyphenpenalty is better, because it rates the break as a break at a hyphen, and is exactly what \slash expands to.
    – GuM
    Apr 23 '17 at 22:23

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.