![如何从前一个恢复`refsection`的参考书目`labelnumber`?](https://linux22.com/image/439713/%E5%A6%82%E4%BD%95%E4%BB%8E%E5%89%8D%E4%B8%80%E4%B8%AA%E6%81%A2%E5%A4%8D%60refsection%60%E7%9A%84%E5%8F%82%E8%80%83%E4%B9%A6%E7%9B%AE%60labelnumber%60%EF%BC%9F.png)
我正在尝试编写课程大纲。但是,参考书目的编号会针对每个小节重置。是否可以从上一个恢复编号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
在构造上,它们之间是完全分开的,因此让它们相互通信并让几个refsection
s 相互影响是极其痛苦的。
对于您的用例,简单的拆分书目设置似乎更有吸引力(请注意,对于数字拆分书目,您通常需要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}
如果您更喜欢在文件中固定分类的方法.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}