9

I want to remove all cites from document.

Document1:

.... 
\renewcommand{\cite}[1]{}
\begin{document}
input{document2}
\end{document}

Document2:

\begin{document}
... bla-bla-bla \cite{Blablaer2012}. Foo bar bar fooed...
\end{document}

And I get

bla-bla-bla .

How can I delete whitespace before? Maybe there is some command like \delprevsymbol?

0

1 Answer 1

14

The command \cite accepts also an optional argument, so you should take care also of that one:

\renewcommand{\cite}[2][]{\unskip\unpenalty}

should work. With \unskip you remove a preceding space, with \unpenalty also the penalty inserted when you write

text~\cite{foo}

(which is a recommended way).

There might be a problem if \cite is at the very start of a paragraph; a safer version might be

\renewcommand{\cite}[2][]{\ifhmode\unskip\unpenalty\fi}
1
  • 2
    +1 I especially like the \ifhmode refinement. May 24, 2013 at 9:57

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.