0

I am currently developing a thesis. I'm using a template that utilizes the

\usepackage[notes, isbn = false, backend=biber]{biblatex-chicago}

My references section is written like so:

\printbibliography[title={REFERENCES},heading=bibintoc,env=bibliography]
\begin{thebibliography}
\bibliography{refs.bib}
\end{thebibliography}

When hover over

\bibliography{refs.bib}

I receive the following warning

can only be used in preamble

I've already looked at the post: https://ko.overleaf.com/learn/latex/Errors/LaTeX_Error%3A_Can_be_used_only_in_preamble.

The full code for my thesis.tex is

\documentclass[12pt,oneside]{report} %use "twoside for two-sided numbering
% \documentclass[12pt,oneside]{turabian-thesis}
\usepackage[notes,natbib,isbn=false,backend=biber]{biblatex-chicago}  


%added by me
\usepackage{subcaption}

\usepackage{mathptmx}
\usepackage{gsuthesisETD,multicol,amssymb,amsthm,amsmath,graphicx,geometry}
%%%MY additions
\usepackage{caption}
%for bibliography
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{csquotes, ellipsis}
\MakeOuterQuote{"}
\usepackage[notes, isbn = false, backend=biber]{biblatex-chicago}
\addbibresource{refs.bib}

\geometry{letterpaper,left=1.3 true in, right=1.2 true in, top=1in, 
          headheight =12pt, headsep =20pt, footskip =1in}
\usepackage[colorinlistoftodos]{todonotes}
\usepackage{indentfirst}
%Toggles: "true" or "false" 
\tablespagetrue   
\figurespagetrue 
\symbolpagefalse  
\dedicationpagetrue
\acknowledgmentspagetrue
\copyrightpagetrue
\sectionnumberstrue

% Fill in These Fields 
% Mobile Low-latengy AR 
%
\title{Design and Implementation of a Word Match Generator}
\author{E. M. Gertis}
\degree{Master of Science}
\major{Computer Science}
\dept{Department of Computer Science}
\school{Georgia Southern University}
\thesistype{Thesis}
\graduatedate{May 2022}
\graduateyear{2022}
\keywords{Online learning,Computer Science Education, Word Matching} 
\cochair=0  %choose 1 if you have a co-chair
\symbolfile{symbols} % symbols go in the file "symbols.tex"
%\captiontype=1 %not used at this time
\appendname{APPENDICES}  % or APPENDIX for just one
\tocheader{Appendices}
\mybibname{REFERENCES}
\def\deansname{Dean's name} % Do NOT use "Dr." here.
\committeechair{Daniel Liang} % No. Dr.
\committeecochair{Co-advisor} % No Dr. 
\memberC{Andrew Allen}
\memberB{Ryan Florin}  
\degreeA{B.S. Physics, University of North Carolina at Chapel Hill, 2017}


%%%%%%%%%%%%%%%% MACROS %%%%%%%%%%%%%%%%%%%%%%%
%\newtheorem{theorem}{Theorem}[section]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{cor}[theorem]{Corollary}
\newtheorem{rmk}[theorem]{Remark}
\newtheorem{prop}[theorem]{Proposition}
\newtheorem{example}[theorem]{Example}
\newtheorem{dfn}[theorem]{Definition}
\newtheorem{ass}[theorem]{Assumption}
\newcommand{\RR}{{\mathbb R}}
\newcommand{\CC}{{\mathbb C}}
\newcommand{\ZZ}{{\mathbb Z}}
\newcommand{\NN}{{\mathbb N}}
\newcommand{\rank}{{\rm rank}}

\usepackage{dirtytalk}
% \usepackage[options ]{algorithm2e}

%%%%%%%%%%%%%%%%%%%%% Main Document %%%%%%%%%%%%%%%%%%%
% \makeatletter
% \def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
%                       \if@mainmatter
%                          \refstepcounter{chapter}%
%                          \typeout{\@chapapp\space\thechapter.}%
%                          \addcontentsline{toc}{chapter}%
%                                   {\protect\numberline{\thechapter}#1}%
%                       \else
%                          \addcontentsline{toc}{chapter}{#1}%
%                       \fi
%                     \chaptermark{#1}%
% %                    \addtocontents{lof}{\protect\addvspace{10\p@}}% NEW
% %                    \addtocontents{lot}{\protect\addvspace{10\p@}}% NEW
%                     \if@twocolumn
%                       \@topnewpage[\@makechapterhead{#2}]%
%                     \else
%                       \@makechapterhead{#2}%
%                       \@afterheading
%                     \fi}
% \makeatother
\begin{document}

%  Version: \today  % Comment this out for final version

  \input{abstract}
  \titlep            
  \copyrightpage  %optional (comment out if not used)
  \approvalpage      
  \input{dedication}  %optional
  \input{acknowledgments} %optional
  \tableofcontents 
  \include{1-Introduction}
 \include{2-RelatedWorks}
 \include{3-Methodology}
  \include{4-Results}
  \include{5-Conclusion}
  \include{6-FutureWorks}
  

  %\include{appendix}
  
%\scriptsize

% \bibliographystyle{chicago}
% \bibliography{refs.bib}

\renewcommand{\bibsetup}{\thispagestyle{myheadings}}
\printbibliography[title={REFERENCES},heading=bibintoc,env=bibliography]
\begin{thebibliography}
\bibliography{refs.bib}
\end{thebibliography}

\end{document}

Expected: The references section should be populated with references.

Actual: only refs.bib is shown

trying the sample


% !TeX TS-program = pdflatex

\documentclass[oneside]{report} %use "twoside for two-sided numbering

\usepackage[notes, isbn = false, backend=biber]{biblatex-chicago}

\begin{filecontents*}{refs.bib}       
    @online{knuthwebsite,
        author = "Donald Knuth",
        title = "Knuth: Computers and
        Typesetting",
        url = "http://www-csfaculty.stanford.edu/~uno/abcde.html",
        keywords = "latex,knuth"
    }
    
    @Book{latexCompanion,
        author       = {Frank Mittelbach, Michael Goossens},
        title        = {The \LaTeX Companion},
        publisher    = {Addison Wesley},
        year         = {2004},      
    }
\end{filecontents*}

\addbibresource{refs.bib} %<<<<<<<<<<<<<<<<<<<<

\begin{document}
    See    \cite{latexCompanion}  and \cite{knuthwebsite}.
    
\printbibliography[title={REFERENCES},heading=bibintoc,env=bibliography]
\end{document}

Produces

enter image description here

6
  • 1
    as Mico says, delete \begin{thebibliography} \bibliography{refs.bib} \end{thebibliography} Jan 29, 2022 at 17:26
  • 2
    Additional to what Mico and David have said, you load biblatex-chicago twice. While the combination in your document will not produce an error, loading packages multiple times has the potential to cause errors and should thus be avoided if at all possible. Remove one of the two \usepackage[...]{biblatex-chicago} lines in your preamble.
    – moewe
    Jan 29, 2022 at 17:28
  • 1
    Note that it is perfectly possible that your document still does not compile as desired even if you fix the issues discussed here. First of all you may want to clean the Overleaf cache after you remove the excess code (overleaf.com/learn/how-to/Clearing_the_cache). But even then it is possible that there are errors in files you have not shown us (refs.bib or one of the \included files). You will have to read the error messages (overleaf.com/learn/how-to/…) to try and figure out what is wrong.
    – moewe
    Jan 29, 2022 at 17:30
  • 1
    It is possible that the new example does not work because it includes a new refs.bib, which does not overwrite your existing file (which is a good thing). Rename the file as in \begin{filecontents*}{exrefs.bib} and \addbibresource{exrefs.bib} in the example.
    – moewe
    Jan 29, 2022 at 18:28
  • To make sure you're overwriting the existing version(s) of refs.bib, write \begin{filecontents}[overwrite]{refs.bib} . And, be sure run latex-biber-latex.
    – Mico
    Jan 29, 2022 at 18:46

2 Answers 2

0

Please try this simple example.

UPDATE

(1) Run latex example.tex

(2) Run biber example

(3) Run latex example.tex

Many tex editors can be configured to follow this steps automatically. (I am using TeXstudio)

b

% !TeX TS-program = pdflatex

\documentclass[oneside]{report} %use "twoside for two-sided numbering

\usepackage[notes, isbn = false, backend=biber]{biblatex-chicago}

\begin{filecontents*}{refs.bib}       
    @online{knuthwebsite,
        author = "Donald Knuth",
        title = "Knuth: Computers and
        Typesetting",
        url = "http://www-csfaculty.stanford.edu/~uno/abcde.html",
        keywords = "latex,knuth"
    }
    
    @Book{latexCompanion,
        author       = {Frank Mittelbach, Michael Goossens},
        title        = {The \LaTeX Companion},
        publisher    = {Addison Wesley},
        year         = {2004},      
    }
\end{filecontents*}

\addbibresource{refs.bib} %<<<<<<<<<<<<<<<<<<<<

\begin{document}
    See    \cite{latexCompanion}  and \cite{knuthwebsite}.
    
\printbibliography[title={REFERENCES},heading=bibintoc,env=bibliography]
\end{document}
2
  • I tried that sample and I've updated the question. Jan 29, 2022 at 18:22
  • 1
    @Evan Gertis You got the output of the first run of latex filename.tex. To finish run biber filename and then again latex filename.tex Jan 29, 2022 at 19:20
-1

Go to this template: https://www.overleaf.com/project/61f59396422d8b8209e837b0. https://www.overleaf.com/latex/examples/hello-world-example/cfqtqqkdkpqg

  1. Change documentclass to article.
  2. Use
\bibliographystyle{plain}
\bibliography{refs.bib}
1
  • This is BiBTeX route while OP want to use Biblatex. Furthermore plain.bst doesn't produce chicago style. There is a chicago.bst on CTAN (not tested). Question tex.stackexchange.com/q/35233/33514 might help.
    – Jhor
    Feb 24, 2023 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .