3

Considering the following MWE I am searching for a possibility to change the format of the backreference.

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{companion,
  author={Frank Mittelbach and Michel Goossens},
  title={The \LaTeX{} Companion},
  year={2008},
  publisher={Addison-Wesley},
  isbn={0-201-36299-6},
}
\end{filecontents*}
\documentclass{scrartcl}
\usepackage{polyglossia}
\setdefaultlanguage[variant=us]{english}
\usepackage{blindtext}
\usepackage[backend=biber,hyperref,backref,backrefstyle=none]{biblatex}
\DefineBibliographyStrings{english}{%
  backrefpage = {\lowercase{s}ee p.},%
  backrefpages = {\lowercase{s}ee pp.}%
}
\bibliography{\jobname.bib}
\usepackage{hyperref}
\begin{document}
\blindtext
\cite{companion}
\printbibliography
\end{document}

This gives me the output (I am running it with lualatex but that should not be a problem) Screenshot of the compiled pdf version of the MWE

I am now searching for a possibility to change the format of the backreference in the bibliography (the (see p. 1). I thought of changing its color or printing it in an italic font. Is there a simple way to achieve this?

6

Curiously I answered something very similar just yesterday

\DeclareFieldFormat{pagerefformat}{\mkbibparens{{\color{red}\mkbibemph{#1}}}}
\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\printtext[pagerefformat]{%
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
         {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}}}}

Now you can use pagerefformat to style the output to your liking. Here we wrap the pageref info in parentheses and print it in red italics.

MWE

\documentclass{scrartcl}
\usepackage[backend=biber,hyperref,backref,backrefstyle=none]{biblatex}
\DefineBibliographyStrings{english}{%
  backrefpage = {see p\adddot},%
  backrefpages = {see pp\adddot}%
}
\addbibresource{biblatex-examples.bib}
\usepackage{xcolor}
\usepackage{hyperref}

\DeclareFieldFormat{pagerefformat}{\mkbibparens{{\color{red}\mkbibemph{#1}}}}
\renewbibmacro*{pageref}{%
  \iflistundef{pageref}
    {}
    {\printtext[pagerefformat]{%
       \ifnumgreater{\value{pageref}}{1}
         {\bibstring{backrefpages}\ppspace}
         {\bibstring{backrefpage}\ppspace}%
       \printlist[pageref][-\value{listtotal}]{pageref}}}}

\begin{document}
Lorem
\cite{companion}
\printbibliography
\end{document}

example output

1
  • 1
    That's exactly what I was searching for. When changing the order of the commands \mkbibparens{{\color{red}\mkbibemph{#1}}} to {\color{red}\mkbibparens{\mkbibemph{#1}}} I was also able to have the brackets colored. Thank you for your quick answer. Oct 10 '15 at 11:44

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.