Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following MWE prints a cumulative bibliography, subdivided by chapter, using biblatex. I would like to use the pagestyle called special within the bibheading definition rather than invoking it explicitly at the end of my document. I would also like that once the bibliography is printed the 'main' pagestyle is reestablished. So, is it possible to use a pagestyle (defined with titlesec) within a bibheading definition in biblatex? And can that pagestyle scope be limited to just the bibliography?

\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}

Where bar.bib is

@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}
}
share|improve this question
    
What about using \preto{\bibbysegment}{\pagestyle{special}}? –  Guido Apr 5 '13 at 23:58
    
@Guido That is perfect for the bibliography segment, but I also want to restablish the main style afterwards. I tried using \appto{\bibbysegment}{\pagestyle{main}} but that obviously didn't work. Any idea on how to restablish the main style for subsequent pages? –  petobens Apr 8 '13 at 5:08
    
I did some tests and, for some reason, the settings I suggested in my answer don't work in your MWE; unfortunately, I couldn't find a way to automatically restore the page style after the bibliography, so I am deleting my answer. –  Gonzalo Medina Apr 9 '13 at 23:50
    
@GonzaloMedina Thanks for the attempted solution. I edited my question accordingly. –  petobens Apr 10 '13 at 4:13
    
Would \preto{\chapter}{\cleardoublepage\pagestyle{main} be an acceptable solution for restoring the main style after the bibliography? –  Guido Apr 25 '13 at 10:56

1 Answer 1

up vote 2 down vote accepted

You can use the following code whereby the new hook \AfterRefsegments is defined:

\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}}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.