4

In BibLaTeX is there any (simple) way to transform

pp. 55-57

into

55-57 orr.

? For example, I know that the prefix pp. can be removed by using:

\DeclareFieldFormat{pages}{#1}

But actually what I need is to change it into orr. and move it to the right, so it appears after the page or page-range. Any ideas?

(In case anyone's interested, 55-57 orr. is the way to put pp. 55-57 in Basque).

lockstep
  • 250,273

1 Answers1

2

If you are sure you always want this behaviour in a particular document - that is you do not switch the language -, the following might be for you.

The following code moves the string for "page" or "pages" after the actual page number by redefining \mkpageprefix.

\makeatletter
\protected\long\def\blx@mkpageprefix#1[#2]#3{%
  \blx@mkpageprefix@i[#2]{#3}%
  \ifnumeral{#3}
    {\ppspace\bibstring{#1}}
    {\ifnumerals{#3}
       {\ppspace\bibstring{#1s}}
       {\def\pno{\bibstring{#1}}%
        \def\ppno{\bibstring{#1s}}}}%
  }
\makeatother

Note that while you normally use \parencite[\pno~7a]{coleridge} to force the page prefix where biblatex would not put one, you now have to use \parencite[7a~\pno]{coleridge} since it is a suffix (easy to remember).

For the example below, I used american as a language and changed the page strings to "orr" for greater effect, but this can be done in any language and you might not even have to change the bibstrings, if the localisation already exists.

\documentclass[a4paper,american]{article}

\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{csquotes}
\usepackage[style=authoryear,backend=biber]{biblatex}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\DefineBibliographyStrings{american}{%
  page           = {orr\adddot},
  pages          = {orrs\adddot},
}

\makeatletter
\protected\long\def\blx@mkpageprefix#1[#2]#3{%
  \blx@mkpageprefix@i[#2]{#3}%
  \ifnumeral{#3}
    {\ppspace\bibstring{#1}}
    {\ifnumerals{#3}
       {\ppspace\bibstring{#1s}}
       {\def\pno{\bibstring{#1}}%
        \def\ppno{\bibstring{#1s}}}}%
  }
\makeatother

\begin{document}
\parencite[5]{westfahl:space}
\parencite[7]{coleridge}
\parencite[7a~\pno]{coleridge}
\cite[6]{companion} and \cite[6--78]{companion}

\printbibliography
\end{document} 

yields enter image description here

Note that the solution here is not the best possible one, so if this feature is important to you - and you might need page prefixes at one time and suffixes at another for multilingual documents - you might want to ask the biblatex maintainers to include a feature to switch pre-/suffix depending on the language.

edit Something similar was implemented for the Hungarian localisation in the upcoming biblatex version, see https://github.com/plk/biblatex/issues/717 and https://github.com/plk/biblatex/pull/780 in particular https://github.com/plk/biblatex/blob/76d610388104a7402383e162e29e6f2c69159095/tex/latex/biblatex/lbx/magyar.lbx#L110-L137

moewe
  • 175,683