yochju / latex-makefile

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

Citation within bibtex annotations #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,

I'm currently creating an annotated bibliography using the apacite package 
(bibliography style apacann).  I've noticed that when issuing a "make X.pdf" 
using the latest Makefile (2.2.0-beta2 - although this situation has existed 
since I started using this Makefile at 2.1.31), the citations within each 
annotation are still marked as "?" until I rerun "bibtex; pdflatex; 
pdflatex".  I've done up a minimal test case consisting of the attached .tex 
and .bib file:

awalford@wkmil0700:~/latex %> make clean
awalford@wkmil0700:~/latex %> ls
Makefile  ref.bib  ref.tex
awalford@wkmil0700:~/latex %> make ref.pdf
NOTE: You may ignore warnings about the following files:

     ref.d

Makefile:2051: ref.d: No such file or directory
= ref.tex --> ref.d ref.pdf (1) =
= ref.bib ref.aux --> ref.bbl =
= ref.tex --> ref.pdf (2) =
LaTeX Warning: Citation `ref1' undefined on input line 4.

LaTeX Warning: Citation `ref2' undefined on input line 24.

LaTeX Warning: There were undefined references.

Success!  Wrote 1 page, 34732 bytes to ref.pdf

awalford@wkmil0700:~/latex %> 

At this point, the PDF contains only one citation, and the citation within 
the annotation reads "? (?)".

Continuing with this:

awalford@wkmil0700:~/latex %> bibtex ref
This is BibTeX, Version 0.99c (TeX Live 2009/Arch Linux)
The top-level auxiliary file: ref.aux
The style file: apacann.bst
Database file #1: ref.bib
apacann.bst [2009/03/01 v4.05 APA annotated bibliography style]
awalford@wkmil0700:~/latex %> pdflatex ref
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Arch Linux)
 restricted \write18 enabled.
entering extended mode
(./ref.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, 
noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, 
ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, 
dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, 
mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, 
ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, 
po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, 
span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/apacite/apacite.sty) (./ref.aux)
(/usr/share/texmf-dist/tex/latex/apacite/english.apc
NOT AUSTRALIAN!!!
) (./ref.bbl

LaTeX Warning: Citation `ref2' undefined on input line 24.

) [1{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./ref.aux)

LaTeX Warning: There were undefined references.

 )</usr/share/texmf-
dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/
texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texmf-
dist/font
s/type1/public/amsfonts/cm/cmti10.pfb>
Output written on ref.pdf (1 page, 36561 bytes).
Transcript written on ref.log.
awalford@wkmil0700:~/latex %> 

Produces both citations, but note the undefined citation warning: the first 
annotation still contains "? (?)".  It is necessary to run pdflatex a second 
time to get an acceptable PDF, with no warnings:

awalford@wkmil0700:~/latex %> pdflatex ref
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Arch Linux)
 restricted \write18 enabled.
entering extended mode
(./ref.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, 
noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, 
ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, 
dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, 
mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, 
ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, 
po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, 
span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/usr/share/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texmf-dist/tex/latex/apacite/apacite.sty) (./ref.aux)
(/usr/share/texmf-dist/tex/latex/apacite/english.apc
NOT AUSTRALIAN!!!
) (./ref.bbl) [1{/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./ref.aux) )</usr/share/texmf-
dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb><
/usr/share/texmf-
dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texm
f-dist/fonts/type1/public/amsfonts/cm/cmti10.pfb>
Output written on ref.pdf (1 page, 36361 bytes).
Transcript written on ref.log.
awalford@wkmil0700:~/latex %> 

I realise that this is an unusual and sort of recursive use case and would 
love to provide a patch for you, but I'm uncertain where the best place to 
start looking within the Makefile would be - any points would be appreciated.

I'm running Arch Linux (up to date) on x86_64, with TeXLive 2009.16776-1.

Original issue reported on code.google.com by alexandr...@gtempaccount.com on 15 Mar 2010 at 4:24

Attachments:

GoogleCodeExporter commented 9 years ago
Hey, a detailed bug with a minimal test case!  That's awesome.

I'm not sure where the best place for a patch would be, either.  The bibtex 
dependency chain is the most esoteric in the Makefile, so I'll have to study 
what's 
really going on to figure out a better solution.

This use case is not all that uncommon.  I'm surprised it hasn't come up before 
now, 
frankly.  I'll take a look (but don't let that stop you from looking at it - I 
may not get 
to it for a week or more).

Original comment by shiblon on 15 Mar 2010 at 3:41

GoogleCodeExporter commented 9 years ago
Do me a favor and try out r0eb58b650c83.  It *may* fix this (there was a super 
subtle 
dependency problem that might rear its ugly head here).

If it doesn't, that's fine, I'll still dig into it.

Original comment by shiblon on 16 Mar 2010 at 2:13

GoogleCodeExporter commented 9 years ago
Sadly that revision hasn't fixed this issue for me :(

Original comment by alexandr...@gtempaccount.com on 16 Mar 2010 at 10:08

GoogleCodeExporter commented 9 years ago
I've now been able to reproduce the issue.  Working on it.

Original comment by shiblon on 17 Mar 2010 at 6:51

GoogleCodeExporter commented 9 years ago
So, it looks like the way to get this to build is to follow the following 
procedure:

pdflatex ref
bibtex ref
pdflatex ref
bibtex ref
pdflatex ref
pdflatex ref

Is that right?  Two invocations of bibtex required, with a pdflatex sandwiched 
in 
between, followed by two pdflatex invocations?

That's the only way I could get it to shut up.  I'm currently looking at the 
output 
differences to see what changed so that I can (hopefully) automate this.

Original comment by shiblon on 17 Mar 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Yes that's correct; that sequence works for both the test case I sent you and 
my actual 
document.  I thought about hacking up the Makefile to just test for "undefined 
references" warnings on the last run and if so rerun bibtex, but I don't think 
that's 
the right way to go about it?  

Original comment by alexandr...@gtempaccount.com on 17 Mar 2010 at 10:15

GoogleCodeExporter commented 9 years ago
Yeah, the problem with blindly looking at "undefined references" is that 
sometimes they 
really are undefined :)

This is a bit tricky.  I'm going to have to take a hard look at the steps taken 
and see how 
we can do this.  It's not your typical invocation order.

Original comment by shiblon on 18 Mar 2010 at 1:04

GoogleCodeExporter commented 9 years ago
I just ran the sequence, saved all of the output files in different 
directories, and did a 
diff between runs.  Nothing jumps out.  There is no line in the output saying 
"Run 
again", there is no indication that anything may not have worked all the way.  
Typically, packages emit something to the log when they need pdflatex to be run 
again, but that is not the case here.

I'm not sure how to detect this, other than looking for apacann and forcing the 
currently single bibtex run to be bibtex/pdflatex/bibtex (then letting the 
other 
machinery kick in as usual).

In fact, I think I'll try that, since nothing else seems like a likely solution.

Original comment by shiblon on 18 Mar 2010 at 1:13

GoogleCodeExporter commented 9 years ago
Fixed in r70ac667ecd0c.  Basically, if I detect that bibtex needs to be run at 
all, I run it 
as before.  Then, if I find that the style is apacann, I run pdflatex and 
bibtex once more 
before exiting the bbl target.

It works, and it doesn't appear to interfere with anything else, so I'm going 
with it.  Let 
me know if it works for you.

If this process is needed for other kinds of bibstyles, I can easily add them.

Original comment by shiblon on 18 Mar 2010 at 1:31

GoogleCodeExporter commented 9 years ago
Awesome, thanks; that revision works perfectly on my test case and almost 
perfectly 
in my actual document (in which I also have citations within nomencl 
nomenclatures - 
but unlike before, I just need to repeat "make foo.pdf" once or twice and they 
eventually get resolved).

Other annotated bibliography styles we should probably look for besides apacann 
are:

  apacannx (apacite package)
  plain-annote
  unsrt-annote
  chicago-annote (chicago package)
  chicagoa (chicago package)
  IEEEannot
  annotate
  annotation

I think it's worth just checking if the style contains the string "annot", plus 
the 
special ones like chicagoa, apacann and apacannx, something like the attached 
patch 
(I've tested it against apacann, apacannx, plain-annote, chicago-annote, 
chicagoa, 
annotate and annotation, as well as plain (not annotated), and it seems to work 
as 
expected).

Original comment by alexandr...@gtempaccount.com on 18 Mar 2010 at 11:05

Attachments:

GoogleCodeExporter commented 9 years ago
Great patch.  I edited it a tiny bit and incorporated it.  See re218f0b2d2b3.

Hopefully this will also fix the problem you have with your actual document.

Original comment by shiblon on 19 Mar 2010 at 5:21

GoogleCodeExporter commented 9 years ago
This issue is already fixed, but I don't think it deserves a new one:

If you use the apacite bibliographystyle from the apacite packages the Makefile 
doesn't work right. I attached a tiny patch. Hope you can use it.

Original comment by m...@diesuburbia.com on 13 Dec 2010 at 6:30

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks!  This is now incorporated into the tip (currently r442fefe278ee).

I haven't pushed a new build yet because there are massive changes going on in 
overall project structure, but hopefully this will go in soon.  Meanwhile, you 
can pull the source down and run "build" to get a new Makefile if you want.

Original comment by shiblon on 20 Dec 2010 at 6:07