[Tex/LaTex] Workflow for managing references


What is your workflow for managing references? How does this workflow scale?

Do you use programs like zotero, mendeley, jabref? What are their pros and cons?

Does it allow easy integration of BibLaTeX or it is BibTeX only?

Best Answer

I use Zotero and I found this workflow works well so far, let me know if you find a better way to get the same job done. The following workflow will provide

automated human-error-proof bibliography citation in LaTeX, or a road map for bibliogrpahy management and citation in PhD thesis

Workflow settings:

The below workflow makes use of Zotero citation manager + biblatex + Biber backend + TexStudio as text editor in order to automate the whole process of bibliography citation in LaTeX, finally, without manual data entry which is prone to human error. Zotero is doing all of the heavy work of capturing citations from the web and nicely tagging them (I prefer all references to be in one folder for one project, so that tagging can be more efficiently utilized to find relevant entries). For differences between different packages and backends in LaTeX, this can be of help. TexStudio is easy to learn, and well documented, feature-full, intuitive, and supports both biblatex and biber, you might want to read this blog for more info. But first, you have to tweak of all these tools in order to get there, and as follows:

Zotero citation manager:

It is a versatile bibliography management tool. You should know how to use Zotero by reading the documentation and tutorials and assuming you have a data bank of all references in this open-source free software, you want now to export these entries into another file of .bib extension to be used by biblatexin LaTeX file. Keep Zotero backup folder at a different path from FireFox default.

  • Download the bibtex-citep.js translator from here

  • Add this file to translators folder of Zotero, to know this path in your platform, open Zotero -> Tools -> Options -> Advanced -> Files and Folders Tab, under Data Directory Locations (from here also you can custom a different path from Firefox to any safe location you like) -> Show Data Directory: this will show you the directory of Zotero if you forget where it is, then add the downloaded file of translator into translators folder

  • Edit bibtex-citep.js file using any text editor of your liking, I use NotePad++ and change two lines only as shown below, this will let you do copy and paste of the citation key only from within Zotero of particular reference(s) into LaTeX document without being surrounded by ad hoc markup strings:

    //Zotero.write((first ? "\\citep{" : ",") + citekey); //original one commented out to be
    Zotero.write(citekey); //replaced by doctorate  
    first = false;  
    //Zotero.write("}"); //original line commented out to be...  
    Zotero.write("");// replaced by doctorate  
  • From Zotero options, go to Export tab and select BibTex-citep from drop down menu of Defualt Output Format, this step just to enable the use of Ctrl+Shift+C shortcut after hacking BibTex-citep translator, no more. The export format will be, according to the update below, in the more elegant biblatex format.

Zotero (version 4.0.17) has updated the export list and thankfully included the BibLaTex format (see image below). This means that the way to the big moment was greatly shortened, and you can happily skip all of the above steps.
enter image description here

  • Now, here is the big moment, every time you want to cite a reference, all what you have to do, is to select that/those reference(s) and copy from within Zotero into the clipboard by pressing Ctrl+Shift+C and paste that into your LaTeX document in the text editor of your like, this will auto-magically generate the citation key which is unique to each data entry, do not waste your time generating your own, you will forget many of them after a while, let the keys be generated in silico, without introducing human error, the keys will be generated by combination of author_title_year and those keys are going to be identified by biblatex since they are the same in the .bib file exported from Zotero; trust me open the file and see them by your own eyes.

  • If you discover any typo or fields lacking in the bibliography always do the corrections from within Zotero and not from within the .bib file, as the latter would be always updated based on ever changing Zotero database. Therefore, it is very important to make sure that you export the most recent Zotero database before compiling your PDF. Additionally, if you want to do some formatting stuff to some words in your titles or anything else, e.g. species names, the radical way to do it, is from within Zotero itself once and for all, see my answer here, alternatively you have to do latex mark-up from within your exported .bib file each time exported, which I don't think is an elegant solution.

  • To export the .bib file, you select the whole database of Zotero and right click then choose export itmes, select BibLaTeX format and not the BibTex-citep or BibTex, save the .bib file in the path location where your .tex file can identify

TexStudio Text Editor:

  • Options -> Configure TexStudio -> Build; change Default Bibliography to biber

  • Options -> Configure TexStudio -> Build; change Default Compiler to XeLaTeX to support some fonts, otherwise keep the default

  • After finishing your .tex file, compile by pressing F6+F11+F6 as shortcut to LaTeX typesetting, bibliography biber backend, and LaTeX typesetting again

Biblatex customization:

  • This is the most difficult step and requires reading the manual to customize styles

  • I came up with the one style, originally taken from here with some tweak to get rid of some fields in exported .bib file in bibtex format from Zotero, you can change it as you like, see the comments in the below code

  • Please note that I used \begin{filecontents}{\jobname.bib} to \end{filecontents} of this code you don't need to do your own bibliography, but this is only to have a minimal working example (MWE) here in this post. Typically, what would you like to do in your own case is to uncomment this line, instead, to feed biblatex with your own .bib file that was exported from Zotero; \addbibresource{C:/Users/Dropbox/phd/ref/Exported Items.bib}

  • Don't forget to press F6+F11+F6 in TexStudio to compile your PDF file. Done!


%=====================Language, Fonts============================  
\usepackage{courier,amsmath,amsfonts} %fonts
\usepackage{xcolor} %
\usepackage{hyperref} %
    colorlinks, linkcolor={dark-red},
    citecolor={dark-blue}, urlcolor={medium-blue} %url can be magenta 
\usepackage{filecontents} % just to provide a .bib file for the MWE, comment out if you have your own .bib file that can be fed into biblatex by \addbibresource{C:/Users/Dropbox/ph...etc, you can find this line below, just uncomment it and add your own .bib file
    title = {Bacterial type {IV} secretion systems: versatile virulence machines},
    volume = {7},
    issn = {1746-0921},
    shorttitle = {Bacterial Type {IV} secretion systems},
    doi = {10.2217/fmb.11.150},
    number = {2},
    journal = {Future microbiology},
    author = {Voth, Daniel E and Broederdorf, Laura J and Graham, Joseph G},
    month = feb,
    year = {2012},
    note = {{PMID:} 22324993},
    keywords = {Bacterial Proteins, Bacterial Secretion Systems, {DNA}, Bacterial, Gram-Negative Bacteria, Gram-Negative Bacterial Infections, Host-Pathogen Interactions, Humans, must read, Protein Transport, review, Signal Transduction, Species Specificity, {T4SS}, Transcription, Genetic, Ubiquitination, Virulence Factors},
    pages = {241--257}
    title = {{IL-12} family cytokines: immunological playmakers},
    volume = {13},
    copyright = {© 2012 Nature Publishing Group, a division of Macmillan Publishers Limited. All Rights Reserved.},
    issn = {1529-2908},
    shorttitle = {{IL-12} family cytokines},
    url = {http://www.nature.com/ni/journal/v13/n8/full/ni.2366.html},
    doi = {10.1038/ni.2366},
    language = {en},
    number = {8},
    urldate = {2012-11-20},
    journal = {Nature Immunology},
    author = {Vignali, Dario A. A. and Kuchroo, Vijay K.},
    year = {2012},
    keywords = {{IL-12} family, key reference, language, review},
    pages = {722--728}  
    title = {{PCR} Troubleshooting and Optimization: The Essential Guide},
    isbn = {9781904455721},
    shorttitle = {{PCR} Troubleshooting and Optimization},
    language = {en},
    publisher = {Horizon Scientific Press},
    author = {Kennedy, Suzanne},
    month = jan,
    year = {2011},
    keywords = {{PCR} troubleshooting, Polymerase Chain Reaction, {qPCR}, Science / Chemistry / General, Science / Life Sciences / Genetics \& Genomics}
    title = {Pathogenesis of \textit{Helicobacter pylori}-related gastroduodenal diseases from molecular epidemiological studies},
    volume = {2012},
    issn = {1687-6121},
    url = {http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3398592/},
    doi = {10.1155/2012/371503},
    urldate = {2013-01-01},
    journal = {Gastroenterology Research and Practice},
    author = {Yamaoka, Yoshio},
    year = {2012},
    note = {{PMID:} 22829807
{PMCID:} {PMC3398592}},
    keywords = {{CagA}, {dupA}, H.pylori, must read, {OipA}, review, {VacA}, virulence}

    title = {Pre-{PCR} processing: strategies to generate {PCR-compatible} samples},
    volume = {26},
    issn = {1073-6085},
    shorttitle = {Pre-{PCR} processing},
    url = {http://www.ncbi.nlm.nih.gov/pubmed/14764939},
    doi = {10.1385/MB:26:2:133},
    number = {2},
    urldate = {2011-04-21},
    journal = {Molecular Biotechnology},
    author = {Rådström, Peter and Knutsson, Rickard and Wolffs, Petra and Lövenklev, Maria and Löfström, Charlotta},
    month = feb,
    year = {2004},
    note = {{PMID:} 14764939},
    keywords = {Animals, Blood Chemical Analysis, {DNA}, Feces, Humans, Microchemistry, {PCR} inhibitors, Polymerase Chain Reaction, Pre-{PCR} process, {qPCR}, Specimen Handling},
    pages = {133--146}

\addbibresource{\jobname.bib} % extension must be written
%\addbibresource{C:/Users/Dropbox/phd/ref/Exported Items.bib} % don't forget to writhe the path and extension of .bib file
  citetracker=true,% Citation tracker enabled in order not to repeat citations, and have two lists.
  sorting=none,% Don't sort, just print in the order of citation
  alldates=long,% Long dates, so we can tweak them at will afterwards
  dateabbrev=false,% Remove abbreviations in dates, for same reason as ``alldates=long''
  articletitle=true,% To have article titles in full bibliography
  maxcitenames=999% Number of names before replacing with et al. Here, everyone.

% No brackets around the number of each bibliography entry

% Suppress article title, doi, url, etc. in citations

% Print year instead of date, when available; make use of urldate
\renewbibmacro*{date}{% Based on date bib macro from chem-acs.bbx

% Remove period from titles
% Make year bold for @book types
\DeclareFieldFormat[book]{date}{\textbf{#1}} % doctorate added this line
% Embed doi and url in titles, when available
\renewbibmacro*{title}{% Based on title bib macro from biblatex.def
  \ifboolexpr{ test {\iffieldundef{title}}
               and test {\iffieldundef{subtitle}} }
    {\ifboolexpr{ test {\ifhyperref}
                  and not test {\iffieldundef{doi}} }
       {\ifboolexpr{ test {\ifhyperref}
                     and not test {\iffieldundef{url}} }
  \clearlist{language}% doctorate added this
  \clearfield{note}% doctorate added this
  \ifentrytype{article}% Delimit article and journal titles with a period

The book reference  is here~\parencite{kennedy_pcr_2011}. All references have the year in bold format as shown in the bibliography~\parencite{vignali_il-12_2012}, whereas this one has some diacritics~\parencite{radstrom_pre-pcr_2004}. This article has a species name that you might want to change radically from within Zotero by surrounding the word with HTML-like tags like this: \verb| <i> Helicobacter pylori </i>| to italicize the species name~\parencite{yamaoka_pathogenesis_2012}, the species name called ``\textit{Helicobacter pylori}'' that you want to be italicized as it should be.

By the way I have Zotero now opened and doing \verb|CTR+ALT+C| of the selected reference in Zotero and pasting it into this \LaTeX{} document by using \verb|TexStudio| wonderful editor, you may use a different one, but that shouldn't be a problem anyway, as long as it supports \verb|biber| and \verb|biblatex| wonderful tools. \verb|TexStudio| also has the autocomplete feature that will show you all references after invoking it by the citation commands, but I find copy \& paste from Zotero much easier. How about experiencing \verb|multicite| commands of the \verb|Biblatex| neat package by citing all of the above~\parencites(compare)()[10--15]{kennedy_pcr_2011}[136]{radstrom_pre-pcr_2004}[725]{vignali_il-12_2012}{voth_bacterial_2012}{yamaoka_pathogenesis_2012}?

Did you notice that the prenote ``compare'' was to all citations, and the specific page numbers for individual references. You can cite authors, titles, and more others just read \verb|Biblatex| manual 3.7.3 Qualified Citation Lists. Please note that whenever an entry type has a DOI then you will have a clickable title in the bibliography section that will direct you into the website of that reference.
\printbibliography[title={References}] % change from bibliography to references

Citation result of the MWE:
enter image description here

Bibliography result of the MWE: enter image description here

Update: For Emacs Users
Still copying citation keys from Zotero is an irreducible act. You want to keep Zetoro database clean and uptodate and I don't think there is any need to keep another file or database updated other than that of Zotero's. So same as with TexStudio just fetch that reference from Zotero, copy it by CTRL+SHIFT+C (now in the clipboard) and yank it into Emacs CTRL+y like below:

enter image description here

Happy ZoteroBiblatexing!