natbib と plainnat を使用して引用と参考文献を並べ替える

natbib と plainnat を使用して引用と参考文献を並べ替える

natbib私は LaTeX で論文を書いています。引用と参考文献のパッケージとスタイルを操作していますplainnat。問題は、引用と参考文献がどのようにソートされているかです。

引用文献を年順(同じ年はアルファベット順)に並べ、参考文献を著者の姓のアルファベット順に並べたいのですが、どうすればよいですか?

私のコード:

    \documentclass[12pt,a4paper]{article}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[left=2.00cm, right=2.00cm, top=2.00cm, bottom=2.00cm]{geometry}
    \usepackage[comma,authoryear,round]{natbib}
    \usepackage[none]{hyphenat} 
    \bibliographystyle{plainnat}
    \setcitestyle{citesep={;}}

    \begin{filecontents}{\jobname.bib}
    @book{A,
     author = {Ho, L. and Auntz, K. and Zwitter, B. F. and Valencia, D.},
     year = {2010},
     title = {Title Example 1},
    }
    @book{B,
     author = {Ho, L. and Yelp, A. and Richter, G. and Gregory, K. T.},
     year = {2005},
     title = {Title Example 2},
    }
    @book{C,
     author = {Ho, L. Abrook, H. and Dolman, R. G. and Fjing, H. and Ho, S. and Xerem, R.},
     year = {2013},
     title = {Title Example 3},
    }
    }
    @book{D,
     author = {Di Bernardo, L. and Mc Daug, C. and Coelho, L},
     year = {2000},
     title = {Title Example 4},
    }
    @book{E,
     author = {Gomes, L. N. L. and Ginoris, Y. P and Brand\~{a}o, C. C. S.},
     year = {2010},
     title = {Title Example 5},
    }
    \end{filecontents}


    \begin{document}
    Hi, this is an example. First a citation \citep{A,B},
then an inline citation \citet{B}.
Another citation \citep{C,D} and
the last one \citep{A,E}
    \bibliography{\jobname}
    \end{document}

観察の結果は次のとおりです。

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

答え1

sortオプションを追加するとnatbib

    \usepackage[sort,comma,authoryear,round]{natbib}

すると、最初に著者名で並べ替え、次に年で並べ替えます。最初に年で並べ替え、次に著者名で並べ替えたいようですが、natbibこれはサポートされていないと思います。

編集:のコピーを変更して、名前ではなく年で最初に並べ替えるのは非常に簡単ですplainnat.bst。これは、例に示されているものではないようですが、おそらく必要なことです。

plainnat.bstまず、現在のディレクトリにのコピーを作成し、 という名前を付けますyearnat.bst。私のマシンでは、次のように実行できます。

$ cp `kpsewhich plainnat.bst` yearnat.bst

関数を以下のように編集しyearnat.bstて変更します。presort

FUNCTION {presort}
{ calc.label
  label sortify
  "    "
  *
  year field.or.null sortify
  "    "
  *
  type$ "book" =
  type$ "inbook" =
  or
    'author.editor.sort
    { type$ "proceedings" =
        'editor.organization.sort
        { type$ "manual" =
            'author.organization.sort
            'author.sort
          if$
        }
      if$
    }
  if$
  *
  "    "
  *
  cite$
  *
  #1 entry.max$ substring$
  'sort.label :=
  sort.label *
  #1 entry.max$ substring$
  'sort.key$ :=
}

これにより、yearフィールドがソート キーの先頭に移動するだけです。

sortここで、上記のオプションと を追加して例をコンパイルします\bibliographystyle{yearnat}。結果は次のとおりです。

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

すべてが最初に年順に並び替えられ、次に著者順に並び替えられていることがわかります。これがどのように機能するかを知りたい場合は、以下をお読みください。翻訳(または を実行しますtexdoc btxhak)。

関連情報