10

I've used some tips about how to toy with the format of backrefs in biblatex, and I'm seeing that the formatting is quite flexible. In the screenshot below, I've put the backref into a box. That's fun, but I'd like the backref to appear after the period, i.e., after the entire citation, like this:

  1. M. Nowak, Science 314, 1560-1563 (2006). See p. 1

Not like this:

Box is before the period...

MWE:

\documentclass{article}
\usepackage{filecontents}
\usepackage[natbib=true,
            hyperref=true,
            url=false,
            style=science,
            sorting=nyt,
            autocite=superscript,
            isbn=false,
            backref=true,
            maxcitenames=3,
            maxbibnames=100,
            block=none]{biblatex}

\DefineBibliographyStrings{english}{%
    backrefpage  = {See p.}, % for single page number
    backrefpages = {See pp.} % for multiple page numbers
}

\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\printtext{%
  \fbox{
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
     {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}
  }}}}

\usepackage{hyperref}

\begin{filecontents}{references.bib}
@article{nowak2006five,
  title={Five rules for the evolution of cooperation},
  author={Nowak, M.A.},
  journal={Science},
  volume={314},
  number={5805},
  pages={1560--1563},
  year={2006},
  publisher={American Association for the Advancement of Science}
}
\end{filecontents}

\bibliography{references.bib}

\begin{document}
Evolutionary games.\supercite{nowak2006five}
\printbibliography
\end{document}

Update I've tried the fix from Guido in the accepted answer below -- it works with my MWE, but introduces another problem when there is more than one bibliography entry (see MNWE). I expect it just needs minor changes...

No period, but an extra comma

6

EDITED ANSWER AFTER COMMENTS

The period at the end of a reference is inserted by the bibmacro finentry, which is the last instruction of standard biblatex entry drivers. One of the thing finenty does is to print the final period using \finentrypunct.

Thus to avoid to print the period at the end one has to redefine it:

\renewbibmacro*{finentry}{\iflistundef{pageref}{}{\renewcommand{\finentrypunct}{}}\finentry}

With this definition, it redefines \finentrypoint to be empty if there is back reference (pageref).

The next step is to print a period before the back reference. To this end the definition of the pageref bibmacro has to include such an instruction, \setunit{\adddot\addspace}, at the beginning of false clause of the \iflistundef{pageref}.

\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\setunit{\adddot\addspace}\printtext{%
  \fbox{
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
     {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}
  }}}}

enter image description here

4
  • thanks, that solves the problem when there's one bibitem, but with more, it introduces another problem. I've posted a screenshot and MNWE in the question above, further help would be awesome! -J – Joe Corneli May 9 '13 at 14:54
  • \renewcommand{\finentrypunct}{} seems to do a better job of avoiding the period at the end without causing any chaos, see khirevich.com/latex/biblatex – Joe Corneli May 9 '13 at 15:26
  • @JoeCorneli Redefining \finentrypunct is indeed the way to go; \finentry does more than just print \finentrypunct and it should be executed at the end of every bibliography entry. – Audrey May 9 '13 at 15:47
  • Just redefining \finetrypunct leave entries without pageref with no final period. – Guido May 9 '13 at 21:10

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.