LaTeX: 「未定義の引用」警告

LaTeX: 「未定義の引用」警告

このサンプルコードを実行すると、次のようになります。

\documentclass[11pt,a4paper]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage[onehalfspacing]{setspace}
\usepackage{natbib}

\begin{document}

Hello World \cite{greenwood_theoretical_2016}

\end{document}

\bibliography{Bibliography}
\bibliographystyle{plain}

警告が繰り返し表示されます:

'引用 greenwood_theoretical_2016 のページ 1 が入力行 10 で未定義です'

参照は「?' を文書内に含めます。

LaTeXTools私はmacOS High SierraでSublime Text 3.2を使用しています。
ビルダーは「基本的な' なので、次のように実行されます:

pdflatex
bibtex
pdflatex
pdflatex

Zotero から参考文献をエクスポートし (形式: Bibtex、エンコード: UTF-8)、同じディレクトリにある「Bibliography.bib」ファイルをチェックしたところ、引用は正しいようです (例):

@article{greenwood_theoretical_2016,
title = {Theoretical, contemporary observational and palaeo-perspectives on ice sheet hydrology: {Processes} and products},
volume = {155},
issn = {0012-8252},
shorttitle = {Theoretical, contemporary observational and palaeo-perspectives on ice sheet hydrology},
url = {http://www.sciencedirect.com/science/article/pii/S0012825216300095},
doi = {10.1016/j.earscirev.2016.01.010},
urldate = {2018-12-05},
journal = {Earth-Science Reviews},
author = {Greenwood, Sarah L. and Clason, Caroline C. and Helanow, Christian and Margold, Martin},
month = apr,
year = {2016},
keywords = {Geomorphology, Esker, Meltwater, Review, Hydrology, Channel, Glacier, Ice Sheet},
pages = {1--27}

使用biblatex代わりに、natbib参照のラベルを角括弧で囲んで表示します。

こんにちは世界 [greenwood_theoretical_2016]

別のスタイルも試してみましたが、何も変わりませんでした。

これについては多くの質問があったことは承知していますが、ここでは何も機能していないようです。

答え1

指定されたコードにはいくつか問題があります:

  1. コード内での\bibliographystyleと の呼び出し順序を変更する必要があります (スタイルを優先してください)。\bibliography
  2. 読み込みの場合はnatbibスタイルを使用する方が良いでしょうplainnatplain
  3. 参考文献を呼び出す前に、があります\end{document}。つまり、その後のコード\end{document}は実行されません。

次のコードを使用してください:

\RequirePackage{filecontents}
\begin{filecontents*}{Bibliography.bib}
@article{greenwood_theoretical_2016,
  title = {Theoretical, contemporary observational and palaeo-perspectives 
           on ice sheet hydrology: {Processes} and products},
  volume = {155},
  issn = {0012-8252},
  shorttitle = {Theoretical, contemporary observational and 
  palaeo-perspectives on ice sheet hydrology},
  url = {http://www.sciencedirect.com/science/article/pii/S0012825216300095},
  doi = {10.1016/j.earscirev.2016.01.010},
  urldate = {2018-12-05},
  journal = {Earth-Science Reviews},
  author = {Greenwood, Sarah L. and Clason, Caroline C. and Helanow, 
            Christian and Margold, Martin},
  month = apr,
  year = {2016},
  keywords = {Geomorphology, Esker, Meltwater, Review, Hydrology, 
              Channel, Glacier, Ice Sheet, Read Level 3},
  pages = {1--27},
}
\end{filecontents*}


\documentclass[11pt,a4paper]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage[onehalfspacing]{setspace}

\usepackage{natbib}


\begin{document}

Hello World \cite{greenwood_theoretical_2016}

\bibliographystyle{plainnat} % plain
\bibliography{Bibliography} % Bibliography

\end{document}

期待通りの結果が確認できます。

bibtex の結果

参考文献に番号を付けたい場合は、次のオプションnumbersを追加しますnatbib:

\usepackage[numbers]{natbib}

コンパイルする正しいコードbiblatex

\documentclass[11pt,a4paper]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage[onehalfspacing]{setspace}

\usepackage{csquotes}
\usepackage[%
  natbib=true, % <=======================================
  backend=biber, % <=====================================
]{biblatex}
\addbibresource{Bibliography.bib} % Bibliography <=======


\begin{document}

Hello World \cite{greenwood_theoretical_2016}

\printbibliography

\end{document}

結果:

ここに画像の説明を入力してください

答え2

ここでの元の回答の「コマンドは\bibliographystyle{plain}コマンドの前に置くべきだとほぼ確信しています\bibliography{Bibliography}」という部分は、実際には正しくありません。なぜなら、bibtex コンパイルは別々に行われるため、参考文献のスタイルに関する情報がすでに含まれた aux ファイルだけが使用されるからです。(@barbarabeeton と @moewe に感謝します...) もちろん、プログラミングの習慣により、印刷コマンドの前に追加する人が増えるでしょう。なぜなら、「スタイルを取得して印刷する」と言う方が、「印刷する... ああ、忘れないで... このスタイルで必要だ!」と言うよりも人間にとって読みやすいコードになるからです。:P

テストはしていませんが、コマンドは\bibliographystyle{plain}コマンドの前に置く必要があることはほぼ確実です。\bibliography{Bibliography}そして最も重要なのは (ここでは確信しています)、両方のコマンドが コマンドの前に置く必要があることです\end{document}

ぜひお試しいただき、よろしければご回答ください。

関連情報