2

I have the following MWE:

\documentclass{article}
\usepackage{ulem}
\newcommand\deeperuline{\bgroup\markoverwith{\rule[-1.1ex]{2pt}{0.4pt}\ULon}
\begin{document}
This \deeperuline{does} work \uwave{nicely}.
This \deeperuline{gives \uwave{an} error} but renders nicely.
\end{document}

The intention is to have a sentence where a part is underlined wavy and another part (that contains the wavily underlined part) is underlined with a line that is deeper than a normal underline (so that it does not cross the wavy underline).

The above code produces the error "dimension too large" for the second sentence but both sentences render nicely. Is there anything I can do to silence that error?

I observed that error both in pdflatex and in xelatex.

peschü
  • 316
  • 2
  • 11

1 Answers1

3

For testing purposes, ulem.sty sets \ULdepth to \maxdimen and then you can't use it for doing arithmetic in a safe way.

However, since you want fixed depth of the underline, you can set the parameter to another value.

Set \ULdepth to \maxdimen.

\documentclass{article}
\usepackage{ulem}

\newcommand\deeperuline{% \bgroup\ULdepth=\maxdimen \markoverwith{\rule[-1.1ex]{2pt}{0.4pt}}\ULon }

\begin{document}

This \deeperuline{does} work \uwave{nicely}. This \deeperuline{gives \uwave{an} error} but renders nicely.

\end{document}

I tested both with 1000pt and 0pt, getting the same result.

enter image description here

egreg
  • 1,121,712
  • Thank you that works nicely! I wonder what the reason is and when it would not be possible to set \ULdepth=1000pt? – peschü Aug 27 '15 at 12:43
  • @peschü That's how Donald Arseneau wrote the package; it would take extensive work to change it. – egreg Aug 27 '15 at 12:46
  • It does not work anymore. I think setting \ULdepth to \maxdimen instead of 1000pt should do the trick. – Udi Fogiel Sep 26 '23 at 23:05
  • @UdiFogiel ulem changed in 2019, probably in order to fix the issue of “Dimension too large”. – egreg Sep 27 '23 at 08:06