# Cite a chapter not a page of a book

I'm trying to cite to a chapter of a in the .bib file specified book. How could I change my own cite style to change the default "p. 10" to a "ch. 10" (I only have to cite chapters)?

MWE:

\documentclass[
fleqn,
fontsize=11pt,
paper=a4,
bibliography=totoc,listof=totoc,BCOR=25mm,
english,
DIV = 12
]{scrreprt}
\usepackage[english]{babel}
\usepackage[style=alphabetic, autocite=footnote]{biblatex}
\usepackage[babel]{csquotes}

\DeclareCiteCommand{\mycite}[\mkbibfootnote]
{\usebibmacro{prenote}}
{\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}
\printtext[labelalphawidth]{%
\printfield{labelprefix}%
\printfield{labelalpha}%
\printfield{extraalpha}}%
}
{\multicitedelim}
{\usebibmacro{postnote}}

\usepackage{filecontents}
\begin{filecontents}{mybib.bib}
@online{test,
url = {http://test.test},
urldate = {2018-12-15},
title = {Test Bib},
label = {TB}
}
\end{filecontents}

\bibliography{mybib}
\begin{document}
This is the first example\mycite[10]{test}.\\

\printbibliography
\end{document}


For compiling I'm using LuaLaTex,

Best, cortesis

• You can put anything in the postnote. So one option is just to use \mycite[ch.~10]{test} – David Purton Dec 19 '18 at 9:37
• If this particular book is cited with chapters all the time, you may want to add pagination = {chapter}, to the bib entry to automate this, so you can just type \cite[10]{foo} to get "ch. 10". – moewe Dec 19 '18 at 9:38
• @moewe Or you could define a new command to cite with a chapter if you want to alternate between citing with a chapter and citing with a page. – Karlo Dec 19 '18 at 9:43
• @moewe this is the solution to what I was trying, thanks. If you could post it as an answer, I would be pleased – cortesis Dec 19 '18 at 9:47
• Another option is to use a source map to set the pagination to chapter for the entries you will cite with a chapter. – David Purton Dec 19 '18 at 9:52

The pagination field can be used to change the pagination type of an entry. You can try

@online{test,
url        = {http://test.test},
urldate    = {2018-12-15},
title      = {Test Bib},
label      = {TB},
pagination = {chapter},
}


to obtain

from \mycite[10]{test} if you want to cite test with chapters all (or at least most of) the time.

For one-off changes, you can just write

\cite[chap.~10]{sigfridsson}


If you want to change the default pagination from page to chapter, you can either redefine the internal command \blx@imc@mkpageprefix

\makeatletter
\renewrobustcmd*{\blx@imc@mkpageprefix}[1][pagination]{%
\begingroup
\def\blx@tempa{\blx@mkpageprefix{chapter}}%
\iffieldundef{#1}
{}
{\iffieldequalstr{#1}{none}
{\def\blx@tempa{\blx@mkpageprefix@i}}
{\iffieldbibstring{#1}
{\edef\blx@tempa{\blx@mkpageprefix{\thefield{#1}}}}
{\blx@warning@entry{%
Unknown pagination type '\strfield{#1}'}}}}%
\@ifnextchar[%]
{\blx@tempa}
{\blx@tempa[\@firstofone]}}
\makeatother


or set up a Biber sourcemap to add pagination = {chapter}, to all entries without an explicit pagination field.

\DeclareSourcemap{
\maps[datatype=bibtex, overwrite=false]{
\map{
\step[fieldset=pagination, fieldvalue={chapter}]
}
}
}


There is a similar field called bookpagination for the prefixes/suffixes of the pages and pagetotal fields in the bibliography.

• One learns something everyday. I didn't know that. – gusbrs Dec 19 '18 at 10:05
• In the case of changing the defaults, perhaps mentioning the postnote formatting directive might be another nice third idea. – gusbrs Dec 19 '18 at 10:12
• @gusbrs Mhhh yes, although I don't really have an idea for a redefined postnote format in this instance (at least if I want to retain the workings of the pagination field for all other entries). If you have a nice idea I'd love to hear it though. – moewe Dec 19 '18 at 10:29
• Actually, I had thought of something simple like \DeclareFieldFormat{postnote}{\iffieldint{#1}{\bibstring{chapter}~#1}{#1}}. But, yes, you are right. Simple as it is, it is an inferior solution. – gusbrs Dec 19 '18 at 11:12