Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 如何从当前项目以外的目录引用bibtex文件?_File_Reference_Directory_Latex_Bibtex - Fatal编程技术网

File 如何从当前项目以外的目录引用bibtex文件?

File 如何从当前项目以外的目录引用bibtex文件?,file,reference,directory,latex,bibtex,File,Reference,Directory,Latex,Bibtex,我想做的是在一个方便的目录中创建一个“主”bibtex参考书目(通过JabRef组织),这样我就不需要将每个项目的新参考文献复制到主数据库中。我遇到的问题是,虽然我可以很容易地引用另一个文件(例如,用于STATA回归表输出),但即使它不在同一目录中,参考书目也不希望合作 出于本例的目的,我在中创建了一个虚拟目录 My Documents/Course/Paper. 下的Tex文件 My Documents/Course/Paper/MasterTexFile.tex 代码

我想做的是在一个方便的目录中创建一个“主”bibtex参考书目(通过JabRef组织),这样我就不需要将每个项目的新参考文献复制到主数据库中。我遇到的问题是,虽然我可以很容易地引用另一个文件(例如,用于STATA回归表输出),但即使它不在同一目录中,参考书目也不希望合作

出于本例的目的,我在中创建了一个虚拟目录

    My Documents/Course/Paper. 
下的Tex文件

    My Documents/Course/Paper/MasterTexFile.tex 
代码中引用的示例Tex文件(简称为Text)位于

    My Documents/Course/Text.tex.
我的理想是将参考书目放在一个更通用的目录中,但为了便于说明,我将其放在工作tex文件的正上方。文件编号如下:

    \documentclass[12pt,titlepage]{article}
    \usepackage[round,longnamesfirst]{natbib} 
    \usepackage{setspace}
    \doublespacing
    \usepackage[margin=1in]{geometry}
    \usepackage{hyperref} 
    \hypersetup{
    pdftitle={TITLE},    
    pdfauthor={AUTHOR},     
    pdfsubject={SUBJECT},
    pdfkeywords={KEYWORD} {KEYWORD} {KEYWORD}, 
    colorlinks=true,
    linkcolor=blue,              
    citecolor=blue,
    filecolor=magenta,      
    urlcolor=blue           
    }

    \begin{document}
    \title{TITLE}
    \date{\today}
    \author{AUTHOR\\STUDENT NUMBER}
    \maketitle
    %Begin Document Text
    \pagestyle{headings}
    \section{Introduction}
    \cite{Shapiro2015} %Example citation from my database
    \input{../Text} %this comes from the directory ABOVE that of the current file.
    %\input{../00 Master Bibliography} %This was inputted using the user interface (Texmaker). I have it here just to demonstrate that it is truly in the directory.

    %References
    \newpage
    \bibliographystyle{plainnat} 
    \bibliography{../00 Master Bibliography}
    %\bibliography{00_Master_Bibliography} %If the database is in the directory, everything works fine.
    \end{document}
文档进行编译(我按顺序使用PdfLatex、BibTex、PdfLatex x2),并正确引用文本文档(其中仅包含单词“Text”),但我发现以下错误:

    Package natbib Warning: Citation `Shapiro2015' on page 1 undefined on input line 40.
    Package natbib Warning: Empty `thebibliography' environment on input line 8.
    Package natbib Warning: There were undefined citations.
注意:为了简洁起见,我删除了一些注释行,因此如果您将其复制到编辑器中,行号将不同

如果找不到数据库,这些是可以预料的,但我不知道为什么找不到。这和纳比布有关吗?natbib包的一个特性是不能从当前文件以外的任何目录引用数据库吗?这似乎不太可能


任何帮助都将不胜感激

嗯,我们有一个简单的解决办法。我不确定这是我在参考书目名称之前的“00”(我添加了“00”以确保它位于文件夹中文件列表的顶部),还是这些文件与“参考书目”之间的空格,但将文件名称改为“参考书目”很有效

这些错误与给定的文档不一致(例如,第40行和第8行,与您的代码不匹配)。如问题中所述,我在代码中有许多行注释(我创建了临时注释横幅来分隔各个部分),为了简洁起见,我在这里删除了它们。