6

For a scientific publication, I am writing a modified version of my article which takes in account the comments of my reviewers. I need to identify which modification is due to which reviewer, so I use the changes package. Obviously, I have references in my article, so I use the cite package.

PDFLaTeX (TexLive 2014) gives me errors when I use the cite command within the deleted or replaced commands of the changes package. Here is a minimal working example:

\documentclass{article}

\usepackage{cite}
\usepackage{changes}

\begin{document}

As previously observed \deleted{in \cite{someref}, there is no banana here.}

\begin{thebibliography}{9}
\bibitem{someref} 
Some ref here.
\end{thebibliography}

\end{document}

I get the following errors:

! Extra }, or forgotten \endgroup.
\UL@stop ...alty \ifnum \lastkern =\thr@@ \egroup
\egroup \ifdim \wd \UL@box...
l.8 ...n \cite{someref}, there is no banana here.}


! Extra }, or forgotten \endgroup.
\UL@stop ...num \lastkern =\thr@@ \egroup \egroup
\ifdim \wd \UL@box =\z@ \e...
l.8 ...n \cite{someref}, there is no banana here.}


! Missing } inserted.
<inserted text>
}
l.8 ...n \cite{someref}, there is no banana here.}


! Missing } inserted.
<inserted text>
}
l.8 ...n \cite{someref}, there is no banana here.}

If I remove the cite packages, everything is back to normal. Unfortunately, I need this package.

The question is really close to this unanswered one. What should I do?

10
  • Not at pc, but does \protect\cite help? Note that the cite package us not required to use \cite, that command is already in the core, so you can probably do without it.
    – daleif
    Jul 10, 2017 at 17:07
  • Now I tested it, \protect is not enough. But removing the cite package is enough. As mentioned, the cite package is not required to use the \cite command
    – daleif
    Jul 11, 2017 at 7:01
  • 1
    Hmm, it does seem to work if you use \noexpand\cite to keep \deleted from expanding too much too early.
    – daleif
    Jul 11, 2017 at 9:34
  • 2
    I don't think that many people uses the package. The main issue is that changes uses ulem to make the strikethrough part. It is well known that this does not always work. Try if \mbox{\cite{...}} works.
    – daleif
    Jul 11, 2017 at 12:44
  • 1
    The ulem manual explicitly mentions \mbox{\cite{....}} as a work around.
    – daleif
    Jul 11, 2017 at 12:55

3 Answers 3

9

As daleif pointed out in comments, the problem is due to the ulem package used to strike deleted changes in the changes package. It is known to behave weirdly for some commends, among them cite.

As indicated in the documentation, you have to wrap your cite in a mbox like this:

As previously observed \deleted{in \mbox{\cite{someref}}, there is no banana here.}

And it works.

A pretty similar problem resolved the same way here.

2

@Neraste said it right. I just found the same issue and I wanted to avoid the \mbox{\cite{someref}} at every reference.... So, based on this, I just used:

\let\oldcitep\citep
\renewcommand{\citep}[1]{\mbox{\oldcitep{#1}}}
\let\oldcitet\citet
\renewcommand{\citet}[1]{\mbox{\oldcitet{#1}}}
\let\oldcite\cite
\renewcommand{\cite}[1]{\mbox{\oldcite{#1}}}

It worked perfectly

-1

\mbox did not work for me.

However, I have a somewhat satisfactory work around the problem of LaTeX crashing when using \cite within \remove or \add track changes commands. The work around just ignores the reference from being displayed.

Here are the commands I used at the top of the latex document:

\usepackage[ignoremode,inline]{trackchanges} % use the "ignoremode" option here

\tcignore{\cite}{1}{0}  % To ignore parenthetical citation (previously used to be \citep)

\tcignore{\citeA}{1}{0} % To ignore in-text citation (previously used to be \citet)

It worked for me.

You must log in to answer this question.

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