biblatex: Chicago-style page ranges

Here's a summary of the abbreviation rules described in The Chicago Manual of Style (16th edition, section 9.60).

  1. If the first number in the page range less is than 100: No compression (e.g. 3–10, 71–72, 96–117)
  2. Otherwise if the first number is divisible by 100: No compression (e.g. 100–104, 1100–1113)
  3. Otherwise if the second last digit in the first number is zero: Full compression (e.g. 101–8, 808–33, 1103–4)
  4. Otherwise: Compression down to at least two digits (e.g. 321–28, 498–532, 1087–89, 1496–500, 11564–615, 12991–3001)

Based on the counters discussed in a previous answer the following values address rules 1 and 4.

\setcounter{mincomprange}{100}    % Compress when first number is > 100...
\setcounter{maxcomprange}{100000} %   and has no more digits than 100000 (essentially > 100)
\setcounter{mincompwidth}{10}     % Compress down to two digits

\mkcomprange suppresses leading zeros in the second number. This takes care of rule 3. Rule 2 can be handled by editing some biblatex internals. This is demonstrated with the document below.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}

\DeclareFieldFormat{postnote}{\mkcomprange[{\mkpageprefix[pagination]}]{#1}}
\DeclareFieldFormat{pages}{\mkcomprange{#1}}

\setcounter{mincomprange}{100}
\setcounter{maxcomprange}{100000}
\setcounter{mincompwidth}{10}

\makeatletter
\patchcmd{\blx@comprange@check}
  {\blx@comprange@comp{#1}{#2}}
  {\blx@tempcnta=#1
   \divide\blx@tempcnta100
   \multiply\blx@tempcnta100
   \ifnumequal{\blx@tempcnta}{#1}
     {\blx@range@out@value{#1\bibrangedash#2}}
     {\blx@comprange@comp{#1}{#2}}}
  {}{}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
\noindent
\cites[3--10,71--72,96--117]{cms}{salam} \\
\cite[100--104,1100--1113,2900--2913]{cms} \\
\cite[101--108,808--833,1103--1104]{cms} \\
\cite[321--328,498--532,1087--1089,1496--1500,11564--11615,12991--13001]{cms}
\printbibliography
\end{document}

enter image description here


I'm not familiar with the Cicago Manual of Style. To compress a page range like "321--328" to "321--28" in the bibliography while retaining the page prefix, you have to change the format of the pages field as follows:

\documentclass{article}

\usepackage{biblatex}

\DeclareFieldFormat[article,incollection]{pages}%
    {\mkcomprange[{\mkpageprefix[bookpagination]}]{#1}}
\setcounter{mincompwidth}{10}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{Bli74,
  author = {Blinder, Alan S.},
  year = {1974},
  title = {The economics of brushing teeth},
  journaltitle = {Journal of Political Economy},
  volume = {82},
  number = {4},
  pages = {887--891},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

enter image description here