5

I am working on an article, where I need to strike out or underline some of the sentences with citations. I try to do this as \uline{sentence1 \citep{reference1}, sentence continued \citep{reference2,reference3}}. but it shows this warning extra }, or forgotten \end group. I tried

  1. To add \protect in front of each \citep or \citet which doesn't work.
  2. To add the citations as \mbox{\citex{reference1}}, which worked and warnings disappeared, but with \mbox the page breaks are also disappearing.

So, are there any solutions how to strike out/underline keeping the citations intact inside? PS:I'm using ulem and natbib.

3

This solution involves closing off your \uline and \sout invocations as you approach an invocation of \citep. For those references, use \ulineref and \soutref as defined in this MWE. Then, pick up the \uline and \sout where you left off, after the reference. The reference itself will not break across a line, though of course the \uline and \sout will.

The solution here adapts the censor package to do both underlining and strikeout. The depths of the lines can be changed with the \censorruledepth, as used in the \ulineref and \soutref macros. I tried to match those value to the existing line depths of the ulem package.

\documentclass{article}
\usepackage{ulem}
\usepackage{censor}
\usepackage{natbib}
\bibliographystyle{plainnat}
\usepackage{filecontents}
\usepackage{calc}
%%%%%%%%%%%
\censorruleheight=.1ex %THICKNESS OF CENSOR RULE
\newlength\nextcharwidth
\makeatletter
\renewcommand\@cenword[1]{%
  \setlength{\nextcharwidth}{\widthof{#1}}%
  \censorrule{\nextcharwidth}%
  \kern -\nextcharwidth%
  #1}
\makeatother
\newcommand\ulineref[1]{\censorruledepth=-.67ex\censor{#1}}
\newcommand\soutref[1]{\censorruledepth=.55ex\censor{#1}}
%%%%%%%%%%%
\begin{filecontents}{\jobname.bib}
@article {MCOSW,
author = "Hugh Glaser and Afraz Jafri and Ian Millard",
title = "Managing co-reference on the semantic web",
journal = "WWW2009 Workshop: Linked Data on the Web (LDOW2009)",
month = "April",
year = "2009",
%
@article {MCOSX,
author = "Hugh Glaser and Afraz Jafri and Ian Millard",
title = "Managing co-reference on the semantic web",
journal = "WWW2009 Workshop: Linked Data on the Web (LDOW2009)",
month = "April",
year = "2009",
%
@article {MCOSY,
author = "Hugh Glaser and Afraz Jafri and Ian Millard",
title = "Managing co-reference on the semantic web",
journal = "WWW2009 Workshop: Linked Data on the Web (LDOW2009)",
month = "April",
year = "2009",
}
\end{filecontents}
\begin{document}
I will begin the underline 
\uline{sentence1 }%
\ulineref{\citep{MCOSW}}%
\uline{, sentence continued onto next line. }%
\ulineref{\citep{MCOSX,MCOSY}}%
\uline{ blah blah} 
followed by normal text

I will begin the strikeout
\sout{sentence1 }%
\soutref{\citep{MCOSW}}%
\sout{, sentence continued onto next line. }%
\soutref{\citep{MCOSX,MCOSY}}%
\sout{ blah blah} 
followed by normal text

\bibliography{\jobname}
\end{document}

enter image description here

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.