TITLE: A better system for referencing
DATE: 2018-11-25
AUTHOR: John L. Godlee
====================================================================


For a long time I was using Mendeley as a way of managing papers and
references. However, the last few months I’ve found that Mendeley
has been getting more and more clunky on my laptop, even with
regular updating, and once or twice even doing an entirely fresh
install. I also didn’t like the idea of things not being in my
control. After a recent report that I wrote, I got pulled up for
dodgy referencing, this being because Mendeley is fairly
inconsistent with how it labels things like author names, issue
numbers etc.

I write all of my important work in LaTeX, so I generally exported
my Mendeley reference lists to BibTeX files, so I figured I would
cut out Mendeley completely and try to just hold my references in
simple flat .bib files. Here is a sample of my master BibTeX file,
lib.bib:

    @article{brusa2014,
      author = {Brusa, A. and Bunker, D. E.},
      year = 2014,
      title = {Increasing the precision of canopy closure estimates from hemispherical photography: Blue channel analysis and under-exposure},
      journal = {Agricultural and Forest Meteorology},
      volume = {195-196},
      number = {},
      pages = {102--107},
      FILE = {~/Documents/papers/brusa_bunker_2014.pdf},
      DOI = { http://dx.doi.org/10.1016/j.agrformet.2014.05.001 }
    }

    @article{williams2017,
      author = {Williams, L. J. and Paquette, A. and Cavender-Bares, J. and Messier, C. and Reich, P. B.},
      title = {Spatial complementarity in tree crowns explains overyielding in species mixtures},
      year = 2017,
      journal = {Nature Ecology \& Evolution},
      volume = {1},
      number = {},
      pages = {1--7},
      FILE = {~/Documents/papers/williams_2017.pdf},
      DOI = { http://dx.doi.org/10.1038/s41559-016-0063 }
    }

    @article{sahin2016,
      author = {Sahin, C.},
      title ={Comparison and Calibration of Mobile Phone Fisheye Lens and Regular Fisheye Lens via Equidistant Model},
      year = 2016,
      journal = {Journal of Sensors},
      volume = {2016},
      number = {  },
      pages = {11},
      FILE = {~/Documents/papers/sahin_2016.pdf},
      DOI = { http://dx.doi.org/10.1155/2016/9379203 }
    }

Whenever I read an article of interest, or want to save any
reference for that matter, it goes in lib.bib. I normally keep notes
for the articles I’ve read in a separate set of files related to
whatever project I’m working on, so I search those to find
references that I can’t quite remember the details of. Papers are
all stored in a papers/ directory which gets backed up regularly,
it’s just a flat directory. I suppose I could make it into a
heirarchy based on theme, but I feel that would get complicated too
fast, for example, if a paper should be included in two themes, or
papers should be retro-actively added to emerging themes.

Typing all the BibTeX markup by hand is very laborious. I use Vim
for text editing and I felt it was time to learn about snippets,
which are just small chunks of customisable text that can be entered
into documents by typing a keyword and hitting tab. I use the
‘SirVer/ultisnips’ plugin, which you can find [here]. An example
of a .bib snippet that I use to generate an article template:

  [here]: https://github.com/SirVer/ultisnips

    snippet article "Bibtex for article" b
    @article{$1,
      author = {$2},
      title = {$3},
      year = $4,
      journal = {$5},
      volume = {$6},
      number = {$7},
      pages = {${8:1--10}},
      FILE = {~/Documents/papers/$9},
      DOI = { http://dx.doi.org/$10 }
    }
    endsnippet

The $1 codes are placeholders which are filled by the user, these
placeholders can be quickly traversed using C-l and C-h. Some, like
the page numbers, contain example text to remind me how to format
certain inputs. Here is the snippet for a book:

    snippet book "Bibtex for book" b
    @book{$1,
      ${2:author/editor} = {$3},
      title = {$4},
      year = $5,
      publisher = {$6},
      address = {${7:City, Country}}
    }
    endsnippet

Here are the .vimrc settings I have for UltiSnips:

    let g:UltiSnipsExpandTrigger="<tab>"
    let g:UltiSnipsJumpForwardTrigger="<c-l>"
    let g:UltiSnipsJumpBackwardTrigger="<c-h>"

    let g:UltiSnipsEditSplit="vertical"

    let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/Ultisnips']