0

I'm working on my thesis in LaTeX. I'm using the IEEE style for my citations. I've been using \begin{refsection}\end{refsection} to generate a bibliography for each chapter using biblatex and biber.

There is one textbook that I will likely reference in each chapter, but with different page ranges. I could get the desired behavior if in my bib file, I made duplicate entries for Author2000 for each chapter with the correct page numbers, but this seems like the wrong way to do it. I think there's a way to do it using postnotes and redefining the \cite command, but I haven't been able to find an easy way to do this from the forums or from the manual.

Here is an MWE:

\documentclass{report}

\begin{filecontents}{\jobname.bib}

@BOOK{Author2000,
  author = {Some Author},
  title = {Name of a Book},
  year = {2000},
  publisher = {Oxford University Press},
  address = {Oxford},
}
\end{filecontents}

\usepackage[backend=biber,style=ieee]{biblatex}
\addbibresource{\jobname.bib}


\begin{document}
\begin{refsection}
\chapter{Introduction}

{\textbackslash}cite[10]\{Author2000\} produces this: \cite[10]{Author2000}, but I would like something like [1] here. In the bibliography, I would like p. 10 to be appended after the reference in the bibliography.

\printbibliography
\end{refsection}


\chapter{Overview}
\begin{refsection}

{\textbackslash}cite[20-30]\{Author2000\} produces this: \cite[20-30]{Author2000}, but I would like something like [1] here. {\textbackslash}cite[40-50]\{Author2000\} produces this: \cite[40-50]{Author2000}, but I would like something like [1] here. In the bibliography, I would like pp. 20-30, 40-50 to be appended after the reference in the bibliography.

\printbibliography
\end{refsection}
\end{document}

2 Answers 2

1

Here is a solution that collects your postnotes and prints them in the bibliography at the end.

The solution is pretty simplistic. It does not sort your page references and does not attempt to compress them or to remove duplicate pages.

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

\usepackage[backend=biber, style=ieee, autocite=plain]{biblatex}

\makeatletter
\renewbibmacro{postnote}{%
  \iffieldundef{postnote}
    {}
    {\ifcsundef{jwcbx@postnotestorage@\the\value{refsection}%
                @\thefield{entrykey}}
       {\csxdef{jwcbx@postnotestorage@\the\value{refsection}%
                @\thefield{entrykey}}{\expandonce\abx@field@postnote}}
       {\csxappto{jwcbx@postnotestorage@\the\value{refsection}@%
                  \thefield{entrykey}}
                 {, \expandonce\abx@field@postnote}}}}

\newcommand*{\jwcbx@printpostnote}{\printtext[postnote]}
\renewbibmacro*{finentry}{%
  \ifcsundef{jwcbx@postnotestorage@\the\value{refsection}@%
             \thefield{entrykey}}
    {}
    {\expandafter\expandafter\expandafter
     \jwcbx@printpostnote
     \expandafter\expandafter\expandafter{%
       \csname jwcbx@postnotestorage@\the\value{refsection}@%
               \thefield{entrykey}\endcsname}}%
  \finentry
}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
\begin{refsection}
Lorem \autocite[380]{sigfridsson}
ipsum \autocite[381]{sigfridsson}

\printbibliography
\end{refsection}


\begin{refsection}
Lorem \autocite[380]{sigfridsson}

\printbibliography
\end{refsection}
\end{document}
3
  • Thanks! I would have never figured out how to do this on my own. Is there any place you could point me if I wanted to compress the citations or remove duplicate pages? I know how I might run such a program in Python, but I have no idea how to script all this using TeX commands. Commented Mar 8, 2022 at 17:15
  • Also, I'm assuming that the jwcbx stands for "Jonathan Wheeler Citation BibLaTeX?" I tried doing a google search for that pattern, and couldn't find anything useful. Commented Mar 8, 2022 at 17:19
  • @JonathanWheeler I don't think I know anything that does the necessary sorting and compressing in LaTeX, sorry. Sorting is pretty painful in LaTeX (though it got slightly less painful with expl3) and so is separating the field ranges and compressing them. Yeah, the jwcbx@ is just a way to hopefully have unused internal names that clash with nothing else. cbx@ is the standard prefix for biblatex core citation styles. But since this is an extension of the core concepts I went with an "extension" of the name as well.
    – moewe
    Commented Mar 9, 2022 at 16:47
0

As a temporary work around, I got the behavior to sort of work by adding command at the beginning of each chapter that shows the page range for that reference. Here's the MWE. It would be nice if I could find a way to get the postnote of \cite to do this instead of having a custom command \bibnote do it:

% Credit to: https://tex.stackexchange.com/questions/612501/how-to-remove-unwanted-period-in-biblatex-reference-list-after-using-finentry?rq=1
\documentclass{report}

\begin{filecontents}{\jobname.bib}

@BOOK{Author2000,
  author = {Some Author},
  title = {Name of a Book},
  year = {2000},
  publisher = {Oxford University Press},
  address = {Oxford},
}
\end{filecontents}

\usepackage[backend=biber,style=ieee, natbib=true]{biblatex}
\addbibresource{\jobname.bib}


\newcommand{\bibnote}[2]{\csdef{cbx@#1@bibnote}{#2}}
\renewbibmacro*{finentry}{%
  \ifcsundef{cbx@\thefield{entrykey}@bibnote}
    {}
    { {\csuse{cbx@\thefield{entrykey}@bibnote}}}%
  \finentry
}

\begin{document}
\begin{refsection}
\bibnote{Author2000}{p. 10}
\chapter{Introduction}

{\textbackslash}cite[10]\{Author2000\} produces this: \cite[10]{Author2000}.

\printbibliography
\end{refsection}


\chapter{Overview}
\begin{refsection}
\bibnote{Author2000}{pp. 20-30, 40-50}

{\textbackslash}cite\{Author2000\} produces this: \cite{Author2000}. {\textbackslash}cite\{Author2000\} produces this: \cite{Author2000}.

\printbibliography
\end{refsection}
\end{document}

You must log in to answer this question.

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