# When, if ever, does space created by \hspace get expanded?

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

01/\hspace{0pt}/01\hspace{0pt}/2001


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

01/01/2001


there are cases when its rendered form violates the margin.

• You could try \allowbreak. – Steven B. Segletes Apr 23 '17 at 2:43
• \hspace{0pt} ultimately expands to \hskip 0pt\relax which has no stretch nor shrink. – ShreevatsaR 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

01/\linebreak[0]01


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

 \DeclareUrlCommand\mydate{\urlstyle{relax}}
\mydate{01/01/2017}


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