我目前正在撰写一篇论文。我正在使用一个利用
\usepackage[notes, isbn = false, backend=biber]{biblatex-chicago}
我的参考文献部分写得如下:
\printbibliography[title={REFERENCES},heading=bibintoc,env=bibliography]
\begin{thebibliography}
\bibliography{refs.bib}
\end{thebibliography}
当鼠标悬停在
\bibliography{refs.bib}
我收到以下警告
can only be used in preamble
我已经看过这个帖子了:https://ko.overleaf.com/learn/latex/Errors/LaTeX_Error%3A_Can_be_used_only_in_preamble。
我的 thesis.tex 的完整代码是
\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}
预期:参考文献部分应填充参考文献。
试用样品
% !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}
生产
答案1
请尝试这个简单的例子。
更新
(1)运行乳胶example.tex
(2)运行biberexample
(3)运行乳胶example.tex
许多 tex 编辑器可以配置为自动执行此步骤。(我正在使用 TeXstudio)
% !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
转到此模板:https://www.overleaf.com/project/61f59396422d8b8209e837b0。 https://www.overleaf.com/latex/examples/hello-world-example/cfqtqqkdkpqg
- 将文档类更改为文章。
- 使用
\bibliographystyle{plain}
\bibliography{refs.bib}