multibib
と を組み合わせてnatbib
、2つの異なる参考文献(本文用と付録用)を取得しています。サンプルコードは次のとおりです。
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{multibib}
\newcites{apndx}{References}
\begin{document}
First paper to cite: \cite{X1}
\bibliographystyle{ecca}
\bibliography{XXX}
\appendix
Cite a paper in the appendix \citeapndx{X2}
\bibliographystyleapndx{ecca}
\bibliographyapndx{XXX}
\end{document}
しかし、2 番目の参考文献は表示されず、付録の引用には「?」のみが表示されます。マニュアルmultibib
や他の同様の質問を調べましたが、どこにエラーがあるのかわかりません。
更新 1 bibtex ファイルを 2 回実行しても、この現象が発生します。log
ファイルは次のとおりです。
Process started: /Library/TeX/texbin/bibtex "prova".aux
This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: prova.aux
The style file: plain.bst
Database file #1: myrefs.bib
Process exited normally
Process started: /Library/TeX/texbin/bibtex "prova".aux
This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: prova.aux
The style file: plain.bst
Database file #1: myrefs.bib
Process exited normally
更新2: 私のTexStudioが2番目の参考文献へのリンクを生成するファイルを実行できないのが問題だと思いますsec.aux
。このリンクの手順に従いました。https://sourceforge.net/p/texstudio/wiki/Tips%20and%20Tricks/を作成し.cwl
、TexStudio Completion に追加しましたが、まだ機能しません。
答え1
multibib
ファイル の最初のコンパイル実行後の結果(または、この場合は TeXStudio でのコンパイル) を 2 つの新しいファイルと でmwe.tex
使用します。両方のファイルを で実行する必要があります。TeXStudio はファイル に対してで実行しますが、これは自分で行う必要があります。Windows ターミナルでコマンドを実行するだけです。その後、TeXStudio で 2 回コンパイルして結果の PDF を取得できます。pdflatex
mwe.aux
apndx.aux
.aux
bibtex
bibtex
mwe.aux
apndx.aux
bibtex apndx
図のキャプション内でコマンドを実行するには\citeapndx
(コメント内の質問)、\protect
次のようなコマンドを使用する必要があります ( の場合も同様\section
)。
\caption{In figure caption \protect\citeapndx{Johnson2000}}
% ^^^^^^^^
したがって、次のファイルを使用しますmwe.tex
(パッケージは、filecontents
bib ファイルと tex コードの両方を 1 つの MWE コンパイルに含めるためにのみ使用されます)。
% needs: bibtex apndx
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@inproceedings{Creighton2006,
author = {Creighton, Oliver and Ott, Martin and Bruegge, Bernd},
booktitle = {Requirements Engineering, 14th IEEE International Conference},
isbn = {0769525555},
pages = {109--118},
publisher = {IEEE},
title = {{Software cinema-video-based requirements engineering}},
url = {http://ieeexplore.ieee.org/xpls/abs{\_}all.jsp?arnumber=1704054},
year = {2006},
}
\end{filecontents}
\begin{filecontents}{apndx.bib}
@article{Johnson2000,
author = {Johnson, W Lewis and Rickel, Jeff W and Lester, James C},
journal = {International Journal of Artificial Intelligence in Education},
number = {11},
pages = {47--78},
title = {{Animated pedagogical agents: face-to-face interaction in
interactive learning environments}},
volume = {Internatio},
year = {2000},
}
\end{filecontents}
\documentclass[12pt]{article}
\usepackage{natbib}
\usepackage{multibib}
\usepackage{graphicx}
\newcites{apndx}{References in Appendix}
\begin{document}
First paper to cite: \cite{Creighton2006}
\bibliographystyle{ecca}
\bibliography{\jobname}
\appendix
Cite a paper in the appendix \citeapndx{Johnson2000}
%\section{In the appendix \protect\citeapndx{Johnson2000}} % <===========
\begin{figure}
\centering
\includegraphics[width=5cm]{example-image-a}
\caption{In figure caption \protect\citeapndx{Johnson2000}} % <=======
\label{fig:example-image-a}
\end{figure}
\bibliographystyleapndx{ecca}
\bibliographyapndx{apndx}
\end{document}
コンパイルチェーン(TeXStudio から独立):
- Windowsのスタートキーを押してターミナルウィンドウを開き、
R
と入力してcmd
Enterキーを押します。 - TEXコードとBIBファイルがあるディレクトリに移動します。
cd <directory path>
- コマンドを実行します
pdflatex mwe
(必要な.aux
ファイルが 2 つ生成されます) - コマンドを実行
bibtex mwe
(コンパイルmwe.aux
) - コマンドを実行
bibtex apndx
(コンパイルapndx.aux
) - コマンドを実行します
pdflatex mwe
(ファイル*.bbl
とが生成されます*.blg
) - コマンドを実行する
pdflatex mwe
(pdf
参考文献を含むファイルが生成されます)
エディター (TeXStudio、TeXnicCenter など) を使用している場合、エディターはpdflatex mwe
と を実行できますbibtex mwe
が、 は実行できません bibtex apndx
。そのため、Windows ターミナルで TeXStudio を使用して最初のコンパイルを実行した後、このコマンドを実行してください...
コンパイル チェーンを実行すると、次の結果の PDF が得られます。