The line of text I want to underline includes in-text citation. My problem is that \uline only works on this line when I use \mbox(I get an error without \mbox), which makes it impossible to wrap the text. Note that when I remove the \cite command, \uline works perfectly. How can I underline and wrap text that includes citation?

@Article{     hermes2008a,
  author    = {Hermes, Juliet C. and Reason, C. J C},
  journal   = {Journal of Geophysical Research: Oceans},
  number    = {4},
  pages     = {1--10},
  title     = {{Annual cycle of the South Indian Ocean
          (Seychelles-Chagos) thermocline ridge in a regional ocean
  volume    = {113},
  year      = {2008}

\subsubsection*{\uline{~\mbox{\cite{hermes2008a}: ~\mbox{\usebibentry{hermes2008a}{title}}}}}

\subsubsection*{\uline{Hermes and Reason (2008): Annual cycle of the South Indian Ocean (Seychelles-Chagos) thermocline ridge in a regional ocean model}}

\subsubsection*{\cite{hermes2008a}: \usebibentry{hermes2008a}{title}}


enter image description here

  • 2
    Welcome to TeX.SX! What's the reason for using \subsubsection here? – TeXnician Jun 14 '18 at 10:36
  • 1
    Underlining is incredibly hard for TeX (and some would say typographically dubious), so if you can avoid it at all you should do that. ulem's \uline and soul's \ul have severe limitations in what they can accept as arguments: Plain text and some simple macros are usually fine, but more complicated macros like \cite often either cause errors or don't come out as expected (no underlining, no line breaks). The contents of some boxes cannot be broken across lines, that's why you can't get a line break here. BTW: The use of \subsection does not make the problem easier. – moewe Jun 14 '18 at 10:50
  • In my answer to tex.stackexchange.com/q/435962/35864 I adapted LuaLaTeX code by Paul Isambert to implement a more robust \luaunderline command that can accept \cite etc. in its argument. but of course that requires LuaLaTeX. – moewe Jun 14 '18 at 11:03
  • @moewe what about utilizing \underline{}? – naphaneal Jun 14 '18 at 12:16
  • 1
    @naphaneal \underline does not do line breaks. The result will be similar to the first line in the screenshot. That's one of the reasons why ulem's and soul's underline commands exist in the first place: They allow for line breaks. – moewe Jun 14 '18 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.