# biblatex-verbose: edition as superscript in front of year

I’m using biblatex and Biber, and modifying the verbose style. I’m having trouble with the placement and formatting of the edition: The edition should appear immediately in front of the year, without any “rd”, “th” etc., and without a space in between edition and year.

I’ve been trying to fix this for a good while and I can post one or two MWEs of attempted solutions if it should help, but I’m afraid they’d be more confusing than helpful.

Below is an unadulterated MWE to start with. The relevant bibmacros seem to be in standard.bbx.

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@incollection{foo,
author = {A. Author},
title = {Foo},
booktitle = {Book},
location = {North Pole},
date = {2013},
edition = {7},
}
\end{filecontents}

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

\begin{document}

\nocite{foo}

\printbibliography

Should be: North Pole, \textsuperscript{7}2013

\end{document}


You might want to try the following

We redefine the edition format to use the superscript if possible

\DeclareFieldFormat{edition}{%
\ifinteger{#1}
{\textsuperscript{#1}}


Then we let the edition appear before the date.

\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\iflistundef{publisher}
\printlist{publisher}%
\printfield{edition}%
\usebibmacro{date}%
\newunit}


We then delete the superfluous first appearance of the edition field. We use xpatch for that, it's easier than retyping the whole driver entry.

\newcommand{\replaceedition}[1]{%
\xpatchbibdriver{#1}
{\printfield{edition}%
\newunit}
{}%
{}
{\typeout{failed to patch driver #1}}
}
\replaceedition{book}
\replaceedition{collection}
\replaceedition{inbook}
\replaceedition{incollection}
\replaceedition{manual}


The MWE

\documentclass{article}
\begin{filecontents}{\jobname.bib}
@incollection{foo,
author = {A. Author},
title = {Foo},
booktitle = {Book},
location = {North Pole},
date = {2013},
edition = {7},
}
\end{filecontents}

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

\DeclareFieldFormat{edition}{%
\ifinteger{#1}
{\textsuperscript{#1}}

\renewbibmacro*{publisher+location+date}{%
\printlist{location}%
\iflistundef{publisher}
\printlist{publisher}%
\printfield{edition}%
\usebibmacro{date}%
\newunit}

\newcommand{\replaceedition}[1]{%
\xpatchbibdriver{#1}
{\printfield{edition}%
\newunit}
{}%
{}
{\typeout{failed to patch driver #1}}
}
\replaceedition{book}
\replaceedition{collection}
\replaceedition{inbook}
\replaceedition{incollection}
\replaceedition{manual}

\begin{document}
\nocite{foo}
\printbibliography
Should be: North Pole, \textsuperscript{7}2013
\end{document}


gives us

• Excellent! Since I don’t care whether the edition is numerical or not, I can even skip the conditional and put it superscript right away. The xpatch trick is great as well – I wasn’t using xpatch at all, but I really should have, it seems ... :) – doncherry Nov 3 '13 at 0:07
• @doncherry Well, xpatch is a quick way to get rid of superfluous calls to macros in the drivers without copy-and-paste--rewriting them. – moewe Nov 3 '13 at 13:20
• If I compile your MWE with the new \mkbibsuperscript (which I agree seems preferable), there’s a space missing after the comma: Pole,72013. – doncherry Nov 3 '13 at 14:55
• @doncherry Indeed, I missed that, sorry. \mkbibsuperscript is a very thin wrapper for \textsuperscript; one of the things it does though is executing \unspace. So you can either go with \textsuperscript or define \newrobustcmd{\mkbibsuperscriptsp}[1]{% \allowhyphens\textsuperscript{% \begingroup \protected\long\def\mkbibsuperscript##1{% \blx@warning{Nested superscript}% \mkbibbrackets{##1}}% #1\endgroup}} and use that. For now I have reverted the answer to use \textsuperscript again. – moewe Nov 3 '13 at 14:59