## 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.