以下 MWE 使用 打印按章节细分的累积参考书目biblatex
。我想使用special
bibheading 定义中调用的页面样式,而不是在文档末尾明确调用它。我还希望一旦打印了参考书目,就会重新建立“主”页面样式。那么,是否可以使用页面样式(使用titlesec
) 在 bibheading 定义中biblatex
?并且该 pagestyle 范围是否可以仅限于参考书目?
\documentclass{book}
\usepackage[english]{babel}
\usepackage[pagestyles,outermarks]{titlesec}
\newpagestyle{main}[\scshape]{%
\headrule
\sethead
[\thepage][][\chaptertitlename\space\thechapter. \chaptertitle]
{\ifthesection{\thesection\space\,\sectiontitle}
{\chaptertitlename\space\thechapter. \chaptertitle}}{}{\thepage}
}
\newpagestyle{special}[\scshape]{%
\headrule
\sethead
[\thepage][][\chaptertitle]
{\sectiontitle}{}{\thepage}
}
\pagestyle{main}
\usepackage[style=american]{csquotes}
\usepackage[style=authoryear-comp,refsegment=chapter,backend=bibtex]{biblatex}
% Bibliography at the end:
\defbibheading{bibbook}[\bibname]{%
\chapter*{#1}%
\chaptermark{#1}%
}
\defbibheading{subbib}{%
\section*{\refname\addspace\chaptername\addspace%
\ref{refsegment:\therefsection\therefsegment}}
\sectionmark{\refname\addspace\chaptername\addspace\therefsegment}
% \thispagestyle{plain}
% \pagestyle{special} % I WANT TO PLACE IT HERE
}
\addbibresource{bar.bib}
\usepackage{lipsum}
\begin{document}
\chapter{First}
\lipsum
\section{First Section}
\lipsum[1-5]
\nocite{*}
\chapter{Second}
\nocite{*}
\printbibheading[heading=bibbook]
\pagestyle{special} % I DON"T WANT TO PLACE IT HERE
\bibbysegment[heading=subbib]
\end{document}
哪里bar.bib
@Book{Jac08,
author={M. O. Jackson},
title={Social and Economic Networks},
publisher={Princeton University Press},
edition={2},
address={Princeton, NJ},
year={2008}}
@InBook{NeuNas54,
author={Von Neumann, John and John Nash},
title={Game Theory},
booktitle={Microeconomic Theory},
bookauthor={Andreu Mas Collel},
publisher={Mit Press},
address={Cambridge},
year={1954}}
@InCollection{Sha53,
author={Lloyd Shapley},
title={A value for n-person games},
booktitle={Contributions to the Theory of Games},
editor={Harold Kuhn and Albert Tucker},
volume={2},
translator={Jurgen Pollock},
origlanguage={german},
publisher={Princeton Press},
address={Princeton, NJ},
year={1953}}
@Book{Dur05,
author={Rick Durret},
title={Probability Theory},
edition={3},
publisher={Duxburry Press},
address={Belmont, Ca},
year={2005}}
@InCollection{Tho95,
author={Walter Thomson},
title={Cooperative models of bargaining},
booktitle={Handbook of Game Theory},
volume={2},
editor={Robert Aumman and I. Hart},
publisher={North Holland},
address={Amsterdam},
year={1995}}
@Report{Car10,
author={Xavier Carvalho},
title={The Great Diversification},
type={Working Paper 1624},
institution={National Bureau of Economic Research},
year={2010}}
@InCollection{LopInd83,
author = {Juan Lopez and Ignacio Indigo},
title = {Checking whether smartand work},
booktitle = {Stack Exchange answers},
editor = {Domingo Peron},
publisher = {Latex},
address = {Knuth Place},
year = {1983}
}
答案1
您可以使用以下代码来\AfterRefsegments
定义新的钩子:
\makeatletter
\newrobustcmd\AfterRefsegments[1]{\def\@AfterRefsegments{#1}}
\def\blx@bibbysegment[#1]{%
\def\blx@theheading{bibliography}%
\def\blx@theenv{bibliography}%
\let\blx@theprenote\@empty
\let\blx@thepostnote\@empty
\let\blx@thetitle\@empty
\c@refsegment\@ne
\blx@safe@actives
\setkeys{blx@bbg}{#1}%
\blx@rest@actives
\togglefalse{blx@tempa}%
\blx@refsegments\@AfterRefsegments}
\makeatother
\addbibresource{\jobname.bib}
\preto{\bibbysegment}{\pagestyle{special}}
\AfterRefsegments{\clearpage\pagestyle{main}}