0

I cannot for the life of me find the answer to this. Here is a full summary of my main.tex:

\documentclass[12pt,twoside]{report}
\usepackage{graphicx}
\usepackage[utf8]{inputenc} 
\usepackage[labelfont=bf]{caption}
\usepackage[a4paper]{geometry}
\geometry{a4paper,total={210mm,297mm},left=25.4mm,top=25.4mm,right=25.4mm,bottom=25.4mm}
\usepackage[version=3]{mhchem}
%\usepackage{float}
%\usepackage{relsize}
\usepackage[table]{xcolor}

\captionsetup[table]{labelsep=space, 
         justification=raggedright, singlelinecheck=off}

%\bibliographystyle{}
\usepackage[nottoc,numbib]{tocbibind}
\usepackage[
            backend=bibtex,
            style=numeric,
            citestyle=numeric,
            sorting=none
            ]{biblatex}
\addbibresource{refs.bib} %Imports bibliography file
\renewcommand{\bibname}{References}

\usepackage{sidecap}
\usepackage{wrapfig}
\usepackage{comment}

\usepackage{diagbox}
\usepackage{listings}
%\usepackage{cite}
\usepackage{amsmath}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage[colorlinks=true, allcolors=blue, linkcolor=black]{hyperref}
\usepackage{upgreek}
\usepackage{physics}
\usepackage{ gensymb }
\usepackage{tikz}
\usepackage[american]{circuitikz}
\usepackage{tikzpagenodes}
\usepackage{listings}
\usepackage[export]{adjustbox}

\usepackage{nameref}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} 


\usepackage{floatrow}
% Table float box with bottom caption, box width adjusted to content
\newfloatcommand{capbtabbox}{table}[][\FBwidth]

\renewcommand{\baselinestretch}{1.1}


\usepackage[explicit]{titlesec}   %for chapter headings in each tex chapter file


\begin{document}
\pagenumbering{arabic}
\include{chapters/Introduction}
\newpage{}
\input{chapters/appendix_a}
\printbibliography %[heading = References]
\end{document}

My bibliography functions, and pulls in correctly, but there is no title. Usually there is a 'references' title. Introduction.tex is:

\titleformat{\chapter}
  {\Huge\bfseries}  
  {\thechapter \enspace Introduction}  %This title is what appears on the page
  {0pt}             
  {}


\chapter{Introduction}\label{Introduction}   %This title is what will appear in the ToC
\fancyhead[RE]{\ref{Introduction} \nameref{Introduction}}
\fancyhead[LO]{\ref{Introduction} \nameref{Introduction}}

\section{Intro}
\begin{itemize}

    \item Outline DM astro evidence to motivate \cite{timea}
\end{itemize}

and refs.bib contains just:

@misc{timea,
    author = "Timea",
    title = {test.py},
    howpublished = {Canvas},
    note = {Accessed: 2021-12-05} ,
    year=2021,
}

Any ideas?

Thanks,

6
  • 2
    your example is incomplete and so can't be tested. Extend it and use if possible biblatex-examples.bib as bib file and cite e.g. \cite{doody}, as this exist on all systems. Feb 17 at 14:36
  • 2
    I add the bib file and \cite myself, there is the title 'Bibliography' which is different from your description. Feb 17 at 14:38
  • I have edited by original post to be as complete as possible. thank you for you responses and in advance for your help! Feb 17 at 15:22
  • 1
    Thanks for the complete (though not minimal) example. Not a solution but a few hints: (1) The problem appears to come from the command \titleformat{chapter}{..., this is from titlesec. I have no solution, but I'm not sure it's OK to put actual text in the label argument? Whereas you wrote \thechapter \enspace Introduction. (2) Remove \renewcommand{\bibname}{References}: it doesn't do much, bc this is biblatex not bibtex. (3) \printbibliography[heading = References] should be \printbibliography[title = References]
    – marquinho
    Feb 17 at 15:35
  • Thankyou @marquinho. Removing the \titleformat fixes the issue, so I can go forward from here and try to figure out how to get what i want. \titleformat was for removing 'chapter' from chapter headings. How do I make use of titleformat appropriately? Feb 17 at 16:00

3 Answers 3

2

This is a cleaned up example that reproduces your problem:

\documentclass{report}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

%\usepackage[nottoc,numbib]{tocbibind}

\usepackage[explicit]
{titlesec}

\begin{document}

%\tableofcontents

\titleformat{\chapter}
  {\Huge\bfseries}  
  {\thechapter \enspace Introduction}
  {0pt}             
  {}

\chapter{Introduction}\label{Introduction}   %This title is what will appear in the ToC

\section{Intro}
\cite{doody}

\printbibliography[title = References]

\end{document}

This gives us: bib without title

I have commented pkg tocbibind out, not knowing exactly what format you want for your bibliography in the TOC. But you can take the following solution and move from there.

My suggestion:

  • (1) Give up the option explicit of the package titlesec, which was suppressing the bibliography header. From the documentation: "with package option explicit, chapter titles must be given explicitly".

  • (2) You can actually keep the \titleformat (in a slightly improved form). Mainly, you want to remove any words of actual text from that format, such as "Introduction", because the command is supposed to be a general formatting directive. Providing a title for a single chapter is a job for, well, \chapter{...}. Good news is: without option explicit, now the commands \chapter{...} and \titleformat work in tandem. The expected titles such as "Introduction" pop up right where you wanted them.

\documentclass{report}

\usepackage{biblatex}
\addbibresource{biblatex-examples.bib}

%\usepackage[nottoc,numbib]{tocbibind}

\usepackage%[explicit]
{titlesec}

\titleformat{\chapter}
  {\Huge\bfseries}  
  {\thechapter\enspace} % no words of text here, and moved to the preamble
  {0pt}             
  {}

\begin{document}

%\tableofcontents

\chapter{Introduction}\label{Introduction}   %This title is what will appear in the ToC AND the text

\section{Intro}
\cite{doody}

\printbibliography[title = References]

\end{document}

The result: bib with title

You can move from here and customize the TOC (with hints from the other answers).

0

What about

\printbibliography[heading=bibintoc, title={References}]

Notice the brackets {}

0

You can enclose the content of your Introduction.tex with \begingroup and \endgroup commands, such as:

\begingroup
\titleformat{\chapter}
  {\Huge\bfseries}
  {\thechapter \enspace Introduction}
  {0pt}
  {}

\chapter{Introduction}\label{Introduction}
\fancyhead[RE]{\ref{Introduction} \nameref{Introduction}}
\fancyhead[LO]{\ref{Introduction} \nameref{Introduction}}

\section{Intro}
\begin{itemize}
\item Outline DM astro evidence to motivate \cite{timea}
\end{itemize}
\endgroup

In this way, the \titleformat command is only applied within that group, and the Bibliography title will appear.

And as @eliasf mentioned in his answer you can use \printbibliography[title={References}] to show a specific title.

1
  • Thank you! This is the solution i am going with. Feb 17 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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