# Altering the chapter command causes bibliography to be treated as a chapter

I have redefined the chapter command to autolabel all chapters:

\renewcommand\chapter[1]{
\capitalizewords[q]{#1}
\noblanks[q]{\thestring}
\origchapter{#1}\label{chap:\thestring}}


This works great, except I find that it causes a bibliography, created with biblatex and the \bibliography command, to be rendered incorrectly as a chapter rather than as the bibliography. The bibliography title page is messed up (says "Chapter WHATEVERCHAPTERNUMBER: *") and the table of contents lists "*" as a chapter. Otherwise the bibliography is rendered correctly. Anyone know what is causing this? I will be happy with a hacky solution, like an if statement in the renewcommand block that prevents just calls the original chapter command when it's handling the bibliography.

### Minimal Working Example

The bibliography is being generated with a template. I have extracted the following code from the template file to create a minimal working example. Compiling the code below won't produce a table of contents, but it does produce the Bibliography as a Chapter named "*":

\documentclass[11pt]{report}
\usepackage{amsmath}
\usepackage{stringstrings}
\usepackage[noadjust,verbose,sort]{cite} %   arranges reference citations neatly

\begin{document}

\newcommand{\ls}[1]
{\dimen0=\fontdimen6\the\font
\lineskip=#1\dimen0
\lineskiplimit=.9\lineskip
\baselineskip=\lineskip
\normallineskip\lineskip
\normallineskiplimit\lineskiplimit
\normalbaselineskip\baselineskip
\ignorespaces
}

\def\thebibliography#1{
\ls{1}
\chapter*{Bibliography\@mkboth
{BIBLIOGRAPHY}{BIBLIOGRAPHY}}
\markright{}
%\thispagestyle{myheadings} % commented out to force page numbers to bottom center (8/11/07 change by C. St. Jean)
%\thispagestyle{empty}
\pagebreak
\vskip 50pt
\vspace*{0.61 in}%{0.75in}
\centerline{\Large \bf Bibliography}\par \nobreak
%\vskip 40pt
\vskip 55pt
\list
{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
\usecounter{enumi}}
\def\newblock{\hskip .11em plus .33em minus .07em}
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode\.=1000\relax}

\let\origchapter=\chapter
\renewcommand\chapter[1]{
\capitalizewords[q]{#1}
\noblanks[q]{\thestring}
\origchapter{#1}\label{chap:\thestring}}

% \tableofcontents

\chapter{The Story of Life}
Let there be light! \cite{Amaral:2007ua}

\bibliographystyle{plain}
\bibliography{testbib}

\end{document}


You'll also need to put this in a bibtex file testbib.bib

@article{Amaral:2007ua,
author = {Amaral, DG and Lavenex, P.},
title = {{Hippocampal neuroanatomy}},
journal = {The Hippocampus Book},
year = {2007},
volume = {1},
number = {3},
pages = {37--114}
}

-
Which document class do you use? Do you use biblatex or bibtex? The reason I ask is that with biblatex, one would use the command \printbibliography rather than \bibliography to make LaTeX insert the formatted bibliography (including sectioning header). –  Mico Nov 22 '13 at 2:37
@Mico I'm using bibtex and a document class of report –  Sean Mackesey Nov 22 '13 at 2:42
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Marco Daniel Nov 22 '13 at 8:35
@MarcoDaniel MWE added. Thanks for the suggestion and your help! –  Sean Mackesey Nov 22 '13 at 23:24
So how do you want the bibliography to be rendered? Like a regular \chapter* (just a chapter heading but no Chapter X title)? –  Werner Nov 22 '13 at 23:43

I find that you gain absolutely nothing with automatically generated labels. But the document is yours and, if you find convenient to call

\ref{chap:TheStoryOfLife}


then it's your problem and not mine. ;-)

However, the error is in redefining \chapter, so that it can't recognize the * after it. You have to redefine the internal command \@chapter which is called when no * appears.

Another error is using \@mkboth in a context where @ is not a letter.

\begin{filecontents*}{\jobname.bib}
@article{Amaral:2007ua,
author = {Amaral, DG and Lavenex, P.},
title = {{Hippocampal neuroanatomy}},
journal = {The Hippocampus Book},
year = {2007},
volume = {1},
number = {3},
pages = {37--114}
}
\end{filecontents*}

\documentclass[11pt]{report}
\usepackage{amsmath}
\usepackage{stringstrings}
\usepackage[noadjust,verbose,sort]{cite} %   arranges reference citations neatly

\begin{document}

\newcommand{\ls}[1]
{\dimen0=\fontdimen6\the\font
\lineskip=#1\dimen0
\lineskiplimit=.9\lineskip
\baselineskip=\lineskip
\normallineskip\lineskip
\normallineskiplimit\lineskiplimit
\normalbaselineskip\baselineskip
\ignorespaces
}

\makeatletter
\def\thebibliography#1{%
\ls{1}%
\chapter*{Bibliography\@mkboth{BIBLIOGRAPHY}{BIBLIOGRAPHY}}%
\pagebreak
\vskip 50pt
\vspace*{0.61 in}%{0.75in}%
\centerline{\Large \bfseries Bibliography}\par \nobreak
\vskip 55pt
\list
{[\arabic{enumi}]}{\settowidth\labelwidth{[#1]}\leftmargin\labelwidth
\usecounter{enumi}}%
\def\newblock{\hskip .11em plus .33em minus .07em}%
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode\.=1000\relax}

% redefine \@chapter
\let\orig@chapter=\@chapter
\def\@chapter[#1]#2{%
\capitalizewords[q]{#2}%
\noblanks[q]{\thestring}%
\orig@chapter[#1]{#2}\label{chap:\thestring}%
}
\makeatother

\tableofcontents

\chapter{The Story of Life}
Let there be light! \cite{Amaral:2007ua}

\bibliographystyle{plain}
\bibliography{\jobname}

\end{document}


The filecontents* environment is just to make the example self-contained.

-