Showing posts with label bibtex. Show all posts
Showing posts with label bibtex. Show all posts

Wednesday, September 8, 2010

Private bibliographies

I have two versions of my cv: one for public consumption and one which contains extra private bibliography entries for work that is in submission. Obviously these are mostly the same so I had one one that had a \newif\ifpublic and then later included the commands to for the private bibliography entries \unless\ifpublic ... \fi. Of course, the source still leaked information about the papers in submission which made it so that I could not distribute the source. The solution to this problem lies with \InputIfFileExists. So, for example, one can write
\InputIfFileExists{private}{}{}
which will \input{private} if private.tex exists. This is pretty good except that now we have to have 2 additional files, both private.tex and the private bibliography file, call it private.bib. Here, we can use a feature of BibTeX to reduce the number of extra files. Since BibTeX ignores all text outside of @{...} and TeX ignores everything in a file after \endinput, we can have the necessary LaTeX code for including the private bibliography at the start of private.bib and end the code with \endinput before the BibTeX entries begin. Then the \InputIfFileExists can be changed to
\InputIfFileExists{private.bib}
Now the source for the cv can be distributed. If a public version of the cv needs to be generated, then one can insert another \endinput at the start of private.bib or temporarily move private.bib aside while building.

Wednesday, May 12, 2010

BibTeX hacking

I've avoided editing bst files but I finally encountered something that I felt needed to change. When abbreviating the name Foo Bar Baz, the abbrv bibliography style produces
F.~B.~Baz
which has too much space between the F and the B for my tastes. After making a copy of abbrv.bst (and renaming it), we can change the argument to the format.name$ function (see Section 18) from "{f.~}{vv~}{ll}{, jj}" to "{f{.\nobreak\,}.~}{vv~}{, jj}" to produce a nonbreaking thin space between the F. and the B. I hope I never again have to edit a a bst.