滥用语法

滥用语法

我对参考书目布局有一些特殊要求,想用 bibulous 来实现。我已经构建了一个示例文档,可以使用 lualatex 和 biber 编译成 PDF,没有任何问题。但是当我尝试将 biber 与 bibulous 交换时,我收到一条错误消息:

  File "C:/ProgramData/Miniconda3/Lib/site-packages/bibulous.py", line 1171
    except Exception, err:
                    ^
SyntaxError: invalid syntax

这是什么原因呢?在我看来,这似乎是 bibulous 代码本身的一个错误。但我无法相信,因为否则其他人就会注意到它,而且早就应该修复了。

这是我的文件:

\documentclass[a4paper, 12pt]{article}
\usepackage[backend=biber, style=authoryear, bibstyle=authortitle, sorting=nyt]{biblatex}
\addbibresource{testrefs.bib}
\bibliography{teststyle.bst}
\usepackage{csquotes}
\author{Thats Me}
\date{\today}
\title{Bibliography Test}

\begin{document}

\maketitle

\section{Book}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{book1990}. And a parenthesized citation with parencite gives this output \parencite{book1990}.

\section{Article}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{article2020}. And a parenthesized citation with parencite gives this output \parencite{article2020}.

\section{Techreport}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{techreport1880}. And a parenthesized citation with parencite gives this output \parencite{techreport1880}.

\section{Bibliography}
\printbibliography[heading=none]

\end{document}

和我的 bib 文件:

@techreport{techreport1880,
  title={MyTechreport},
  author={TechAuthor},
  institution={TechInstitution},
  year={1880},
}

@book{book1990,
  title={MyBook},
  author={BookAuthor},
  isbn={978-3-86680-192-9},
  series={BookSeries},
  year={1990},
  publisher={BookPublisher},
}

@article{article2020,
  title={MyArticle},
  author={ArticleAuthor},
  journal={ArticleJournal},
  year={2020},
  volume={1},
}

和我的 bst 文件(正在进行中):

TEMPLATES:
book = <author>, \textit{<title>} - <year>.
techreport = \textbf{<institution>:<year>}, <title>
article = \textbf{<title>}, <author> - <journal> (<year>), Vol. <valume>, Nr. <number>, P. <pages>

SPECIAL-TEMPLATES:
authorlist = <author.to_namelist()>
authorname.n = [<authorlist.n.prefix> ]<authorlist.n.last>[ <authorlist.n.first.initial()>.][ <authorlist.n.middle.initial()>.][,  <authorlist.n.suffix>.]
au = <authorname.0>, ..., <authorname.9>
citelabel = [<author>:<year>]

OPTIONS:
nothing = {}

使用这个命令链,编译可以正常工作:

lualatex test -shell-escape
biber test
lualatex test -shell-escape
lualatex test -shell-escape

但如果我把 biber 替换为:

python C:/ProgramData/Miniconda3/Lib/site-packages/bibulous.py test.aux

出现上述错误。

答案1

正如 David Carlisle 在最初的评论中指出的那样,您在这里遇到的主要问题是 .tex 文件是针对 Biblatex 而不是 Bibtex 格式化的。请注意,我在 Python 3.9.2 上运行,在文件上运行 Bibulous 时没有收到您在此处报告的相同错误。我收到不同的错误。但是,如果我将文档文件更改为以下内容,则 PDFLatex 运行时不会出现错误:

\documentclass[a4paper, 12pt]{article}
\usepackage{csquotes}
\author{Thats Me}
\date{\today}
\title{Bibliography Test}

\begin{document}

\maketitle

\section{Book}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{book1990}. And a parenthesized citation with parencite gives this output \parencite{book1990}.

\section{Article}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{article2020}. And a parenthesized citation with parencite gives this output \parencite{article2020}.

\section{Techreport}
This section illustrates the citation of the book class. A normal citation with the par command gives this output \cite{techreport1880}. And a parenthesized citation with parencite gives this output \parencite{techreport1880}.

\section{Bibliography}

\bibliographystyle{teststyle}  % bst file
\bibliography{main}            % bib file

\end{document}

我得到以下格式的PDF:

通过在提供的文件上运行 PDFLatex 和 Bibulous 来格式化 PDF。

相关内容