# multibib custom prefixed number for second biblio

Envornment: macOS 10.13.4, Full 2018 MacTeX distro, TeXworks v0.6.2.

My MWE

% arara: pdflatex
% arara: bibtex: { files: [ mbib, web ] }
% arara: pdflatex
% arara: pdflatex

\RequirePackage{filecontents}

\begin{filecontents}{biblio.bib}
@incollection{Akallabeth,
author       = "Tolkien, John Ronald Reuel",
title        = "Akallabeth---The Downfall of Numenor",
year         = 2014,
editor       = "Tolkien, Christopher",
booktitle    = "The Silmarillion",
publisher    = "Mariner Books",
address      = "New York, USA",
tags         = "MasterThesis",
}
\end{filecontents}

\begin{filecontents}{web.bib}
@misc{wikiicd10,
author       = "Wikipedia",
title        = "{ICD-10}",
year         = 2015,
url          = "https://en.wikipedia.org/wiki/ICD-10",
tags         = "master",
}
\end{filecontents}

\documentclass[a4paper,12pt,titlepage,twoside,openright,fleqn]{book}
\usepackage[italian,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{url}
\usepackage[colorlinks,allcolors=blue]{hyperref}
\usepackage{bookmark}

\usepackage[numbers,square,sort&compress]{natbib}
\usepackage[resetlabels]{multibib}
\newcites{web}{Useful websites}

\begin{document}
\tableofcontents

\bigskip
\hrule
\bigskip\noindent
% Generate two citation callouts
\citet{Akallabeth},
\citeweb{wikiicd10}

\cleardoublepage

\addcontentsline{toc}{chapter}{\bibname}
\bibliographystyle{plainnat}
\bibliography{biblio}

\cleardoublepage
\addcontentsline{toc}{chapter}{Useful websites}
\bibliographystyleweb{unsrtnat}
\bibliographyweb{web}

\end{document}


This works, except that I want the second biblio (which is all Web URLs) to use a letter prefix. IOW, a rendered citation like "...as described [W1]..." with the linked reference numbered 'W1' instead of the more normal '1'.

I've looked at Natbib-Multibib problem with prefix labels and Citation is not using the custom prefix defined by multibib, both of which make me think this may not be possible. I'm actually using ACMstyling (via ACM-Reference-Format.bst) although the linked article make me think this is a natbib/multibib issues.

I'm using arara to compile multiple bibtex passes via TexWorks as each call needs a different target bib file.

Now I've got arara working, I'm happy to try using biblatex/biber if it will give me the output required, although I guess I'll have to write all the styles myself as ACM's style docs aren't Biblatex compatible yet (as at June 2018).

• Note entirely sure why this was downvoted. It seems a perfectly clear question with a very usable MWE and prior research. – moewe Jun 21 '18 at 7:39

## 1 Answer

With biblatex it is not too hard to split the bibliography in two. You don't even need to use two separate .bib files (though you can).

Here, we use the two .bib files to add the keyword web to all sources from \jobname-web.bib (see biblatex: multiple bibliographies categorised by different .bib files). You can cite all sources as usual, but the bibliography is split when we filter by keyword. To get the prefix for the Web bibliography we need \newrefcontext[labelprefix=W] (see Separate bibliographies for phdthesis and mastersthesis in biblatex).

You'll need to be running Biber instead of BibTeX here, Biblatex with Biber: Configuring my editor to avoid undefined citations (of course arara can do that for you as well).

\RequirePackage{filecontents}

\begin{filecontents}{\jobname.bib}
@incollection{Akallabeth,
author       = "Tolkien, John Ronald Reuel",
title        = "Akallabeth---The Downfall of Numenor",
year         = 2014,
editor       = "Tolkien, Christopher",
booktitle    = "The Silmarillion",
publisher    = "Mariner Books",
address      = "New York, USA",
tags         = "MasterThesis",
}
\end{filecontents}

\begin{filecontents}{\jobname-web.bib}
@misc{wikiicd10,
author       = "Wikipedia",
title        = "{ICD-10}",
year         = 2015,
url          = "https://en.wikipedia.org/wiki/ICD-10",
tags         = "master",
}
\end{filecontents}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[italian,english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage[backend=biber, style=numeric, sorting=none, defernumbers]{biblatex}

\addbibresource{\jobname.bib}
\addbibresource{\jobname-web.bib}

\DeclareSourcemap{
\maps[datatype=bibtex, overwrite]{
\map{
\perdatasource{\jobname-web.bib}
\step[fieldset=keywords, fieldvalue=web, append]
}
}
}

\begin{document}
\cite{Akallabeth} and
\cite{wikiicd10}

\printbibliography[notkeyword=web]
\newrefcontext[labelprefix=W]
\printbibliography[keyword=web, title={Web references}]
\end{document}


Since you mention the ACM in your question, I must point out that only very few (if at all, really) publishers can accept biblatex submissions. Often the internal workflow of publishers can't really deal with how different biblatex bibliographies are to BibTeX bibliographies (one difference being that BibTeX bibliographies are essentially pre-generated ready-to-typeset LaTeX source with only the usual \emph, ... markup; while biblatex generates the bibliography output on the fly from a raw data format). See Biblatex: submitting to a journal. If you only need to submit a PDF you are in the clear. But don't ignore the submission guidelines when they ask for BibTeX and double check if they can accept biblatex. If you template pre-loads natbib I see little chance of your submission using biblatex.

• Thanks! This works. Based on using your MWE, it seems I don't need arara as biber seems to do both biblios in one pass. Point taken about ACM, but this is my PhD thesis so I get to choose. Still, as biblatex has no defined ACM style I guess I'll need to code those myself or use another style format. – mwra Jun 21 '18 at 7:23
• @mwra Indeed, Biber usually only requires one pass on one file (in weird situations you may need one more pass after LaTeX was run, but that normally only happens if a citation causes another citation - you'll be notified if that is the case in the .log file). Of course arara is still a useful tool. biblatex does not have as many pre-defined styles available as BibTeX since it is younger and some things are so easily changed that a full style is not called for. For many intents and purposes the standard styles and a few modifications already give good results. – moewe Jun 21 '18 at 7:37
• One small question - what does the \DeclareSourcemap{} section of code do? If I try removing it the code still seems to work? – mwra Jun 21 '18 at 17:33
• @mwra It adds the web keyword to the entries in the web .bib file. This is necessary if your entries don't have the web keyword already. Note that the code is for Biber, so you will only see the effect of its removal after a full LaTeX, Biber, LaTeX, LaTeX circle. – moewe Jun 21 '18 at 18:02