我正在用 Latex 撰写一篇论文,其中包含不同的章节和单独的 tex 文件。请注意以下几点:
- 文件夹结构
├── Chapters
│ └── Chapter1
│ ├── chapter1.tex
│ └── mybib.bib
└── thesis.tex
thesis.tex
文件
\documentclass[a4,12pt]{book}
\usepackage{chapterbib}
\begin{document}
\include{Chapters/Chapter1/chapter1}
\end{document}
chapter1.tex
文件:
\chapter{Test}
This is a sample chapter with \cite{my_article}
\bibliographystyle{plain}
\bibliography{mybib}
mybib.bib
文件:
@article{my_article,
author = {Test Author},
title = {Article title},
journal = {J. Chem. Phys.},
volume = {100},
pages = {1000},
year = {2000}
}
首先,我build
在中运行TexStudio的命令thesis.tex
,bibtex
抛出错误
Process started: bibtex "thesis".aux
This is BibTeX, Version 0.99d (TeX Live 2019/Debian)
The top-level auxiliary file: thesis.aux
A level-1 auxiliary file: Chapters/Chapter1/chapter1.aux
The style file: plain.bst
I couldn't open database file mybib.bib
---line 4 of file Chapters/Chapter1/chapter1.aux
: \bibdata{mybib
: }
I'm skipping whatever remains of this command
I found no database files---while reading file thesis.aux
Warning--I didn't find a database entry for "my_article"
(There were 2 error messages)
意思是 TexStudio 找不到该mybib.bib
文件。所以我将参考书目行修改为如下内容
\bibliography{Chapters/Chapter1/mybib}
现在,如果我编译,bibtex 就可以正确遵循
Process started: bibtex "thesis".aux
This is BibTeX, Version 0.99d (TeX Live 2019/Debian)
The top-level auxiliary file: thesis.aux
A level-1 auxiliary file: Chapters/Chapter1/chapter1.aux
The style file: plain.bst
Database file #1: Chapters/Chapter1/mybib.bib
Process exited normally
但是没有包含参考书目。如何在 TexStudio 中解决这个问题?在这种情况下如何管理/编译。
现在,如果我像以前一样保留参考书目行并bibtex chapter1.aux
从Chapters/Chapter1
文件夹中的终端手动运行,然后在文件中运行构建命令thesis.tex
,它就可以工作了。这可以在 TexStudio 本身中完成吗?