如何从前一个恢复`refsection`的参考书目`labelnumber`?

如何从前一个恢复`refsection`的参考书目`labelnumber`?

我正在尝试编写课程大纲。但是,参考书目的编号会针对每个小节重置。是否可以从上一个恢复编号refsection

在此处输入图片描述

我认为这个问题biblatex:从 73 开始参考编号,而不是从 1 开始labelnumber可以通过修改字段格式来包含答案 。

我的MWE

\begin{filecontents*}{sample.bib}

@book{nise2011control,
    title={Control Systems Engineering},
    author={Nise, Norman},
    edition={6},
    year={2011},
    publisher={John Wiley \& Sons}
}

@book{ogata2010modern,
    title={Modern Control Engineering},
    author={Ogata, Katsuhiko},
    edition={5},
    year={2010},
    publisher={Prentice Hall}
}

@book{williams2007linear,
    title={Linear State-Space Control Systems},
    author={Williams, Robert and Lawrence, Douglas},
    edition={1},
    year={2007},
    publisher={Wiley \& Sons}
}

\end{filecontents*}

\documentclass[11pt]{book}
    
    \usepackage[x11names]{xcolor}
    
    % ========== Citation packages ==========
% BEGIN_FOLD
    \usepackage[style=ext-numeric, maxnames=5, minnames=1]{biblatex}
    \addbibresource{sample.bib}
    \setlength{\bibitemsep}{1.961pt}
    \DeclareFieldFormat{title}{\color{OrangeRed1}\textit{#1}}

% END_FOLD

\begin{document}

\section*{Textbook}

\begin{refsection}
    
    \nocite{nise2011control}
    
    \renewcommand{\cleardoublepage}{}
    
    \printbibliography[heading=none]
    
\end{refsection}


\section*{Other References}

\begin{refsection}
    
    \nocite{ogata2010modern,williams2007linear}
    
    \renewcommand{\cleardoublepage}{}
    
    \printbibliography[heading=none, resetnumbers=2]
    
\end{refsection}

\end{document}

答案1

refsection在构造上,它们之间是完全分开的,因此让它们相互通信并让几个refsections 相互影响是极其痛苦的。

对于您的用例,简单的拆分书目设置似乎更有吸引力(请注意,对于数字拆分书目,您通常需要defernumbers)。如果您更喜欢动态方法,即在文档中决定.tex哪个作品属于哪里,请使用类别

\documentclass[11pt]{book}
\usepackage[x11names]{xcolor}

\usepackage[style=ext-numeric, maxnames=5, minnames=1, defernumbers]{biblatex}
\DeclareFieldFormat{title}{\color{OrangeRed1}\textit{#1}}

\DeclareBibliographyCategory{textbooks}
\addtocategory{textbooks}{nise2011control}

\begin{filecontents*}{\jobname.bib}
@book{nise2011control,
  title     = {Control Systems Engineering},
  author    = {Nise, Norman},
  edition   = {6},
  year      = {2011},
  publisher = {John Wiley \& Sons},
}
@book{ogata2010modern,
  title     = {Modern Control Engineering},
  author    = {Ogata, Katsuhiko},
  edition   = {5},
  year      = {2010},
  publisher = {Prentice Hall},
}
@book{williams2007linear,
  title     = {Linear State-Space Control Systems},
  author    = {Williams, Robert and Lawrence, Douglas},
  edition   = {1},
  year      = {2007},
  publisher = {Wiley \& Sons},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\nocite{nise2011control,ogata2010modern,williams2007linear}

\printbibliography[category=textbooks, heading=subbibliography, title=Textbook]
\printbibliography[notcategory=textbooks, heading=subbibliography, title=Other References]
\end{document}

教材 [1] Norman Nise。《控制系统工程》。第 6 版。John Wiley & Sons,2011 年。 其他参考文献 [2] Katsuhiko Ogata。《现代控制工程》。第 5 版。Prentice Hall,2010 年。 [3] Robert Williams 和 Douglas Lawrence。《线性状态空间控制系统》。第 1 版。Wiley & Sons,2007 年。

如果您更喜欢在文件中固定分类的方法.bib,请使用关键字

\documentclass[11pt]{book}
\usepackage[x11names]{xcolor}

\usepackage[style=ext-numeric, maxnames=5, minnames=1, defernumbers]{biblatex}
\DeclareFieldFormat{title}{\color{OrangeRed1}\textit{#1}}

\begin{filecontents*}{\jobname.bib}
@book{nise2011control,
  title     = {Control Systems Engineering},
  author    = {Nise, Norman},
  edition   = {6},
  year      = {2011},
  publisher = {John Wiley \& Sons},
  keywords  = {textbook},
}
@book{ogata2010modern,
  title     = {Modern Control Engineering},
  author    = {Ogata, Katsuhiko},
  edition   = {5},
  year      = {2010},
  publisher = {Prentice Hall},
}
@book{williams2007linear,
  title     = {Linear State-Space Control Systems},
  author    = {Williams, Robert and Lawrence, Douglas},
  edition   = {1},
  year      = {2007},
  publisher = {Wiley \& Sons},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}

\nocite{nise2011control,ogata2010modern,williams2007linear}

\printbibliography[keyword=textbook, heading=subbibliography, title=Textbook]
\printbibliography[notkeyword=textbook, heading=subbibliography, title=Other References]
\end{document}

答案2

为了解决这个问题,我们包括以下内容

\newcounter{labelnumber}
\setcounter{labelnumber}{1}
\AtEveryBibitem{\addtocounter{labelnumber}{1}}
\AtBeginBibliography{\DeclareFieldFormat{labelnumber}{\thelabelnumber}}

在此处输入图片描述

\begin{filecontents*}{sample.bib}

@book{nise2011control,
    title={Control Systems Engineering},
    author={Nise, Norman},
    edition={6},
    year={2011},
    publisher={John Wiley \& Sons}
}

@book{ogata2010modern,
    title={Modern Control Engineering},
    author={Ogata, Katsuhiko},
    edition={5},
    year={2010},
    publisher={Prentice Hall}
}

@book{williams2007linear,
    title={Linear State-Space Control Systems},
    author={Williams, Robert and Lawrence, Douglas},
    edition={1},
    year={2007},
    publisher={Wiley \& Sons}
}

\end{filecontents*}

\documentclass[11pt]{book}
    
    \usepackage[x11names]{xcolor}
    
    % ========== Citation packages ==========
% BEGIN_FOLD
    \usepackage[style=ext-numeric, maxnames=5, minnames=1]{biblatex}
    \addbibresource{sample.bib}
    
    \setlength{\bibitemsep}{1.961pt}
    \DeclareFieldFormat{title}{\color{OrangeRed1}\textit{#1}}
    
% END_FOLD

\newcounter{labelnumber}
\setcounter{labelnumber}{1}
\AtEveryBibitem{\addtocounter{labelnumber}{1}}
\AtBeginBibliography{\DeclareFieldFormat{labelnumber}{\thelabelnumber}}

\begin{document}

\section*{Textbook}

\begin{refsection}
    
    \nocite{nise2011control}
    
    \renewcommand{\cleardoublepage}{}
    
    \printbibliography[heading=none]
    
\end{refsection}

\section*{Other References}

\begin{refsection}
    
    \nocite{ogata2010modern,williams2007linear}
    
    \renewcommand{\cleardoublepage}{}
    
    \printbibliography[heading=none, resetnumbers=2]
    
\end{refsection}

\end{document}

相关内容