Adding links to title or year in Latex Bibliography

I tried to achieve that latex adds links (dois or urls) to the references without showing the ugly url/doi in the reference. I believe nobody has ever benifited by reading those url/dois in a print version by typing the text into the browser. The revtex format of APS does something like that by a sophisticated style file for bibtex (.bst). However, I did not succeed in replicating this behavior with my own bst file. My workaround is to alter the .bib file direclty to interchange every title/year entry

year = { 2006 }

by a

year = { \href{ \href{http://dx.doi.org/... }{ 2006 } }

I did this with a python script and it works perfectly fine with the caveat of having one extra script and step in generating a document from tex source.

Simply run the python script by

python makeDoiLink.py

and you will be promted for the file name and if you want to add the link to title or year. The output will be a new .bib file called oldfileDOI.bib.

Please download and feel free to use and alter the script
makeDoiLink.py

Zotero: Fix Latex math commands in Bibtex export

Locate your Zotero data directory and edit translators/BibTeX.js

1) Change

var alwaysMap = {
  "|":"{\\textbar}",
  "<":"{\\textless}",
  ">":"{\\textgreater}",
  "~":"{\\textasciitilde}",
  "^":"{\\textasciicircum}"
  "\\":"{\\textbackslash}",
  "{" : "\\{\\vphantom{\\}}",
  "}" : "\\vphantom{\\{}\\}"
}

to

var alwaysMap = {
  "|":"{\\textbar}",
  "<":"{\\textless}",
  ">":"{\\textgreater}",
  "~":"{\\textasciitilde}",
  "^":"^"
  "\\":"\\",
  "{" : "{",
  "}" : "}"
}

2) Change

function escapeSpecialCharacters(str) {
  var newStr = str.replace(/[|\<\>\~\^\\\{\}]/g, function(c) { return alwaysMap[c] })
    .replace(/([\#\$\%\&\_])/g, "\\$1");

to

function escapeSpecialCharacters(str) {
  var newStr = str.replace(/[|\<\>\~\^\\\{\}]/g, function(c) { return alwaysMap[c] })
    .replace(/([\#\%\&])/g, "\\$1");

This should do the trick. The instructions are tested for Zotero 4.0.28.1

This based on http://www.ohadsoft.com/2012/06/zotero-exporting-unicode-and-latex-constructs-to-bibtex/ which seems to be for an older version of Zotero.

This is somewhat related: When exporting items by right click… export as… zotero displays the option to use abbreviated journal names. This is not the case for exporting by using quick copy. This can be fixed by again editing the translator file. To do so, simply change the option “useJournalAbbreviation” of “displayOptions” to “true”. You find this entry in the header of the file.

Script to convert between natural units and SI units

The SI unit system and the natural unit system are equivalent ways of describing physical quantities. SI has the basis (meter, second, kilogram and Ampere). The natural system has the basis (speed of light, \hbar, electron volt, and 4 \pi \varepsilon_0).
This python script makes it easy and transparent to convert quantities between these systems. It is a simple command line tool, which is invoked with the value you want to convert, its unit system and the powers of its units. An easy example would be to check, if the speed of light, 2.998 108 m/s, is ‘one’ in natural units. The power of meter is 1, the power of seconds is -1. The powers of the remaining kg and A are both 0. Running the code then looks like this

convert_SI_Natural.py --unit=si -- 2.998e8 1 -1 0 0
 converted 
   2.998000000e+08 m s^-1
 = 1.000025157e+00 c

Looks good! Now lets check the opposite direction. The power of c is 1. The powers of the remaining units (\hbar, eV and 4\pi \varepsilon_0) are zero.

convert_SI_Natural.py --unit=nat -- 1.0 1 0 0 0
 converted 
   1.000000000e+00 c
 = 2.997924580e+08 m s^-1

This is the value by NIST definition. All the details for using the script can be found by invoking the script with

convert_SI_Natural.py --help

Download and have fun.
convert_SI_Natural.py