The following code


used to work without error, to produce an underlined blank space of width 2 inches. Now with a brand new MikTeX installation, I get the following error

! Extra }, or forgotten \endgroup.
\UL@stop ...alty \ifnum \lastkern =\thr@@ \egroup 
                                                  \egroup \ifdim \wd \UL@box...
l.4 \emph{\hspace*{2in}}

Here are the file dates, etc.

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 21.1) (preloaded format=pdflatex 2021.2.7)  7 FEB 2021 13:50
entering extended mode
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-01-09> xparse <2020-03-03>
("C:\Program Files\MiKTeX\tex/latex/base\minimal.cls"
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) ("C:\Program Files\MiKTeX\tex/latex/ulem\ulem.sty"
Package: ulem 2019/11/18
("C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def"
File: l3backend-pdftex.def 2021-01-09 L3 backend support: PDF output (pdfTeX)
  • For TeXLive users, this works in 2020, but is broken in 2021
    – Alec
    Jun 17, 2021 at 16:47

3 Answers 3



With a current LaTeX (LaTeX2e <2021-06-01> patch level 1) the patch is no longer needed.

Old answer

The \hspace command has been extended to allow calculations if the calc package is loaded. ulem hasn't updated its code yet to this change (but the maintainer has been informed). The needed patch would be something like this:

\makeatother %return @ to normal meaning


  • What does this patch actually do, and do I need to worry about \hspace usage elsewhere?
    – Alec
    Jun 17, 2021 at 16:46
  • @Alec with a current latex you no longer need the patch. And normally it should work, unless some package does (like ulem) something special. Jun 17, 2021 at 16:50
  • I built TeXLive 2021 today, and this is still happening with ulem
    – Alec
    Jun 17, 2021 at 16:51
  • 1
    The fix is very new, so you need to check for updates, most importantly of the firstaid package. Jun 17, 2021 at 16:53

The \emph{} command is for italicizing, You use \underline{} for underlining. The following MWE generates the blank space you're after on my machine. You must have redefined \emph{} in another document or something.



\underline{\hspace{2 in}}

  • Thanks but your response isn't exactly on point. I wasn't asking how to create an underlined blank space, though I agree your code does that. I was reporting an error. The code above worked for years and exists in scores of exams, quizzes, etc. of mine (actually my wife's). The ulem package redefines \emph to create underlines, and the above code worked with that package for years. Now it throws an error. Unless there's a reason why it was always "against the rules" so to speak to wrap ulem's redefined emph around an hspace, the code should still work. Feb 7, 2021 at 20:18
  • I'm sorry, I didn't fully understand what the ulem package was doing before.
    – Will
    Feb 7, 2021 at 22:03

I am not sure what changed. However, if you use a \kern rather than the \hspace*, it works.


enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .