带有子目录的 Chapterbib 无法编译

带有子目录的 Chapterbib 无法编译

我正在使用 chapterbib 包为每个章节生成参考书目。但是编译失败。

这是我的 principal.tex 文件的内容:

\documentclass[phd]{theseUL}

\usepackage{lmodern}
\usepackage[utf8]{inputenc}
%\usepackage[french]{babel}
\usepackage{fancyhdr}
\usepackage{amsfonts}
\usepackage{url}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{color}
\usepackage{verbatim}
\usepackage{enumerate}
\usepackage{makeidx}
\usepackage{topcapt}
\usepackage{setspace}
\usepackage{rotfloat}

\usepackage[square,sort,comma, authoryear]{natbib}
\usepackage{chapterbib}

\begin{document}

\part{Contexte général et état de l'art}
\include{../chap1_introduction/chap1_introduction}
\input{../chap2_definitions/chap2_definitions}

\end{document}

以下是 chap1_introduction.tex 的内容

\chapter{Introduction}  %%This is chapter 1

\phantomsection\addcontentsline{toc}{chapter}{Introduction}

Text

\bibliographystyle{authordate1}
\bibliography{principal}

chap2_definitions.tex 的内容也是如此

\chapter{Definition} %%This is chapter 2

\phantomsection\addcontentsline{toc}{chapter}{Definition}

Text

\bibliographystyle{authordate1}
\bibliography{principal}

这是我编写文档的方式:

  1. pdflatex principal.tex(成功)
  2. pdflatex principal.tex(成功)
  3. bibtex principal(2 个错误,我猜这是正常的:参见输出 #1)
  4. bibtex ../chap1_introduction/chap1_introduction (参见输出#2)
  5. bibtex ../chap2_definitions/chap2_definitions (参见输出#3)
  6. pdflatex 主体.tex
  7. pdflatex 主体.tex

输出 #1

XXXX@IFTEaigny2:~/Phd/principal$ bibtex principal
This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: principal.aux
The style file: authordate1.bst
Illegal, another \bibstyle command---line 51 of file principal.aux
 : \bibstyle
 :          {authordate1}
I'm skipping whatever remains of this command
Illegal, another \bibdata command---line 52 of file principal.aux
 : \bibdata
 :         {principal}
I'm skipping whatever remains of this command
Database file #1: principal.bib
Warning--to sort, need author or key in GrownUpDigital2009
Warning--empty author in GrownUpDigital2009
Warning--empty journal in GrownUpDigital2009
Warning--empty journal in Torres2008
(There were 2 error messages)

输出 #2

XXXX@IFTEaigny2:~/Phd/principal$ bibtex principal
This is BibTeX, Version 0.99c (TeX Live 2009/Debian)
The top-level auxiliary file: ../chap1_introduction/chap1_introduction.aux
The style file: authordate1.bst
I couldn't open database file chap1_introduction.bib
---line 43 of file ../chap1_introduction/chap1_introduction.aux
 : \bibdata{chap1_introduction
 :                            }
I'm skipping whatever remains of this command
I found no database files---while reading file ../chap1_introduction/chap1_introduction.aux
Warning--I didn't find a database entry for "Downes2005"
Warning--I didn't find a database entry for "Hadjerrouit2005"
Warning--I didn't find a database entry for "Hadjerrouit2007"
Warning--I didn't find a database entry for "Wilson2007"
Warning--I didn't find a database entry for "Seffah2002"
Warning--I didn't find a database entry for "Torres2008"
Warning--I didn't find a database entry for "Downes2004"
Warning--I didn't find a database entry for "GrownUpDigital2009"
(There were 2 error messages)

输出 #3 与输出 #2 相同

principal.bib 是整个文档的完整引用数据库,位于 /principal;所以我有 principal/principal.bib。

我应该从章节子目录编译章节 bibtex,还是像我一样从主子目录编译?我尝试了两种方法,结果相同。

谢谢。

答案1

我已经回答了LaTeX 社区,但这里也是我的答案。我可以看到您使用\input以下行包含章节:

\input{../chap2_definitions/chap2_definitions}

但是,您应该改用\include,这样您将获得每个章节的 .aux 文件,这些文件可以进行处理。否则,使用\input,您将需要\cbinputcbunit环境。但是,\include强烈建议使用 。您使用章节,当然要开始一个新页面,这样\include就可以了。

这也是一个解决方案:chapterbib | 每章后面的参考文献。同样,解决方案是使用\include但另外将文件放在同一目录中。

答案2

问题已解决。我认为错误来自所使用的文档类包。相反,\documentclass[phd]{theseUL}我使用了这个类包\documentclass[a4paper, 12pt]{report},编译成功运行。感谢 Stefan 的支持。

相关内容