1

I have the following code:

\documentclass[oneside]{book}  
\usepackage[utf8]{inputenc}  
\begin{document}  
\bibliographystyle{apalike}  
\chapter{Bibliography}  
\begin{thebibliography}{}  
\bibitem[Xyz 2010]{xyz-2010}  
Xyz. et. al. (2010). Blabla.  
\end{thebibliography}  
\end{document}  

This prints one page with the title of the chapter ('Bibliography') and another page with the second heading 'Bibliography'.

I would like to remove the second heading and have everything on one page. The word 'Bibliography' should appear only in the title of the chapter. This chapter should be also visible in the table of contents.

Modifying

\begingroup
\renewcommand{\chapter}[2]{}
\chapter{Bibliography}
\begin{thebibliography}{}
\bibitem[Xyz 2010]{xyz-2010}
Xyz. et. al. (2010). Blabla.
\end{thebibliography}
\endgroup

as suggested here, removes the title of the chapter altogether, whereas adding

\renewcommand\bibname{ }

as suggested here, does not have any effect at all. Most of other solutions I have found is designed for bibliographies using a separate .bib file, so they are not appropriate for me.

1 Answers1

1

Here is the redefinition of the bibliography environment:

\begin{filecontents*}{lib.bib}
@book{goossens93,
    author    = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
    title     = "The LaTeX Companion",
    year      = "1993",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
}
\end{filecontents*}

\documentclass[oneside]{book}  

% Renew bibliography environement
\makeatletter
\renewenvironment{thebibliography}[1]
     {\chapter{\bibname}% <-- this line was changed from \chapter* to \chapter so the number appear
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother


\usepackage[utf8]{inputenc} 
\usepackage{filecontents}

\begin{document}  

\chapter{My Chapter}

Here is a citation \cite{goossens93}.

\bibliographystyle{apalike} 
\bibliography{lib}

\end{document} 

So the bibliography appear as a normal chapter using the chapter numbering system. Adding a * after chapter will bring the bibliography back to normal (no number).

enter image description here

enter image description here

A variant without a bibfile, only using bibitems would be:

\documentclass[oneside]{book}  
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

% Renew bibliography environement
\makeatletter
\renewenvironment{thebibliography}[1]
     {\chapter{\bibname}% <-- this line was changed from \chapter* to \chapter so the number appear
      \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
           {\settowidth\labelwidth{\@biblabel{#1}}%
            \leftmargin\labelwidth
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\makeatother

\begin{document}  

\chapter{My first chapter}

blablabla

\bibliographystyle{apalike} 
\begin{thebibliography}{}  

\bibitem[Xyz 2010]{xyz-2010}  
Xyz. et. al. (2010). Blabla.  

\bibitem{Simpson} Homer J. Simpson. \textsl{Mmmmm...donuts}.
Evergreen Terrace Printing Co., Springfield, SomewhereUSA, 1998

\end{thebibliography}  

\end{document}

Hope it helps.

Romain

RockyRock
  • 1,221
  • 1
    Thanks a lot. However, this method requires me to rewrite the whole bibliography, so it is almost like creating a separate .bib file. Is there any method that does not require this whole effort? – wiktoria May 19 '18 at 20:45
  • 1
    If you already have a bib file, you do not need to use the filecontents environment I have used for the example. You only need to place your bib file in your LateX folder and call \bibliography{your_bib_file}. In what format is your bib file? – RockyRock May 19 '18 at 22:00
  • I don't have .bib file, that is the problem. I have quite a long bibliography directly in the document, like in the first fragment of code I've posted. – wiktoria May 20 '18 at 08:50
  • I have added another method using bibitems in my answer, if I understood correctly it is what you are looking for? Try running the chunk of code for the variant, it should work fine with your case :-) – RockyRock May 20 '18 at 09:01