BibTeXを使ってTeX文書に参考文献を自動で挿入する方法
準備
tex用ディレクトリを作る
文書ファイルとは別の所がおすすめ
以下そのディレクトリへのパスをpath/to/texdirと表記
BibTeXファイル.bibをpath/to/texdirに配置
参考
文献スタイルファイル.bstをpath/to/texdirに配置
wbydo.iconは電子情報通信学会のsieicej.bstを使っている
環境変数の設定
code:shell
export PATH=/Library/TeX/texbin:$PATH
export TEXINPUTS=path/to/texdir:$TEXINPUTS
export BSTINPUTS=path/to/texdir:$BSTINPUTS
export BIBINPUTS=path/to/texdir:$BIBINPUTS
.texの書き方
code:(sample.tex)
% 略
\begin{document}
なにかすごい研究\cite{citation_key}ではとてもすごいことが知られている
\bibliographystyle{bst_file_name}
\bibliography{bibtex_file_name}
\end{document}
citation_key: 論文を識別するkey。BibTeXファイルに記載されたものと同一のもの
bst_file_name: .bstのファイル名から拡張子を除いたもの
bibtex_file_name: BibTeXファイル(.bib)のファイル名から拡張子を除いたもの
pdf生成コマンド
code:shell
% ptex2pdf -l sample.tex
% pbibtex sample
% ptex2pdf -l sample.tex # <- Warningが出なくなるまで実行
関連