3

Here is the minimal working example

\documentclass{article}
\usepackage{ulem} 
\begin{document}
one two three  one two three one two three one two three one two three one two three one two three one two three 

one two three one two three one two three one two three one two three \uline{\hspace{5em}}  %no underline showing
\end{document}

the result is

enter image description here

However, there should be a underline of 5em length. Is it a bug of ulem package?

user15964
  • 865
  • 1
    Use \uline{\phantom{\hspace{5em}}} or \uline{\hspace{5em}{}} –  May 25 '16 at 13:35
  • @ChristianHupfer Hi, ChristianHupfer. I can confirm phantom works. But \uline{\hspace{5em}{}} is not working – user15964 May 25 '16 at 14:09
  • @campa: I don't understand it at the moment, so it's better not to post an answer. On the other hand, \hspace{5em} Foo won't print a space of the given width and then Foo (i.e. omitting the \uline command) -- I assume it's the \hskip which underlies \hspace –  May 25 '16 at 14:12
  • @campa Hi, campa. Why you delete answer of \hspace* which works. So your new comment shows a new bug of ulem? – user15964 May 25 '16 at 14:17
  • @user15964: yes, the {} doesn't work (it worked, but under different circumstances –  May 25 '16 at 14:34
  • @campa: \hskip ... dies out at the end of a line, as I can confirm now. I assume, that this leads to an empty box at the end of a line and as such \uline does nothing –  May 25 '16 at 14:36

1 Answers1

4

This behaviour seems as you should expect, with \uline{\hspace producing the same space as \hspace but underlined

enter image description here

\documentclass{article}
\usepackage{ulem} 
\begin{document}
one two three  one two three one two three one two three one two three one two three one two three one two three 

one two three one two three one two three one two three one two three \uline{\hspace{5em}}  %no underline showing



one two three one two three one two three one two three one two three \uline{\hspace{5em}}  %no underline showing



one two three one two three one two three one two three one two three \hspace{5em}x1

one two three one two three one two three one two three one two three \uline{\hspace{5em}}x2 

one two three one two three one two three one two three one two three \hspace*{5em}x3 

one two three one two three one two three one two three one two three \uline{\hspace*{5em}}x4 
\end{document}

Normally a space is discarded at a linebreak, so the left margin is preserved, so you see this happening for x1 and x2, \hspace* forces the space to be kept so you see the space in x3 and x4, underlined in the x4 case.

David Carlisle
  • 757,742