[Tex/LaTex] Mendeley and Biblatex: how to interpret ‘misc’ as ‘patent’ or ‘online’

biblatexmendeley

I have a large number of sources and I find Mandeley a very useful tool to generate the .bib file. However, Mendeley does not support the extra capabilities of biblatex. While you can classify documents as "patent" or "web page" in Mendeley, it will all be exported as "misc". e.g.

Web page:

@misc{Label1,
abstract = {...},
author = {...},
file = {:...:pdf},
institution = {...},
title = {{...}},
url = {http://....pdf},
year = {...}
}

Patent: (Note stupid Mendeley does not export the patent number, while it's specified)

@misc{Label2,
abstract = {....},
author = {...},
file = {:...:pdf},
institution = {...},
title = {{...}},
year = {...}
}

Seeing the capabilities of biblatex, is there a way to re-interpret the entry type? Something like:

\DeclareStyleSourcemap{%
    \maps[datatype=bibtex, overwrite=true]{%
        \map{%
            \pertype{misc}%
            \step[entrynewtype=patent]%
            \step[fieldsource=url, final]%
            \step[entrynewtype=online]
        }%
    }%
}

But this code doesn't seem to work…

Consider this example:

\documentclass{article}
\usepackage[style=science,article-title=true]{biblatex}
%\usepackage{csquotes}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{Johannes2007,
    author = {Johannes, Michael S. and Polson, Nick},
    title = {{Particle Filtering and Parameter Learning}},
    url = {http://www.ssrn.com/abstract=983646},
    month = {10},
    year = {2007}
}

@misc{Pronk2013,
    author = {Pronk, Serverius Petrus Paulus and Musch, Guido Josef and Maass, Henning and Aubert, Xavier Louis Marie Antoine and Most, Else Inger Stapel},
    institution = {Koninklijke Philips N.V.},
    number = {{WO 2013/132454 A1}},
    title = {{Generating a circadian time difference}},
    year = {2013}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
Text \cite{Pronk2013} More Text \cite{Johannes2007}
\printbibliography
\end{document}

Will show

enter image description here

While changing it to types online and patent will show

enter image description here

Especially significant is that the latter only shows the all-important patent number.

(However, in the latter case, I'm missing the title of the patent, and the date of the online document… sigh)

Best Answer

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite=true]{
    \map{
      \step[fieldsource=url, final]
      \step[typesource=misc, typetarget=online]
    }
    \map{
      \step[typesource=misc, typetarget=patent, final]
      \step[fieldsource=institution, final]
      \step[fieldset=holder, origfieldval]
    }
  }
}

Converts all @miscs with URLs to @online and all other @miscs to @patent. Additionally the institution field is copied over to holder, since @patent does not recognise the institution field.

biblatex-science does not print the holder or institution field, so the last mapping step, while conceptually nice, does not really cause any difference in output in your specific example.


\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite=true]{
    \map{
      \step[typesource=misc, typetarget=patent, final]
      \step[fieldsource=url, final]
      \step[typesource=patent, typetarget=online]
    }
  }
}

Would be slightly closer to your suggestion. If you want to change the entry type, you need typesource and typetarget. That means we can do away with \pertype if we add final to the first step. The first step converts all @miscs to @patent. The second step filters all @patents with URLs and converts those to @online. With your set-up this should be equivalent to the the other suggestion.


edit Switched to user-level command \DeclareSourcemap. \DeclareStyleSourcemap should only be used in styles (.bbx or .cbx files).

Related Question