yochju / latex-makefile

Automatically exported from code.google.com/p/latex-makefile
Other
0 stars 0 forks source link

chapterbib package is not supported #137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The chapterbib package allows bibliographies for each chapter. When building 
with latex-makefile, the bibliographies are not generated if each chapter is 
included from external files into the main document. In addition, errors are 
generated with latex-makefile because it runs bibtex on the main document.

I minimal example is attached. This example builds correctly with the following 
commands:

pdflatex test
bibtex ch1._include_
bibtex ch2._include_
pdflatex test
pdflatex test

I have also attached a quick hack that seems to cause latex-makefile to 
reliably build this specific example by hard-coding the files that bibtex 
should run over.

It may be possible (but probably too slow) to automatically determine which 
files bibtex needs to be run on by parsing the aux files. For example, the 
following command returns that the two chapter files have bibliography data:
# fgrep bibdata *.aux
ch1._include_.aux:\bibdata{test}
ch2._include_.aux:\bibdata{test}

As Chris pointed out, there is also a similar issue: 
http://code.google.com/p/latex-makefile/issues/detail?id=103

Original issue reported on code.google.com by russ...@kliese.id.au on 27 Jul 2011 at 1:39

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the minimal example.  I'm looking at this now.

Original comment by shiblon on 9 Aug 2011 at 7:53

GoogleCodeExporter commented 9 years ago
This is somewhat tricky, but I think we can do it.

Let me be sure that I understand what is going on, first, though.

- Chapterbib is a misnomer

Because, it's really "included-file bib".  The bibliography is at the file 
level, not necessarily the chapter level.  Fair enough.  So long as I 
understand it, that's what matters.

- When *not* using chapterbib, we are to run bibtex on the main source .aux 
file, but

- When using chapterbib, we are to run bibtex on any .aux file *that contains 
bibdata entries*, and *not* the main source .aux file.

- After that, latex compilation proceeds normally.

Is that a correct assessment?

Original comment by shiblon on 10 Aug 2011 at 5:34

GoogleCodeExporter commented 9 years ago
You are right, chapterbib is a misnomer. Quoting from the documentation: 
"despite the name ‘chapterbib’, the bibliographies are for each included 
file, not necessarily for each chapter, although a bibliography per chapter is 
the usual application" [1].

Your assessment for using chapterbib is correct for the "normal usage". (After 
reading the documentation, I found that it is possible to use the chapterbib 
package without \include but rather using the cbunit environment. It sounds a 
bit too complicated to implement in the Makefile because you need to first run 
latex in draft mode, run bibtex on the various files and then remove draft mode 
and run latex again.)

[1] 
http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/cite/chapterbib.pd
f

Original comment by russ...@kliese.id.au on 10 Aug 2011 at 11:11

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The chapterbib documentation also allows bibliographies to be gathered to the 
end of the document, and even duplicated in each chapter and at the end. In 
these cases, the latex and bibtex commands are run as previously outlined (see 
8 and 9 in chapterbib.pdf).

It is also possible to have a regular overall bibliography in the main file in 
addition to the chapter bibliographies (see  7 in chapterbib.pdf). In this 
case, latex is run first, then bibtex on the main source .aux file, then bibtex 
on the \included .aux files, the latex again (twice).

I just thought I would alert you to these possible use cases in case a solution 
can be made that easily supports them all.

Original comment by russ...@kliese.id.au on 10 Aug 2011 at 11:27