[Tex/LaTex] Centering bibliography title in biblatex – tried every suggestion on Google

biblatexhorizontal alignmentsectioning

I know this question has answers on this site already, but none of them worked! I am using biblatex with the historian style for my history day paper. My teacher requires the bibliography heading be centered over the bibliography, and try as I might I can't do it! I tried wrapping \printbibliography with centering and redefining the bibliography string used by biblatex and even redefining \bibname but nothing works. Here's my code (you can try it with your own .bib file to get an output):

\documentclass{memoir}

\usepackage[utf8]{inputenc}
\usepackage [american]{babel}
\usepackage [babel=once, english=american] {csquotes}
\usepackage[backend=bibtex,style=historian,sorting=nty, autocite=footnote,
babel=hyphen, mincrossrefs=1,usetranslator=true,printseries]{biblatex}

\nocite{*}
\bibliography{bib.bib}
\setlength\bibitemsep{2\itemsep}
\setlength\bibhang{30pt}

%This is one of many things I tried that didn't work. If I just change the spelling of bibliography it works fine, but it ignores the centering command.
%\DefineBibliographyStrings{english}{%
%  references = {\begin{center}Bibliography\end{center}},
%}     

\begin{document}
\printbibheading
\printbibliography[keyword=primary,heading=subbibliography,title={Primary Sources}]
\printbibliography[keyword=secondary,heading=subbibliography,title={Secondary Sources}]
\end{document}

Best Answer

There are a few things you could do. (I show two of them.) Since you are using memoir, you have access to a fairly easy set of commands to control section headings. Chapters are more complicated, but there are some pre-defined styles that might fit your needs (e.g., crosshead, culver, and dash).

Anyway, using memoir, you have the commands \setSheadstyle (where S represents sec for sections, subsec for subsections, etc.). Note that this command only affects the styling: for spacing, there are a series of other commands. \secSheadstyle can be used at different points in the document. Below, I suggested you try

\setsecheadstyle{\centering\large\bfseries\itshape} 

and

\setsecheadstyle{\centering\itshape} 

biblatex, on the other hand, has \defbibheading, which has two mandatory and one optional argument. In the below example, we have:

\defbibheading{rene}[\bibname]{% or try `\refname`; both can be redefined
  \section*{#1}% 
  \markboth{#1}{#1}}

So, for example, you could do something like this:

\documentclass[12pt,openany]{memoir}
\usepackage[T1]{fontenc}% usually a good idea for pdflatex
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\usepackage[babel=once, english=american]{csquotes}
\usepackage[backend=bibtex,style=historian,sorting=nty, autocite=footnote,
babel=hyphen, mincrossrefs=1,usetranslator=true,printseries]{biblatex}

\addbibresource{biblatex-examples.bib}% the command \bibliography is deprecated
\setlength\bibitemsep{2\itemsep}
\setlength\bibhang{30pt}

\defbibheading{rene}[\bibname]{%
  \section*{#1}%
  \markboth{#1}{#1}}

\begin{document}
\nocite{*}
% un-redefined \section style
\section{Default Section Style}

% now we redefine styling of \section
\setsecheadstyle{\centering\large\bfseries\itshape}
\printbibheading[heading=rene]
\setsecheadstyle{\centering\itshape}
\printbibliography[keyword=primary,heading=subbibliography,title={Primary Sources}]
\printbibliography[keyword=secondary,heading=subbibliography,title={Secondary Sources}]
\end{document}
Related Question