1

My advisor requires page number in in-text citations, consider the following MWE and its output:

\documentclass{article}
\begin{filecontents}{references.bib}
  @article{einstein,
      author =       "Albert Einstein",
      year =         "1905"
  }
  @article{shakespeare,
      author =       "Shakespeare",
      year =         "1603"
  }
\end{filecontents}
\usepackage[style=authoryear]{biblatex}
  \bibliography{references}

\begin{document}
  Hello! \parencites[893]{einstein}[79]{shakespeare}
\end{document}

Currently:
Citations with page numbers

My question:
Is there an option or some way to get a PDF such that no page numbers appear in the result? Removing them from the actual source code would be destructive and also a rather large effort.

Desired result:
Desired citation without page number
But without actually changing my \textcite and \parencite commands.

2

I completely agree with your advisor that page numbers in citations are a good things. So unless there are very good reasons to remove them, I would not do that.

That said, here is a fairly simple method that removes prenotes and postnotes from all citation commands using the standard \AtEveryCitekey-\clearfield trick (cf. Guidelines for customizing biblatex styles, Disable ISSN but keep ISBN with biblatex, Disable month in biblatex bibliography? normally I prefer other methods over \clearfield, see e.g. How to omit address field while using biblatex, but here \clearfield is the only method of those that works, since postnote and prenote are virtual fields).

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber, style=authoryear]{biblatex}

\AtEveryCitekey{%
  \clearfield{prenote}%
  \clearfield{postnote}%
}

\addbibresource{biblatex-examples.bib}

\begin{document}
Lorem \autocite[379]{sigfridsson}

ipsum \autocites[380]{sigfridsson}[24]{nussbaum}{geer}[21]{worman}

\printbibliography
\end{document}

Lorem (Sigfridsson and Ryde 1998)

1
  • I was on the lookout for a simple solution like this. And it works amazingly, thank you. I agree that page numbers can be incredibly useful when reviewing, it's just that I prefer having an easy option to turn them on and off. Feels like it could almost be a normal option available during \usepackage{biblatex}.
    – taihao
    Feb 23 at 23:39
1

Store the old \parencite and redefine it to ignore any optional arguments:

enter image description here

\documentclass{article}

\begin{filecontents*}[overwrite]{references.bib}
@article{einstein,
  author = {Albert Einstein},
  year   = {1905}
}
\end{filecontents*}

\usepackage[style=authoryear]{biblatex}
\addbibresource{references.bib}

\NewCommandCopy\oldparencite\parencite% Copy \parencite into \oldparencite
\DeclareDocumentCommand{\parencite}{o m}{\oldparencite{#2}}

\begin{document}

Hello! \parencite[893]{einstein}

\end{document}

The above requires an up-to-date LaTeX (post Oct 2020). If you don't have that, add xparse or use

\let\oldparencite\parencite% Copy \parencite into \oldparencite
\renewcommand{\parencite}[2][]{\oldparencite{#2}}

A more general approach would be to tap into the inner workings of biblatex:

\makeatletter
\DeclareRobustCommand{\blx@cite@parencite}[4]{%
  \begingroup
  \blx@citeinit
  \mkbibparens{%
    \blxciteicmd{parencite}{#1}{}{#3}{}%
  }#4%
  \endgroup
}
\DeclareRobustCommand{\blx@cite@textcite}[4]{%
  \begingroup
  \blx@citeinit
    \blxciteicmd{textcite}{#1}{}{#3}{}%
  \endgroup
}
\patchcmd{\blx@multicite@add}{#2}{}
\makeatother

The above commands update \parencite, \parencites, \textcite, and \textcites to ignore their second arguments - the optional argument.

4
  • This seems to work well. Can you elaborate on the meaning of o m? How would I proceed with redefining \parencites[56]{article1}[768]{book2}[9]{paper3}? I can follow your alternative code (with \let and \renewcommand), however I reckon this problem becomes much more difficult with \parencites taking a variable amount of parameters
    – taihao
    Feb 23 at 0:05
  • @taihao: Correct. My solution just works with \parencite, not \parencites. o and m refer to optional and mandatory argument within the xparse syntax, so o m is similar to [2][] when using \newcommand. I guess a better approach might be to tap into the biblatex internals and ignore the optional argument rather than to circumvent it the way I do.
    – Werner
    Feb 23 at 0:16
  • @taihao: I've added something to the bottom of my answer. Please review whether it suits your needs regarding \parencite and \parencites.
    – Werner
    Feb 23 at 0:52
  • It works like a charm, thank you. I will update my question to reflect this usecase.
    – taihao
    Feb 23 at 1:22

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.