2

I'm looking for a command in LaTeX that overwrites or removes the previous characters which were automatically created by a package I use.


I'm using the jurabib package for my citations. For example with this command:

\cite[Pages 3-5]{key}

It has an option to automatically create a comma before the page range (commabeforerest). Which is what I need for most citations. This would look like:

Author, Title, Pages 1-3.

There is one cite where I do not need the comma. So I want to know if there is a way to overwrite the previous two characters (the automatically created space and comma), so I could use something like this command for my special cite:

\cite[\OverwritePreviousChars{2} Pages 4-6]{key}

Which would create this:

Author, Title Pages 4-6.
David Carlisle
  • 757,742
jeps44
  • 55
  • 4
    not really possible once you have typeset the comma. You could try to overprint a white coloured box but really it would be better to parameter the macros not to add the comma. – David Carlisle Jan 30 '17 at 18:44
  • 2
    as always it would be much easier for people to answer if you edited the question to provide a small test file that typesets a citation with an unwanted comma – David Carlisle Jan 30 '17 at 18:59
  • Welcome to TeX.SE! Please take a moment to take our Tour! You may also want to look at what makes a good Minimal Working Example (MWE) – Tavrock Jan 31 '17 at 17:09

2 Answers2

7

You can reset the switch used by commebeforerest. But it is naturally much easier to simply type the Pages info after the \cite.

\documentclass{article}
\usepackage{jurabib}
\bibliographystyle{jurabib}
\jurabibsetup{ commabeforerest,}

\begin{document}
\cite[Pages 3-5]{doody}

{\makeatletter\jb@comma@before@restfalse\makeatother 
\cite[Pages 3-5]{doody}}

\cite{doody} Pages 3-5

\bibliography{biblatex-examples}
\end{document}

enter image description here

Ulrike Fischer
  • 327,261
5

I don't have the reputation to comment, so instead I post as an answer. In LuaTeX you can indeed remove the previous character that TeX has seen! Hans talked about it in this article, funnily enough for the same purpose of handling bibliographical bits and bobs.

9tTn9B
  • 830
  • 1
  • 6
  • 10