BibTeX choking on comments in database
Hello list, I am using BibTeX under ConTeXt to typeset a publication. I noticed while building the publication ConTeXt raises the following non-fatal warning: ... This is BibTeX, Version 0.99d (TeX Live 2023/Debian) The top-level auxiliary file: Secret_Sauce.aux The style file: cont-au.bst Database file #1: ./References.bib I was expecting a `{' or a `('---line 2 of file ./References.bib : : % See the file Copying for details on copying conditions. (Error may have been on previous line) I'm skipping whatever remains of this entry (There was 1 error message) publications > loading formatting style from 'bibl-apa' open source > level 4, order 13, name '/usr/share/texmf/tex/context/bib/mkii/bibl-apa.tex' close source > level 4, order 13, name '/usr/share/texmf/tex/context/bib/mkii/bibl-apa.tex' ... All that's present on the first few lines of the References.bib BibTeX database are comments that begin with the '%' character. Is there a different character that should be used for BibTeX databases when used with ConTeXt? -- Kip Warner OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
Am 28.05.24 um 01:24 schrieb Kip Warner:
Hello list,
I am using BibTeX under ConTeXt to typeset a publication. I noticed while building the publication ConTeXt raises the following non-fatal warning:
... This is BibTeX, Version 0.99d (TeX Live 2023/Debian) The top-level auxiliary file: Secret_Sauce.aux The style file: cont-au.bst Database file #1: ./References.bib I was expecting a `{' or a `('---line 2 of file ./References.bib : : % See the file Copying for details on copying conditions. (Error may have been on previous line) I'm skipping whatever remains of this entry (There was 1 error message) publications > loading formatting style from 'bibl-apa' open source > level 4, order 13, name '/usr/share/texmf/tex/context/bib/mkii/bibl-apa.tex' close source > level 4, order 13, name '/usr/share/texmf/tex/context/bib/mkii/bibl-apa.tex' ...
All that's present on the first few lines of the References.bib BibTeX database are comments that begin with the '%' character.
Is there a different character that should be used for BibTeX databases when used with ConTeXt?
According to the documentation, everything outside of entries is considered a comment. Inside of entries, there can’t be comments. Hraban
On Tue, 2024-05-28 at 08:05 +0200, Henning Hraban Ramm wrote:
According to the documentation, everything outside of entries is considered a comment. Inside of entries, there can’t be comments.
But in this case, is it not warning about text outside of an entry that should be treated as a comment? -- Kip Warner OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
On Tue, 28 May 2024, Kip Warner wrote:
On Tue, 2024-05-28 at 08:05 +0200, Henning Hraban Ramm wrote:
According to the documentation, everything outside of entries is considered a comment. Inside of entries, there can’t be comments.
But in this case, is it not warning about text outside of an entry that should be treated as a comment?
Hard to say without looking at the bib file, but % is not a comment character in bibtex. So, if your file starts with % @article{key, % title = {...}, % } you will get an error from the bib parser. If you want to comment out an entry, the simplest way is to remove the @. So, article{key, title={...}, } is a comment (since it is outside the entry). Aditya
On Wed, 2024-05-29 at 00:45 +0200, Aditya Mahajan wrote:
Hard to say without looking at the bib file, but % is not a comment character in bibtex. So, if your file starts with
The first few lines of the file is just a copyright notice, with each line beginning with %. If that's not an appropriate comment character, is there any way to put comments in a BibTeX file? -- Kip Warner OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
On Tue, 2024-05-28 at 17:00 -0600, Alan Braslau wrote:
The Context publications reference subsystem reads BibTeX databases but does not use BibTeX at all. I am not sure what your quoted statement means exactly.
I see. The first few lines of my BibTeX file just contains a copyright notice that is commented out with the % character. If that is not a valid comment character, is there no way to write a comment in the file? -- Kip Warner OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
On Tue, 28 May 2024 21:54:08 -0700
Kip Warner
On Tue, 2024-05-28 at 17:00 -0600, Alan Braslau wrote:
The Context publications reference subsystem reads BibTeX databases but does not use BibTeX at all. I am not sure what your quoted statement means exactly.
I see. The first few lines of my BibTeX file just contains a copyright notice that is commented out with the % character. If that is not a valid comment character, is there no way to write a comment in the file?
1) You appear to be using the long-frozen mkii bibliography code. 2) As Aditya wrote, anything outside of a valid entry is ignored. @comment{ } is a good construction. -- Alan Braslau 816 West Mountain Avenue Fort Collins, CO 80521 USA mobile: (970) 237-0957 Conserve energy! ;-)
On Wed, 2024-05-29 at 06:49 -0600, Alan Braslau wrote:
1) You appear to be using the long-frozen mkii bibliography code.
I think you are right! I just realized that. I'm using in my Environment file... % \BIBTEX macro... \usemodule[abr-02] % Setup bibliography... % References database and other general settings... \setupbibtex[database={./References}, sort=author] % Global settings... \setuppublications[ alternative=apa, numbering=yes, monthconversion=month, autohang=yes, sorttype=cite] % Without this, no hyperlinks at all in the output... \setupinteraction[state=start] % This two-part helper creates a hyperlink for url fields... \unprotect \def\bibgotoURL#1#2% {\useURL[#1][#2][][#1]\from[#1]} \def\bibinsertbiburl#1#2#3% {\bibdoifelse{\@@pb@biburl} {#1\expanded{\bibgotoURL{\@@pb@title}{\@@pb@biburl}}#2}{#3}} \protect % Book reference layout... \setuppublicationlayout[book]{% \insertauthors{}{. }{\insertthekey{}{. }{}}% \inserttitle{\bgroup\it }{.\egroup\space }{}% \insertpubname{}{. }{}% \insertday{}{ }{}% \insertmonth{\Word }{. }{}% \insertpubyear{}{. }{}% \insertnote{}{.}{}% } % Adjusted version of 'misc' typesetting, using \insertbiburl % instead of \inserttitle (and \insertbiburl runs the % \bibinsertbiburl macro defined above) \setuppublicationlayout[misc]{% \insertauthors{}{. }{\insertthekey{}{. }{}}% \insertbiburl{\bgroup\it }{.\egroup\space }{}% \insertpubname{}{. }{}% \insertday{}{ }{}% \insertmonth{\Word }{. }{}% \insertpubyear{}{. }{}% \insertnote{}{.}{}% } % finally, this is a horrible hack needed due to bibtex inserting % line breaks in the middle of urls in the output bbl (!) % If you find this hack too ugly, consider editing the .bbl by % hand and forgetting about the .bib file altogether... \let\mydodostartpublication\dodostartpublication \def\dodostartpublication{\catcode`\%=14 \mydodostartpublication} % Macro to put the citations as footnotes... \unexpanded\def\footnotecite{\dodoubleempty\domycite} \def\domycite[#1][#2]% {\ifsecondargument \footnote{\cite[alternative=data,#1][#2]}% \else \footnote{\cite[data][#1]}% \fi} % Individial citation settings... % Enable clickable links... \setupcite[alternative=interaction=start, compress=no] % Publication list setups for end of the book list... % Settings for triggering et al... \setuppublicationlist[authoretallimit=3] \setuppublicationlist[authoretaltext={\it\ et al.}] \setuppublicationlist[authoretaldisplay=2] % List the author, editor, or article author's full name, inverted... \setuppublicationlist[% author=\invertedauthor,% artauthor=\invertedauthor,% editor=\invertedauthor,% title=References] % Setup footnotes... \setupnotation[footnote] [color=colour_footnote_text, backgroundcolor=colour_footnote_background, width=0.3cm, % Space between footnote number and footnote itself numbercommand=] % Remove elevated footnote notation at bottom of page \setupnote[footnote] [textseparator={\textcomma}, % Comma delineated before={\crlf\crlf}] % \setupfootnotes [rule=on, % Disable horizontal rule textstyle={\hskip.03em}] % Vertical space between footnotes and the text % To move footnotes inside of text boxes to the bottom of the page with % the rest of the footnotes. Disabled temporarily to fix issue of text % background frame borders vanishing... \kindofpagetextareas\plusone Whenever I wanted to use a citation I'd just write \footnotecite[something]. But I see now there is this page that describes a different process for using BibTeX: https://wiki.contextgarden.net/Bibliography I will take a look today and try to incorporate the new best practice for using the database and its citations. If you have any suggestions I will try and incorporate them. -- Kip Warner OpenPGP signed/encrypted mail preferred https://www.thevertigo.com
participants (4)
-
Aditya Mahajan
-
Alan Braslau
-
Henning Hraban Ramm
-
Kip Warner