2

I am using the Bibulous tool to create nicely customizable bib styles (see also Create clean and simple custom bibstyle)

i.e. this tool uses an alternative command to parse the *.bib file and create the *.bbl file. Instead of using bibtex %.aux it uses a python-style macro /path/to/bibulous.py %.aux with a custom template file templates.bst. The compilation procedure for the *.tex document then follows the standard well known procedure :PdfLaTeX + Bibulous + PdfLaTeX (x2) + View Pdf

While this works fine on a simple example I have problems with more complex document structure, using \include{...} commands. References with \cite{...} in the main *.tex file are recognized fine and included in the Bibliography, but references from an included *.tex file are not recognized properly : Citation [...] on page [...] undefined as shown in the minimal working example below.

Any ideas how to use bibulous with included *.tex files, which should not be an exotic case at all, but rather common practice!?


This MWE needs 4 files + the bibulous macro

MWE.tex           %main *.tex file
templates.bst     %template file for bibulous formatting
bibl.bib          %bib file with entries
sub.tex           %a *.tex file included via \include{sub}
bibulous.py       %file from the bibulous tool used as bibtex command

The main *.tex file MWE.tex

\documentclass[a4paper,11pt]{report}

\begin{document}
  %Adding this line recognizes all entries in the *.bib 
  %file and creates Bibliography entries, but this is not 
  %safe when adding new references
  %\nocite{*}

  %This reference works fine
  Reference in main MWE.tex file \cite{Lorem}

  %include file sub.tex with another \cite{...} command
  \include{sub}

  %create bibliogpaphy from bibl.bib file
  \bibliography{bibl}{}
  \bibliographystyle{templates} %use templates.bst bibulous template file

\end{document}

A secondary *.tex file to be included by the \include{} command sub.tex

%this reference is not recognized properly
Reference in included sub.tex \cite{Ipsum}

An examplary bibliography database bibl.bib

@entry{Lorem,
    title     = {Lorem},
    author    = {A. Lorem},
    year      = {2015},
    publisher = {Lorem Journal}
}

@entry{Ipsum,
    title     = {Ipsum},
    author    = {B. Ipsum},
    year      = {2015},
    publisher = {Ipsum Journal}
}

An examplary template file for the bibliography formatting used by bibulous templates.bst

TEMPLATES:
entry = <au>, \textit{<title>}, <publisher>, <year>
moewe
  • 175,683
HeXor
  • 324
  • You did run bibtex in between, right? Question mark instead of citation number – Johannes_B Oct 22 '15 at 08:20
  • In this case I don't use bibtex, since I am using the bibulous tool, so the standard bibtex %.aux command is replaced by /path/to/bibulous.py %.aux creating the references. Then I run the usual PdfLaTeX + Bibulous+ PdfLaTeX (x2) + View Pdf. As I said this works fine with flat *.tex document structures, but not with included files. – HeXor Oct 22 '15 at 08:33
  • Can you add this information to the question (by editing it) so others not familiar with the python tool know the procedure. This will push the questioin back on top of the mainsite visible for all, too. – Johannes_B Oct 22 '15 at 09:57
  • I added a short explanation of the bibulous macro to the original post – HeXor Oct 22 '15 at 10:32
  • I just digged a bit into the main bibulous.py macro (version 1.3) and found that actually only the .aux file created from the master .tex file is parsed for citation entries, but not included files. I added a small tweak for my purpose to make it work, but I will contact the package author to include it in the official version. – HeXor Oct 23 '15 at 11:19
  • @HeXor: I added the ability of the AUx file parser to call itself recursively so that it can catch text inserted with TeX's \include command. The updated bibulous.py file is now available on the Project Website and works for the MWE given here. – nzh Oct 24 '15 at 17:43

1 Answers1

4

I added the ability of the *.aux file parser to call itself recursively so that it can catch text inserted with TeX's \include command. The updated bibulous.py file is now available on the Project Website and works for the MWE given here.

[This answer was converted from one of the comments.]

nzh
  • 1,085
  • 8
  • 13