我正在使用@moewe 的答案:每章的参考书目和按字母顺序排列的全球参考书目
我希望全局参考书目之后使用的参考文献不包含在其中。以下是来自上述链接的经过修改的 MWE:
\documentclass{report}
\usepackage{chemmacros}
\usepackage[style=chem-acs,articletitle=true,chaptertitle=true,bibencoding=utf8,refsection=chapter,maxbibnames=99]{biblatex}
\addbibresource{test.bib}
\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\addtocategory{cited}{\thefield{entrykey}}}
\makeatletter
\newcount\c@globalpageref
\defbibenvironment{globalbibliography}
{\list
{}
{\setlength{\leftmargin}{\bibhang}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item
\iflistundef{globalpageref}
{}
{\savelist{globalpageref}{\tmpblx@pageref}%
\c@pageref\c@globalpageref
\restorelist{pageref}{\tmpblx@pageref}}}
\protected\def\blx@aux@backref#1#2#3#4#5{%
\ifcsundef{blx@pref@#3@\detokenize{#2}}
{\global\cslet{blx@pref@#3@\detokenize{#2}}\@empty
\expandafter\blx@onlypreamble\csname blx@pref@#3@\detokenize{#2}\endcsname}
{}%
\ifinlistcs{#4}{blx@pref@#3@\detokenize{#2}}
{}
{\listcsgadd{blx@pref@#3@\detokenize{#2}}{#4}}%
\ifcsundef{blx@pref@global@\detokenize{#2}}
{\global\cslet{blx@pref@global@\detokenize{#2}}\@empty}
{}%
\ifinlistcs{#4}{blx@pref@global@\detokenize{#2}}
{}
{\listcsgadd{blx@pref@global@\detokenize{#2}}{#4}}%
\blx@addpagesum{#1}{#5}}
\let\abx@aux@backref\blx@aux@backref
\AtDataInput{%
\ifcsundef{blx@pref@global@\abx@field@entrykey}
{}
{\blx@addpagerefglobal{\abx@field@entrykey}}}
\def\blx@addpagerefglobal#1{%
\begingroup
\blx@tempcnta\z@
\let\blx@tempa\@empty
\def\do##1{%
\appto\blx@tempa{{##1}}%
\advance\blx@tempcnta\@ne}%
\dolistcsloop{blx@pref@global@#1}%
\edef\blx@tempa{\endgroup\noexpand\blx@bbl@listdef
{globalpageref}{\the\blx@tempcnta}{\blx@tempa}}%
\blx@tempa
}
\makeatother
\begin{document}
\chapter{Chapter 1}
Foo foo \autocite{Fujita1999}. Bar Bar \autocite{Felton2007}.
\printbibliography[heading=subbibliography]
\chapter{Chapter 2}
Foo foo \autocite{Fujita1999}. Bar Bar \autocite{Felton2009}.
\printbibliography[heading=subbibliography]
\newrefsection
\nocite{*}
\newrefcontext[sorting=nyt]
\printbibliography[env=globalbibliography, title={Global Bibliography}, category=cited]
\appendix
\chapter{Appendix 1}
Bla ble bli \autocite{Ghadiri1992}. Foo bar \autocite{Fujita1999}.
\printbibliography[heading=subbibliography]
\end{document}
该test.bib
文件是:
@article{Felton2009,
author = {Felton, Greg A. N. and Mebi, Charles A. and Petro, Benjamin J. and Vannucci, Aaron K. and Evans, Dennis H. and Glass, Richard S. and Lichtenberger, Dennis L.},
title = {Review of electrochemical studies of complexes containing the \ch{Fe2S2} core characteristic of [FeFe]-hydrogenases including catalysis by these complexes of the reduction of acids to form dihydrogen},
journal = {Journal of Organometallic Chemistry},
volume = {694},
number = {17},
pages = {2681-2699},
DOI = {https://doi.org/10.1016/j.jorganchem.2009.03.017},
url = {http://www.sciencedirect.com/science/article/pii/S0022328X09001946},
year = {2009},
type = {Journal Article}
}
@article{Felton2007,
author = {Felton, Greg A. N. and Vannucci, Aaron K. and Chen, Jinzhu and Lockett, L. Tori and Okumura, Noriko and Petro, Benjamin J. and Zakai, Uzma I. and Evans, Dennis H. and Glass, Richard S. and Lichtenberger, Dennis L.},
title = {Hydrogen Generation from Weak Acids: Electrochemical and Computational Studies of a Diiron Hydrogenase Mimic},
journal = {Journal of the American Chemical Society},
volume = {129},
number = {41},
pages = {12521-12530},
DOI = {10.1021/ja073886g},
url = {https://doi.org/10.1021/ja073886g},
year = {2007},
type = {Journal Article}
}
@article{Fujita1999,
author = {Fujita, Etsuko},
title = {Photochemical carbon dioxide reduction with metal complexes},
journal = {Coordination Chemistry Reviews},
volume = {185-186},
pages = {373-384},
keywords = {Carbon dioxide reduction
Small molecule activation
Photocatalysis
Carboxylates
Macrocycles
Diimine},
DOI = {https://doi.org/10.1016/S0010-8545(99)00023-5},
url = {http://www.sciencedirect.com/science/article/pii/S0010854599000235},
year = {1999},
type = {Journal Article}
}
@article{Ghadiri1992,
author = {Ghadiri, M. R. and Soares, C. and Choi, C.},
title = {A convergent approach to protein design. Metal ion-assisted spontaneous self-assembly of a polypeptide into a triple-helix bundle protein},
journal = {Journal of the American Chemical Society},
volume = {114},
number = {3},
pages = {825-831},
DOI = {10.1021/ja00029a004},
url = {<Go to ISI>://WOS:A1992HB53700004},
year = {1992},
type = {Journal Article}
}
@article{Ghirlanda2002,
author = {Ghirlanda, G. and Lear, J. D. and Ogihara, N. L. and Eisenberg, D. and DeGrado, W. F.},
title = {A hierarchic approach to the design of hexameric helical barrels},
journal = {Journal of Molecular Biology},
volume = {319},
number = {1},
pages = {243-253},
DOI = {10.1016/s0022-2836(02)00233-4},
url = {<Go to ISI>://WOS:000176042700019},
year = {2002},
type = {Journal Article}
}
如您所见,仅出现在附录中的参考文献(在全局参考文献之后)也包含在全局参考文献中。我希望忽略它们(但是,在附录之后有一个本地参考文献部分,用于引用其中的内容)。
答案1
代码cited
在每个引用键处设置类别。您可以根据您是否在附录中来设置此类别。在下面的代码中,\ifapx
创建了一个布尔值,该布尔值最初为 false,并在附录中(手动)设置为 true。该命令使用此布尔值仅在正文中\AtEveryCitekey
添加类别。cited
代码:
\documentclass{report}
\usepackage{chemmacros}
\usepackage[style=chem-acs,articletitle=true,chaptertitle=true,bibencoding=utf8,refsection=chapter,maxbibnames=99]{biblatex}
\addbibresource{fgtest.bib}
\newif\ifapx
\apxfalse
\DeclareBibliographyCategory{cited}
\AtEveryCitekey{\ifapx\relax\else\addtocategory{cited}{\thefield{entrykey}}\fi}
\makeatletter
\newcount\c@globalpageref
\defbibenvironment{globalbibliography}
{\list
{}
{\setlength{\leftmargin}{\bibhang}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}}
{\endlist}
{\item
\iflistundef{globalpageref}
{}
{\savelist{globalpageref}{\tmpblx@pageref}%
\c@pageref\c@globalpageref
\restorelist{pageref}{\tmpblx@pageref}}}
\protected\def\blx@aux@backref#1#2#3#4#5{%
\ifcsundef{blx@pref@#3@\detokenize{#2}}
{\global\cslet{blx@pref@#3@\detokenize{#2}}\@empty
\expandafter\blx@onlypreamble\csname blx@pref@#3@\detokenize{#2}\endcsname}
{}%
\ifinlistcs{#4}{blx@pref@#3@\detokenize{#2}}
{}
{\listcsgadd{blx@pref@#3@\detokenize{#2}}{#4}}%
\ifcsundef{blx@pref@global@\detokenize{#2}}
{\global\cslet{blx@pref@global@\detokenize{#2}}\@empty}
{}%
\ifinlistcs{#4}{blx@pref@global@\detokenize{#2}}
{}
{\listcsgadd{blx@pref@global@\detokenize{#2}}{#4}}%
\blx@addpagesum{#1}{#5}}
\let\abx@aux@backref\blx@aux@backref
\AtDataInput{%
\ifcsundef{blx@pref@global@\abx@field@entrykey}
{}
{\blx@addpagerefglobal{\abx@field@entrykey}}}
\def\blx@addpagerefglobal#1{%
\begingroup
\blx@tempcnta\z@
\let\blx@tempa\@empty
\def\do##1{%
\appto\blx@tempa{{##1}}%
\advance\blx@tempcnta\@ne}%
\dolistcsloop{blx@pref@global@#1}%
\edef\blx@tempa{\endgroup\noexpand\blx@bbl@listdef
{globalpageref}{\the\blx@tempcnta}{\blx@tempa}}%
\blx@tempa
}
\makeatother
\begin{document}
\chapter{Chapter 1}
Foo foo \autocite{Fujita1999}. Bar Bar \autocite{Felton2007}.
\printbibliography[heading=subbibliography]
\chapter{Chapter 2}
Foo foo \autocite{Fujita1999}. Bar Bar \autocite{Felton2009}.
\printbibliography[heading=subbibliography]
\newrefsection
\nocite{*}
\newrefcontext[sorting=nyt]
\printbibliography[env=globalbibliography, title={Global Bibliography}, category=cited]
\appendix
\apxtrue
\chapter{Appendix 1}
Bla ble bli \autocite{Ghadiri1992}. Foo bar \autocite{Fujita1999}.
\printbibliography[heading=subbibliography]
\end{document}
结果: