You can include multiple bibliography files.
For instance, you can have two (very short) Bibtex files: anon.bib
that defines the anonymised version of your macro and myname.bib
defines it in the usual way. Then you have mybibliography.bib
with everything else.
Now it is easy to use either
\bibliography{anon,mybibliography}
or
\bibliography{myname,mybibliography}
in your Latex source depending on which version you want. No need to edit any *.bib files.
A minimal working example.
x.bib:
@STRING{test = {Xxxx}}
y.bib:
@STRING{test = {Yyyy}}
z.bib:
@MISC{z,
author = test,
title = test,
year = {2000}
}
a.tex:
\documentclass[a4paper]{article}
\begin{document}
\cite{z}
\bibliographystyle{plain}
\bibliography{x,z}
\end{document}
b.tex:
\documentclass[a4paper]{article}
\begin{document}
\cite{z}
\bibliographystyle{plain}
\bibliography{y,z}
\end{document}
The following files are generated by Bibtex.
a.bbl:
\begin{thebibliography}{1}
\bibitem{z}
Xxxx.
\newblock Xxxx, 2000.
\end{thebibliography}
b.bbl:
\begin{thebibliography}{1}
\bibitem{z}
Yyyy.
\newblock Yyyy, 2000.
\end{thebibliography}
In general, including multiple Bibtex files is a powerful technique with which you can easily control the behaviour of Bibtex by including the right combination of Bibtex files. Here is another example of the trick.
It's not necessary to alter a texmf.cnf
file and it's not recommendable either.
A call such as
openout_any=a pdflatex file
(assuming Bash or similar shell) will override the setting of the variable for the current job. I believe that this can be easily implemented in a Makefile
.
Altering a texmf.cnf
file exposes you to security issues. Also this way of doing is not safe, but it's more controllable, as only the current process (and its children, if any) will "see" that setting of the environment variable.
Best Answer
TeX has no notion of the current directory tree, since it's written to work also with operating systems where this has no sense. If you are on a Unix system, you can run
pdflatex
from the command line withwhere
file.tex
is your main document, thus exploiting shell command substitution. The$(pwd)
syntax is forbash
, other shells may require`pwd`
, instead.