2016/10/22

CVをtexで作成 出版や講演などの業績リストを複数のbibliographyで管理 (making CV with latex and multiple bibliography files)


もう面倒だからつまづいたところのコードだけ書いておく。
ApJでお馴染み natbib と NASA ADS の bib entry を使うので論文リスト製作が簡単

MacTex2016. 

余白のパラメータがわからんので一覧よこせ(list of margin params)

\usepackage{layout}
\begin{document}

\newpage 
\layout
\end{document}
余白調整済みの結果は右のとおり。

余白に応じたテキスト幅・高さの調整が面倒(auto textwidth and textheight)

プリアンブルのサンプルを置いておく。
texの余白とテキスト幅って独立させる意味あるのだろうか。
他に弄りたいところはlayout参考に。

\topmargin = 10mm  % top margin as you like
\addtolength{\topmargin}{-1in} % default margin subtraction
\marginparsep = 0mm %
\marginparwidth = 0mm %
\oddsidemargin = 20mm % side margin as you like
\addtolength{\oddsidemargin}{-1in} % default margin subtraction
\textheight = \paperheight
\addtolength{\textheight}{-\topmargin}
\addtolength{\textheight}{-\footskip}
\addtolength{\textheight}{-2in} % auto textheight
\textwidth = \paperwidth
\addtolength{\textwidth}{-2\oddsidemargin}
\addtolength{\textwidth}{-2in} % auto textwidth


リストごとにbibファイルを変えたい(日本語で) (multiple bibliography files including NASA ADS biblist)

NASAのADSで得られるbibliographyのエントリーを持ってくる。
"Bibtex entry for this abstruct" のリンクからこんなかんじのやつ↓
もちろんチェックボックスを使ってまとめて入手できる。検索結果リストの下
Retrieve the above records in other formats or sort order
BibTeX with abstracts, sort by date(most recent first)


@ARTICLE{1929PNAS...15..168H,
   author = {{Hubble}, E.},
    title = "{A Relation between Distance and Radial Velocity among Extra-Galactic Nebulae}",
  journal = {Proceedings of the National Academy of Science},
     year = 1929,
    month = mar,
   volume = 15,
    pages = {168-173},
      doi = {10.1073/pnas.15.3.168},
   adsurl = {http://adsabs.harvard.edu/abs/1929PNAS...15..168H},
  adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}

こんなのを複数の .bib ファイルで用意したら以下のように書く

\usepackage{natbib}
\usepackage[resetlabels]{multibib} % use multiple bibliography
\newcites{ths}{Thesis} % define new commands for each bib file
\newcites{book}{Book} % \newcites{label}{headword}
\newcites{proc}{Proceeding}

\begin{document}
...
\bibliographystyle{unsrt} % default bibliography commands
\nocite{*}
\bibliography{paper} % paper.bib

\bibliographystyleths{unsrt} % newly defined bibliography commands
\nociteths{*}
\bibliographyths{thesis} % thesis.bib

\bibliographystyleproc{unsrt}
\nociteproc{*}
\bibliographyproc{proceeding} % proceeding.bib

\bibliographystylebook{unsrt}
\nocitebook{*}
\bibliographybook{book} % book.bib
...
\end{document}

unsrtはbibファイルの内容を順番にリストアップする。他にもソーティングは色々あるが、下に参考URLがあるのでそれを参照。

bibファイルの "@ARTICLE" という部分はデータベースの表示する項目を選ぶようなもので、他にも@thesis, @inproceedings, @misc などがある。それぞれどのような項目が表示されるかもリンク先参照。うまく利用すれば学会や国際会議の発表などもリストアップできる。

TexShop typeset won't work.

これ重要事項。multiple bibliographyを利用する場合はtexshopなどの自動pdf化スクリプトに甘えてはいけない。このせいで半日飛んだぞチキショー。
bibtexでは日本語が使えないので、pbibtexをつかう。
エンコーディングがsjisの場合は陽に指定してやる必要がある。
そんでそいつをtexshopのようにスクリプトにすればいい。

"make.bash"

#!/bin/bash -eu

COMMAND="platex"
ENCODE="sjis"
JOBNAME=${1##*/}
JOBNAME=${JOBNAME%.*}

platex -kanji=$ENCODE "$1" && \
    ls *.aux | xargs -I{} -n1 -P2 pbibtex -kanji=$ENCODE {} && \
    platex -kanji=$ENCODE "$1" && \
    platex -kanji=$ENCODE "$1" && \
    dvipdfmx "$JOBNAME.dvi"  && \
    rm -fv *.aux *.bbl *.blg # cleanup (optional)


これを実行してコンパイルする。気が向いたら結果の画像など用意する。



0 件のコメント: