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.

1 Answer 1

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

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

You must log in to answer this question.

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