I have two .bib files that I want to use in my bibliography. Entries do not overlap. I have found quite a few forum topics on that, but none of them really satisfied me. So my idea is to merge the two to one .bib file which I will use in the .tex. Most conveniently, this would be done from within LaTeX (so I do not use bibtool, or reference software). So, I made a macro to merge two files:
\newwrite\bibwrite
\newcommand{\concatbib}[2]{%
\begingroup
\IfFileExists{#1}%
{\CatchFileDef{\bibone}{#1}{}}
{\let\bibone\empty}
\IfFileExists{#2}%
{\CatchFileDef{\bibtwo}{#2}{}}
{\let\bibtwo\empty}%
\immediate\openout\bibwrite=MyBib.bib\relax
\immediate\write\bibwrite{\bibone \bibtwo}%
\immediate\closeout\bibwrite
\endgroup
}
which is basically taken from another question (How can I open a file in "append" mode?).
Now the problem is that Latex wants to interpret the file contents, and things like \noexpand, \detokenizedid not work as desired. So I have to read it in verbatim, which I tried according to Martin Scharrer's answer here: Control command arguments.
\def\alltext{
\begingroup
\let\do\@makeother % define \do to change the category code of its argument to 'other'
\dospecials % makro that is a string of every special character preceeded with \do -> all catcodes are changed
\all@text
}
\def\all@text#1{
\endgroup
#1
}
and I would use this within the other macro. Testing it alone, though, I get the error that Use of \all does not match its definition \alltext, and I think that I am missing a big point here.
- I think that I put the definition of
\all@textafter\alltextso I can close the group, which to my understanding I need to define the region where the catcodes are altered. But I do not see why\all@textshould be known already in the definition of\alltext? - up to now I understood that
\@...commands are primitive commands, but I thought it was only a notation. Is there more to it? - is there a way to make that code work?
cat? – jon Apr 03 '13 at 17:59biblio1.bibandbiblio2.bib, BibTeX and LaTeX can access both files easily via the statement\bibliography{biblio1,biblio2}. – Mico Apr 03 '13 at 18:09