jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.36k stars 3.37k forks source link

problems with Annote field in bibtex file (ignore Annote field?) #2003

Closed maxheld83 closed 9 years ago

maxheld83 commented 9 years ago

as in #2002 , I'm having some trouble with Annote fields in my bibtex.

It's a bit odd because

I'm just posting some of these offending fields here, so maybe we can get a handle on the broader issue.

The error thrown for the below sections is of this type:

/usr/local/bin/pandoc tax-democracy.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output tax-democracy.pdf --filter /usr/local/bin/pandoc-citeproc --table-of-contents --toc-depth 2 --template /Library/Frameworks/R.framework/Versions/3.1/Resources/library/rmarkdown/rmd/latex/default.tex --number-sections --highlight-style tango --latex-engine /usr/bin/pdflatex --variable 'geometry:margin=1in' --bibliography ../held-library/held_library.bib 
pandoc-citeproc: 
Error at "source" (line 22, column 81):
unexpected end of input
expecting "\\" or "$"
856 41 $3Table of contents$uhttp://www.loc.gov/catdir/toc/els031/2002102557.html
                                                                                ^
pandoc: Error running filter /usr/local/bin/pandoc-citeproc
Error: pandoc document conversion failed with error 83

(though oddly, the line and colum nmake no sense

Maybe pandoc-citeproc could just completely ignore the Annote fields?

@book{Uskali-2012,
    Author = {M{\"a}ki, Uskali},
    Call-Number = {HB72},
    Date-Added = {2014-05-30 18:32:13 +0000},
    Date-Modified = {2014-06-30 19:32:18 +0000},
    Dewey-Call-Number = {330.01},
    Genre = {Economics},
    Isbn = {9780444516763},
    Library-Id = {2012406303},
    Publisher = {Elsevier},
    Series = {Handbook of the Philosophy of Science},
    Title = {Philosophy of Economics},
    Volume = {Volume 13},
    Year = {2012},
    Annote = {LDR    01227cam  2200301 i 4500
001    17398841
005    20140108132232.0
008    120724s2012    ne       b    001 0 eng
906    $a7$bcbc$corigres$d2$encip$f20$gy-gencatlg
925 0  $aacquire$b2 shelf copies$xpolicy default
955    $bxj87 2012-07-24 z-processor$irm13 2013-10-23$erm13 2013-10-23 to Dewey$wxl03 2014-01-08
010    $a  2012406303
020    $a9780444516763
040    $aDLC$beng$cDLC$erda$dDLC
042    $apcc
050 00 $aHB72$b.P475 2012
082 00 $a330.01$223
245 00 $aPhilosophy of Economics /$cEdited by Uskali M{\"a}ki, Director, Academy of Finland Centre of Excellence in the Philosophy of the Social Sciences, University of Helsinki, Finland, Department of Political and Economic Studies.
264  1 $aAMSTERDAM :$bNorth Holland is an imprint of Elsevier,$c2012.
300    $axxi, 903 pages ;$c26 cm
336    $atext$2rdacontent
337    $aunmediated$2rdamedia
338    $avolume$2rdacarrier
504    $aIncludes bibliographical references and indexes.
490 0  $aHandbook of the Philosophy of Science ;$vVolume 13
650  0 $aEconomics$xPhilosophy.
650  0 $aEconomics$xMethodology.
700 1  $aM{\"a}ki, Uskali.
}}
@book{Tresch-2002,
    Address = {Amsterdam},
    Author = {Tresch, Richard W},
    Call-Number = {HJ236},
    Class = {Give and Take -- Deliberative Democracy and Taxation 2014, Give and Take -- Deliberative Democracy and Taxation 2014},
    Date-Added = {2014-05-30 18:30:43 +0000},
    Date-Modified = {2014-06-29 11:13:33 +0000},
    Dewey-Call-Number = {336},
    Edition = {2nd ed},
    Genre = {Finance, Public},
    Isbn = {0126990514},
    Library-Id = {2002102557},
    Publisher = {Academic Press},
    Title = {Public finance: a normative theory},
    Url = {http://www.loc.gov/catdir/description/els031/2002102557.html},
    Year = {2002},
    Annote = {LDR    01116cam  2200277 a 4500
001    12688981
005    20030709193814.0
008    020220s2002    ne a     b    001 0 eng
035    $a(DLC)  2002102557
906    $a7$bcbc$corignew$d2$eepcn$f20$gy-gencatlg
925 0  $aacquire$b2 shelf copies$xpolicy default
955    $apc21 2002-02-20$apv21 2002-06-06 to SSCD$ase00 2002-06-17$ise45 2002-07-30$ese45 2002-07-30; TO Dewey$aaa03 2002-08-06;$aCopy 2 to BCCD sp55 2002-10-21
010    $a  2002102557
020    $a0126990514
040    $aDLC$cDLC$dDLC
050 00 $aHJ236$b.T73 2002
082 00 $a336$221
100 1  $aTresch, Richard W.
245 10 $aPublic finance :$ba normative theory /$cRichard W. Tresch.
250    $a2nd ed.
260    $aAmsterdam ;$aBoston :$bAcademic Press,$cc2002.
300    $axxiii, 950 p. :$bill. ;$c24 cm.
504    $aIncludes bibliographical references and index.
650  0 $aFinance, Public.
856 42 $3Publisher description$uhttp://www.loc.gov/catdir/description/els031/2002102557.html
856 41 $3Table of contents$uhttp://www.loc.gov/catdir/toc/els031/2002102557.html
},
    Bdsk-Url-1 = {http://www.loc.gov/catdir/description/els031/2002102557.html}
jgm commented 9 years ago

My guess is that the problem is the $s. Pandoc interprets the contents of these fields as TeX, and $ means math mode. I haven't run experiments with biblatex. Perhaps biblatex just ignores the contents of the field -- though it would have to at least keep track of braces to see where the field ends?

maxheld83 commented 9 years ago

yes thank you @jgm I can confirm that $ is the cause of these kinds of errors. now if only I'd remember where downloaded this metadata, so I could shout at those people.

jgm commented 9 years ago

I can confirm (a) that this bib file works okay with pdflatex and biber, (b) that replacing the $ symbols with ! makes it work with pandoc.

jgm commented 9 years ago

My guess is that biber just ignores the $s, since it doesn't really need to parse this LaTeX; it just passes it on verbatim. My guess is that if you used a style that actually printed the Annote field, rather than just ignoring it, you'd then get an error from pdflatex.

Should pandoc be changed to handle this better? I'm not sure.

maxheld83 commented 9 years ago

thanks. That makes sense. Seems like a problem that is caused on the bibtex generation side, not really a pandoc issue. Wish people would stick to the spec.