如何更改排序順序以將線上 url 引用放置在參考書目末尾?

如何更改排序順序以將線上 url 引用放置在參考書目末尾?

我希望在學術會議發表後將@misc 條目移到最後,以減少對參考書目中@misc 條目的重視。我喜歡 abbrvnat 呈現參考書目項目的方式。我還使用 natbib 來取得引用次數和壓縮。

預設情況下,它會按作者姓名對引文進行排序(這很好),當沒有可用的作者姓名時,它似乎使用其他內容(標題?)作為參考書目中的排序欄位。

在文件末尾發送所有 @misc 引用,同時保持其相對順序的最簡單方法是什麼?

範例文件:

\documentclass[11pt]{article}
\usepackage[hyphens]{url}
\usepackage[numbers,sort&compress]{natbib}

\begin{document}

Articles: \cite{bogus, greenwade93}

Website: \cite{example}

\bibliographystyle{abbrvnat}
\bibliography{biblio}

\end{document}

\bibliographystyle{myabbrvnat}
\bibliography{biblio}

參考書目範例:

@misc{example,
  title = {{Example.org Home Page}},
  howpublished = {\url{http://example.org/}},
  note = {Accessed: June 2017.}
}

@article{bogus,
  aurhor =  {Bogus Redwade},
  title = {A Bogus Article},
  year = {1993},
}

@article{greenwade93,
  author  = {George D. Greenwade},
  title   = {The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})},
  year    = {1993},
  journal = {TUGBoat},
  volume  = {14},
  number  = {3},
  pages   = {342--351}
}

在該範例中,我希望網站移至清單末尾。如果有多個網站,則應保持其相對順序。

螢幕截圖

答案1

鑑於您願意更改參考書目文件,您可以使用眾所周知的\noopsort解決方法(請參閱https://tex.stackexchange.com/search?q=noopsort) 將雜項條目排序在其餘條目之後。由於排序是按作者進行的,因此您還應該將其他條目的標題欄位變更為作者。對於此解決方案,您不需要變更 -file .bst

例子:

@PREAMBLE{ {\providecommand{\noopsort}[1]{}} }

@misc{example,
  author = {{\noopsort{zzz-example}}{Example.org Home Page}},
  howpublished = {\url{http://example.org/}},
  note = {Accessed: June 2017.}
}

結果:

在此輸入影像描述

或者,biblatex透過根據類型列印單獨的參考部分,可以在不更改參考書目文件的情況下使用它。改編自https://tex.stackexchange.com/a/6966:

\printbibliography[nottype=misc,title={References}]
\vspace{-6mm}
\printbibliography[heading=none,type=misc]

這裡的小問題是,第二個參考書目部分,即使沒有標題,仍然引入了一些需要刪除的額外空間(例如使用負數vspace)。

答案2

我找到了一種方法,但它需要編輯 BST 檔案。這感覺有點矯枉過正。然而,bst 文件似乎確實負責排序。

我首先嘗試更改我認為是條目的關鍵的內容,例如更改@misc{foo,...}@misc{z-foo,...},但這根本沒有效果,所以我更深入地挖掘。

步驟1.編輯bst文件

  1. 將 abbrvnat.bst 複製到專案目錄 ( $ cp /usr/share/texlive/texmf-dist/bibtex/bst/natbib/abbrvnat.bst ./myabbrtnat.bst)
  2. 在文件的頂部,請注意​​它說:「具有相同作者和年份的作品將按引用鍵進一步排序,以保留自然順序」 Abbrvnat 首先按作者排序。這可能意味著它與元組排序:(author(s), year, key)

  3. 編輯複製的文件:

    1. 在該ENTRY部分中,在 後面key,添加一個新字段,sortkey在其自己的行中調用。
    2. 有一個author.sort函數。我對其進行了修改以處理“sortkey”字段以覆蓋作者字段:

(某些引文類型不使用作者排序(例如按編輯器排序),因此可能需要根據您的參考書目在其他地方複製)

FUNCTION {author.sort}
{ sortkey empty$
    { author empty$
      { key empty$
          { "to sort, need author or key in " cite$ * warning$
          ""
          }
          { key sortify }
    if$
      }
      { author sort.format.names }
      if$
    }
    { sortkey sortify }
  if$
}

步驟2.使用修改後的BST

  1. 在主乳膠文件中:更改為\bibliographystyle{myabbrvnat}

  2. 對於需要更改順序的每個參考書目項目,新增一個sortkey具有新值的字段,該新值會應用於確定其順序。如果我想最後發送,我會在條目名稱前添加“zz-”

在文本中:

...
Website: F~\cite{example-f}, E~\cite{example-e}, A~\cite{example-a}
...

和書目:

@misc{example-a,
  sortkey = {axample}, % will go before others - starts with 'a'
  title = {{Axample.org Home Page}},
  howpublished = {\url{http://example.org/}},
}

@misc{example-e,
  sortkey = {zzz-example},     % send to the back. prefix with 'zzz-'
  title = {{Example.org Home Page}},
  howpublished = {\url{http://example.org/}},
}

@misc{example-f,
  sortkey = {zzz-fxample},     % send to the back. prefix with 'zzz-'
  title = {{Fxample.org Home Page}},
  howpublished = {\url{http://example.org/}},
}

生產:

結果

相關內容