0

In Biblatex I can use roman numerals in the pages fiels and in the citation commands. E.g.:

@InBook{id,
author    = {Surname, Name},
title     = {Title},
booktitle = {Book Title},
date      = {2000},
pages     = {x-cx},

}

or:

\footcite[xc]{id}

I'd like to print the pages numbers in small caps. Is it possible somehow?

3

Here's how you can get Roman page numbers in biblatex to appear in small caps.

First we define a macro \mknormrangescromannums that detects if a given number is a Roman numeral and applies additional formatting in that case. The test for Roman numerals is based on the other numeral tests of biblatex (\ifinteger, \ifnumeral, \ifnumerals, ...).

Then we use the <itempostpro> argument of \mknormrange (introduced in biblatex 3.13 [2019-08-17]) to call \mknormrangescromannums on all page numbers.

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

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

\makeatletter
\def\blx@hook@ifromannum{%
  \def\do##1{\uccode`##1=`\%}%
  \do\i\do\v\do\x\do\l\do\c\do\d\do\m
  \do\I\do\V\do\X\do\L\do\C\do\D\do\M}

\protected\def\blx@imc@ifromannumeral{%
  \blx@ifnum\blx@hook@ifromannum}

\blx@regimcs{\ifromannumeral}
\makeatother

\newrobustcmd*{\smallcapsromannums}[1]{%
  \ifromannumeral{#1}
    {\textsc{\lowercase{#1}}}
    {#1}}

\newcommand*{\mknormrangescromannums}{\mknormrange[][\smallcapsromannums]}

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

\begin{filecontents}{\jobname.bib}
@InBook{id,
  author    = {Surname, Name},
  title     = {Title},
  booktitle = {Book Title},
  date      = {2000},
  pages     = {x-cx},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite[xxi]{id}

\autocite[12-45]{id}

\autocite[hello]{id}

\printbibliography
\end{document}

(Surname 2000, p. xxi) with 'xxi' in small caps

2

It is perfectly possible: add this code to your preamble to define the scroman numbering:

\makeatletter
    \def\scroman#1{\expandafter\@scroman\csname c@#1\endcsname}
    \def\@scroman#1{{\scshape\romannumeral #1}}
\makeatother

If needed, we also can define a scosroman numbering, same as the above, except that a number such as xviii (several final is) is printed as xviij, i.e. the final i is replaced with a (smallcaps) j.

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.