3

I am using biblatex and I would like to replace the "url:" with "<" and ">" in my references section.

\usepackage[style=authoryear, backend=biber]{biblatex}
\addbibresource{mybib.bib}

\DeclareFieldFormat{url}{\bibstring{<}\url{#1}\bibstring{>}}

The \DeclareFieldFormat replacement appears to do what I want, but I cannot work out the correct way to insert the "<" and ">" in the replacement string.

How do I define less than and greater symbols in the \DeclareFieldFormat command?

moewe
  • 175,683

1 Answers1

2

You only need \bibstring if you want to print a localisation string defined by \NewBibliographyString/\DefineBibliographyStrings/the .lbx files. Otherwise you can just insert the characters directly in a \DeclareFieldFormat directive, though I think it would be slightly nicer to us a macro

\newcommand*{\mkbiburlangle}[1]{<#1>}
% choose for example
%    {<#1>}
% or {\ensuremath{\langle}#1\ensuremath{\rangle}}
% or {\guilsinglleft#1\guilsinglright}

\DeclareFieldFormat{url}{\mkbiburlangle{\url{#1}}}

For example

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

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


\newcommand*{\mkbiburlangle}[1]{<#1>}
\DeclareFieldFormat{url}{\mkbiburlangle{\url{#1}}}

\addbibresource{biblatex-examples.bib}


\begin{document}
\cite{ctan}
\printbibliography
\end{document}

CTAN (2006). CTAN. The Comprehensive TeX Archive Network. <http://www.ctan.org> (visited on 01/10/2006).

moewe
  • 175,683