3

For some reason, footnotes do not seem to work with the ulem package.

\documentclass{article} 
\usepackage{ulem}
\begin{document}
    \uline{test\footnote{note}}
\end{document}

gives

! Undefined control sequence.
\@footnotemark ...rk \ifhmode \spacefactor \@x@sf 
                                                  \fi \relax 

when I try to compile it using pdflatex. Is there any chance to fix this or some kind of workaround?

2
  • You might use soul and its \ul command. If you're underlining a word for giving it a special meaning, then the footnote marker shouldn't be underlined anyway and the standard \underline would suffice. If you're underlining a whole sentence, emphasize it in a different way, with italics, for instance; your readers will be grateful.
    – egreg
    Commented Jun 23, 2014 at 10:34
  • Thanks for your advice. But my requirements for underlining with the ulem package are kind of external.
    – porst17
    Commented Jun 23, 2014 at 11:13

2 Answers 2

7

Put problematic parts in a box (see the documentation). But -- as Heiko reminds in the comment -- if you put the whole footnote in the box you will lose the text. So you should use \footnotemark/\footnotetext:

\documentclass{article}
\usepackage{ulem}
\begin{document}
    \uline{test\mbox{\footnotemark}}\footnotetext{note}\uline{ blalbalb}\footnote{blub}
\end{document}
3
  • Perfect example of RTFM.
    – porst17
    Commented Jun 23, 2014 at 11:05
  • \footnotemark and \footnotetext are needed. Commented Jun 23, 2014 at 11:36
  • @HeikoOberdiek: Blush. That's the draw back of a too large zoom. You are completly right. I will edit the answer. Commented Jun 23, 2014 at 11:45
2

Two variants of underlining:

\documentclass{article} 
\usepackage{ulem}
\begin{document}
 %   \uline{test\footnote{note}}

 \uline{test}\footnote{note}

or

{test}\footnote{ \uline{note}}
\end{document}

enter image description here

2
  • 1
    +1 Underlining should not be used at all, anyways. And it certainly makes no sense to underline a text that is long enough to contain a footnote.
    – yo'
    Commented Jun 23, 2014 at 10:29
  • 3
    There are certainly use cases, where underlining makes sense - regardless of the footnotes. Judging underlining is not part of the question.
    – porst17
    Commented Jun 23, 2014 at 11:04

You must log in to answer this question.

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