BibLaTeX 和全球书目编号从 [1] 排序到 [36],使用 refsegment=chapter 和 sorting=none 选项

BibLaTeX 和全球书目编号从 [1] 排序到 [36],使用 refsegment=chapter 和 sorting=none 选项

书中有些部分包含我的文献。我在每一章之后都使用 BiBLaTeX 编制参考书目,并在书的末尾打印全球参考书目。我需要将参考书目显示为文章、书籍、在线、会议等。每个位置都应按在书中出现的位置进行排序,并在括号中显示数字,如下所示

在此处输入图片描述

在全球书目末尾

在此处输入图片描述

所有内容均正确显示。所有条目均按引用顺序处理。我使用 BibLaTeX 的简单选项

\usepackage[sorting=none,defernumbers=true,refsegment=chapter]{biblatex}

我可以添加更多选项,但这并没有什么帮助,只能改善列表——这是我需要的主要想法。为了在章节后打印参考书目,我使用部分选项。

\printbibheading  [title=BIBLIOGRAPHY,heading=subbibliography]
\printbibliography[segment=\therefsegment,type=book,heading=subbibintoc,title={Books},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=article,heading=subbibintoc,title={Articles},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=misc,heading=subbibintoc,title={Online},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subbibintoc,title={Conferences}, resetnumbers=false]

用于打印全球书目

segment=\therefsegment

选项。现在很简单。

问题是编号指的是章节和引用顺序,但我希望相反。全球书目列表现在没问题,应该保留。每本书和每篇文章等(标题)都是按引用顺序排列的,但应该从上到下编号1到最后36位置和编号应从全局书目中取出并出现在章节后的适当位置。例如,全局书目的编号应如下所示

在此处输入图片描述

以这种方式在文章之前1伦·施韦尔。 “可选应变率……有编号[11] 伦·施韦尔。 “可选应变率……并应出现其[11]数字章后

我应该清楚地看到,在全局书目中,我们可以看到从 1 到 36 的出版物,并且在章节之后可以观察到当前章节使用了哪个全局位置。在全局书目中,我们还可以观察到按引用顺序出现的作者姓名,不是吗?

我的工作示例在这里。

\documentclass  [10pt,oneside,a4paper]  {book}

\usepackage     [utf8]                                              {inputenc}
\usepackage     [T1]                                                {fontenc}
\usepackage     [left=3.5cm,right=2.5cm,tmargin=2.5cm,bmargin=2.5cm]{geometry}


\usepackage     [sorting=none,defernumbers=true,refsegment=chapter]{biblatex}
\addbibresource {biblatex-examples.bib}

\usepackage     {silence}
\usepackage     {indentfirst}
\usepackage     {mathpazo}
\usepackage     {setspace}  
\usepackage     {titlesec}

\titleformat{\chapter}[hang]{\raggedright\Large\bfseries}{\arabic{chapter}.\space}{0pt}{}{}
\titlelabel{\thetitle.\space}
\titlespacing*{\chapter}{0pt}{-\baselineskip}{\baselineskip}

\begin{document}

\chapter{Chapter 1}

Lorem\cite{nietzsche:ksa1}~\cite{sigfridsson}~\cite{moraux}~\cite{knuth:ct:c}.

\printbibheading  [title=BIBLIOGRAPHY,heading=subbibliography]
\printbibliography[segment=\therefsegment,type=book,heading=subbibintoc,title={Books},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=article,heading=subbibintoc,title={Articles},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=online,heading=subbibintoc,title={Online},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subbibintoc,title={Conferences}, resetnumbers=false]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 2}}

Lorem~\cite{vizedom:related}~\cite{gerhardt}~\cite{augustine}~\cite{ctan}.

\printbibheading  [title=BIBLIOGRAPHY,heading=subbibliography]
\printbibliography[segment=\therefsegment,type=book,heading=subbibintoc,title={Books},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=article,heading=subbibintoc,title={Articles},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=online,heading=subbibintoc,title={Online},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subbibintoc,title={Conferences}, resetnumbers=false]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 3}}

Lorem~\cite{wassenberg}~\cite{baez/online}.

\printbibheading  [title=BIBLIOGRAPHY,heading=subbibliography]
\printbibliography[segment=\therefsegment,type=book,heading=subbibintoc,title={Books},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=article,heading=subbibintoc,title={Articles},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=online,heading=subbibintoc,title={Online},resetnumbers=false]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subbibintoc,title={Conferences}, resetnumbers=false]

\printbibheading  [title=GLOBAL BIBLIOGRAPHY AT THE END,heading=subbibliography]
\printbibliography[type=book,heading=subbibliography,title={Books},resetnumbers=false]
\printbibliography[type=article,heading=subbibliography,title={Articles},resetnumbers=false]
\printbibliography[type=online,heading=subbibliography,title={Online},resetnumbers=false]
\printbibliography[type=inproceedings,heading=subbibliography,title={Conferences},resetnumbers=false]

\end{document}

答案1

一种选择是不使用defernumbers 而使用 ,presort以确保全局书目排序符合预期。由于实际上您的条目仅在sorting=none,条目类型引起的分组中存在偏差,因此我们在排序时会考虑类型。有几种方法可以做到这一点,但最简单的方法是使用presort

\documentclass[10pt,oneside,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[backend=biber, style=numeric, sorting=none, refsegment=chapter]{biblatex}


\DeclareSortingTemplate{none}{
  \sort{\field{presort}}
  \sort{\citeorder}
  \sort{\intciteorder}
}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \pertype{book}
      \step[fieldset=presort, fieldvalue=aa]
    }
    \map{
      \pertype{article}
      \step[fieldset=presort, fieldvalue=bb]
    }
    \map{
      \pertype{online}
      \step[fieldset=presort, fieldvalue=cc]
    }
    \map{
      \pertype{inproceedings}
      \step[fieldset=presort, fieldvalue=dd]
    }
  }
}


\defbibheading{subsubbibintoc}[\refname]{%
  \subsection*{#1}%
  \addcontentsline{toc}{subsection}{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\tableofcontents
\chapter{Chapter 1}

Lorem \autocite{nietzsche:ksa1}
ipsum \autocite{sigfridsson}
dolor \autocite{moraux}
sit \autocite{knuth:ct:c}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 2}}

Lorem~\cite{vizedom:related}
ipsum~\cite{gerhardt}
dolor~\cite{augustine}
sit~\cite{ctan}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 3}}

Lorem~\cite{wassenberg},
ipsum~\cite{baez/online}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\printbibheading[title=Global bibliography at the end,heading=bibintoc]
\printbibliography[type=book,heading=subbibintoc,title={Books}]
\printbibliography[type=article,heading=subbibintoc,title={Articles}]
\printbibliography[type=online,heading=subbibintoc,title={Online}]
\printbibliography[type=inproceedings,heading=subbibintoc,title={Conferences}]

\end{document}

另一种选择是使用defernumbers,但会弄乱内部结构,因为编号不是由条目出现的第一个参考书目决定,而是由全局参考书目决定。

\documentclass[10pt,oneside,a4paper]{book}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage[
  backend=biber,
  style=numeric-comp,
  sorting=none,
  defernumbers,
  refsegment=chapter,
]{biblatex}


\makeatletter
\newrobustcmd*{\DefernumbersEnable}{%
  \toggletrue{blx@defernumbers}%
  \let\blx@thelabelnumber\blx@addlabelnumber
  \let\abx@aux@number\blx@aux@number}
\newrobustcmd*{\DefernumbersDisable}{%
  \togglefalse{blx@defernumbers}%
  \let\blx@thelabelnumber\relax
  \let\abx@aux@number\@gobblefive}
\makeatother
\AtBeginDocument{%
  \DefernumbersDisable
  \BiblatexSplitbibDefernumbersWarningOff}


\defbibheading{subsubbibintoc}[\refname]{%
  \subsection*{#1}%
  \addcontentsline{toc}{subsection}{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\tableofcontents
\chapter{Chapter 1}

Lorem \autocite{nietzsche:ksa1}
ipsum \autocite{sigfridsson}
dolor \autocite{moraux}
sit \autocite{knuth:ct:c}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 2}}

Lorem~\cite{vizedom:related}
ipsum~\cite{gerhardt}
dolor~\cite{augustine}
sit~\cite{ctan}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\vspace{5mm}
{\let\clearpage\relax \chapter{Chapter 3}}

Lorem~\cite{wassenberg},
ipsum~\cite{baez/online}.

\printbibheading[title=Bibliography,heading=subbibintoc]
\printbibliography[segment=\therefsegment,type=book,heading=subsubbibintoc,title={Books}]
\printbibliography[segment=\therefsegment,type=article,heading=subsubbibintoc,title={Articles}]
\printbibliography[segment=\therefsegment,type=online,heading=subsubbibintoc,title={Online}]
\printbibliography[segment=\therefsegment,type=inproceedings,heading=subsubbibintoc,title={Conferences}]

\DefernumbersEnable % we want the numbering from this bib
\printbibheading[title=Global bibliography at the end,heading=bibintoc]
\printbibliography[type=book,heading=subbibintoc,title={Books}]
\printbibliography[type=article,heading=subbibintoc,title={Articles}]
\printbibliography[type=online,heading=subbibintoc,title={Online}]
\printbibliography[type=inproceedings,heading=subbibintoc,title={Conferences}]
\end{document}

相关内容