5

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)

  • 1
    If Mendeley does not export the correct entry type then surely this is something you should let them know. It is much more desirable to get this fixed at the source rather than trying to patch something together that makes sense of a garbled .bib file. – moewe Mar 22 '18 at 13:17
  • What exact procedure did you have in mind to "reclassify" the entry types? You can make it easier for us to test our ideas if you provide a full MWE/MWEB that includes examples of typical entries that get written out as @misc. – moewe Mar 22 '18 at 13:18
  • 1
    Adding to moewe's comment. While you could tell biblatex to treat misc as patent with a sourcemap, if Mendeley does not export the patent number, that would be irretrievable from the point of view of biblatex. – gusbrs Mar 22 '18 at 13:19
  • @moewe I've already been in contact with mendeley about other issues. They note it as "feature request" and it may be fixed in the next release. In the mean time, I have a deadline ;) Exporting of ".bib" doesn't seem a main feature of Mendeley desktop. They focus on the MS Word integration... There's no option to select between export for Bibtex of Biblatex in Mendelay. – JHBonarius Mar 22 '18 at 13:38
  • 1
    I'll look into this, but frankly I'm not keen on making up lots test entries myself. You can speed up the whole process by showing us some entries you want to have converted - after all you already have these entries and don't need to make them up. – moewe Mar 22 '18 at 13:49
6
\DeclareStyleSourcemap{
  \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.


\DeclareStyleSourcemap{
  \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.

  • HAha, great. I'm laughing at my biblatex.cfg, which if becoming huge just because of this stupid journal with its non-standard citation requirements. – JHBonarius Mar 22 '18 at 15:52
  • 1
    @JHBonarius Oh, if you are planning to submit this to a journal, double check they accept biblatex submissions: tex.stackexchange.com/q/12175/35864 – moewe Mar 22 '18 at 16:01

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.