The source below, along with the biblatex.cfg
shown, produces this bibliography that includes backrefs:
Even without any backrefs, each item in the printed bibliography ends with a period.
How can do the following…
- move the final period so as to go before the backref?
- insert a period after each backref's closing parenthesis?
- change each backref's parentheses to square brackets?
… so that the bibliography will look like this:
The source:
% File backref.tex
\begin{filecontents}{testbib.bib}
@article{article,
author = {Author, An},
title = {An article},
journal = {Articles},
volume = {1}, pages = {1--2}, year = {2021},
}
@book{book,
author = {Writer, Some},
title = {A Book},
publisher = {Publisher}, address = {London},
year = {2021},
}
\end{filecontents}
\begin{filecontents}{backref.lbx}
\ProvidesFile{backref.lbx}
% Added after original MWE post...
% ... included in actual book-length doc:
\InheritBibliographyExtras{english}
\DeclareBibliographyExtras{%
\protected\def\mkbibordinal#1{%
\begingroup%
\@tempcnta0#1\relax\number\@tempcnta%%
\endgroup}%
\protected\def\mkbibmascord{\mkbibordinal}%
\protected\def\mkbibfemord{\mkbibordinal}%
}
\DeclareBibliographyStrings{%
inherit = {english},
urlseen = {{accessed}{accessed}},
}
\end{filecontents}
\documentclass{article}
\RequirePackage[citestyle=numeric,backref=true]{biblatex}
\RequireBibliographyStyle{standard}
\RequireBibliographyStyle{numeric}
\DefineBibliographyStrings{english}{
backrefpage = {Cited on page},
backrefpages = {Cited on pages},
}
\addbibresource{testbib.bib}
\begin{document}
In \textcite{article} and \textcite{book}\dots
\printbibliography
\end{document}
The biblatex config file [corrected]:
% BIBLATEX.CFG - mimic amsplain
\ProvidesFile{biblatex.cfg}
\DeclareNameAlias{sortname}{family-given}
% Punctuation & delimiter mods:
\DeclareLanguageMapping{english}{backref} % external file!
\renewcommand*{\newunitpunct}{\addcomma\space}
\renewcommand{\subtitlepunct}{\addcolon\addspace}
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% Field mods:
\DeclareFieldFormat
[article]
{title}{\mkbibemph{#1}}% no quote marks
\DeclareFieldFormat{journaltitle}{#1}
%
\DeclareFieldFormat
[article]
{volume}{\mkbibbold{#1}}
%
\DeclareFieldFormat{pages}{#1}% no prefix for the `pages` field
% Book mods:
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\setunit*{\addcomma\space}%
\printlist{location}%
\setunit*{\addcomma\space}%
\usebibmacro{date}%
\newunit}
% Article mods:
\DeclareFieldFormat[article,periodical]{number}{\bibstring{number}~#1}% number of a journal
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\setunit*{\addspace}%
\iffieldundef{series}
{}
{\newunit
\printfield{series}%
\setunit{\addspace}}%
\printfield{volume}%
\setunit{\addspace}%
\usebibmacro{issue+date}%
\setunit{\addcomma\space}%
\printfield{number}%
\setunit{\addcolon\space}%
\usebibmacro{issue}%
\setunit{\addcomma\space}%
\printfield{eid}
\newunit}
Best Answer
The punctuation directly before the backref is controlled by
\bibpagerefpunct
, which we can redefine to print the\finentrypunct
(plus a space). Then we just need to make sure that after the backref is printed, no further\finentrypunct
is inserted, so we reset its definition in thepageref
bibmacro. We also change the brackets via the field format used inpageref
. (The original definition of that macro can be found inbiblatex.def
, ll. 2934-2941 in v3.16.)