我正在尝试使用 BibTeX,但此代码的结果是它打印了参考书目标题,但没有显示文件内容sample.bib
。有人发现任何错误吗?谢谢
\documentclass[12pt,a4paper,twoside]{book}
\setcounter{secnumdepth}{3} % number subsubsections
\setcounter{tocdepth}{3} % put subsubsections in ToC
\renewcommand{\thesubsubsection}{\ensuremath{\blacktriangleright}} % no number, fancy glyph
\usepackage{gensymb}
\usepackage{listings}
\usepackage{color}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\usepackage{float}
\restylefloat{figure}
\usepackage[margin=2cm]{geometry}
\usepackage[nottoc]{tocbibind}
\usepackage[hang]{footmisc}
\setlength\footnotemargin{15pt}
\usepackage[justification=centering]{caption}
\usepackage[utf8]{inputenc}
\usepackage[pdftex]{graphicx}
\usepackage[english]{babel}
\usepackage{fixltx2e,bold-extra,geometry,
amssymb,amsmath,mathtools, microtype,url}
\usepackage[bookmarks=true, hidelinks, pdftitle={
THE MANAGEMENT AND PRICING OF WEATHER DERIVATIVES:The case of an HDD Call Option},
pdfauthor={Alessandro Pipitone}]{hyperref}
\pagestyle{headings}
\graphicspath{{images/}}
%%%%%%%%%%%%%%%%% New Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstset{
language=Matlab,
numbers=left,
numberstyle=\footnotesize, stepnumber=1, numbersep=5pt,backgroundcolor=\color{white},
showspaces=false, showstringspaces=false,
showtabs=false, frame=single,
tabsize=2,captionpos=b,
breaklines=true,
breakatwhitespace=false,
escapeinside={\%*}{*)}
}
%
\newcommand{\intentblankpage}{
% Leaves a blank page
\newpage
\null
\vfill
\thispagestyle{empty}
\begin{center}
\textit{This page intentionally left blank.}
%\textit{Questa pagina \`e lasciata intenzionalmente bianca.}
\end{center}
\newpage
}
\def\mclimits_#1{\limits_{\mathclap{#1}}}
%%%%%%%%%%%%%%%% End New Commands %%%%%%%%%%%%
\begin{document}
\input{./titlepage}
\intentblankpage
\pagenumbering{Roman}
\tableofcontents
\chapter*{Introduction} \pagenumbering{arabic}
\addcontentsline{toc}{chapter}{Introduction}
\label{CH:Intro}
\input{./introduzione}
\chapter{The Weather as a Source of Risk}
\label{CH:Teoria}
\input{./capI}
\chapter{Inside the Market: How to Manage Risk Weather}
\label{CH:Val_num}
\input{./capII}
\chapter{Forecasting and Pricing models: A Focus on Temperature}
\label{CH:Val_num}
\input{./capIII}
\chapter{Numerical Implementation of Pricing Models}
\label{CH:Val_num}
\input{./capIV}
\chapter*{Conclusion}
\addcontentsline{toc}{chapter}{Conclusion}
\label{CH:Intro}
\input{./conclusioni}
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\label{CH:Intro}
\input{./Appendix}
\bibliographystyle{unsrt}
\bibliography{sample}
%\listoffigures
\end{document}
我的 bib 文件如下所示
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
答案1
请参阅以下 MWE。我使用 package 将您给定的 bib 文件添加到其中filecontents
。
请注意,您必须更改所用软件包的顺序。不要加载软件包两次。
因为我们没有您的\input
ed 文件,\nocite{*}
所以我添加了所有 bib 条目以打印在参考书目中。
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
\end{filecontents*}
\documentclass[12pt,a4paper,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\setcounter{secnumdepth}{3} % number subsubsections
\setcounter{tocdepth}{3} % put subsubsections in ToC
\renewcommand{\thesubsubsection}{\ensuremath{\blacktriangleright}} % no number, fancy glyph
\usepackage{gensymb}
\usepackage{listings}
\usepackage{color}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\usepackage{float}
\restylefloat{figure}
\usepackage[margin=2cm]{geometry}
%\usepackage{csquotes} % <===============================================
%\usepackage{biblatex}
%\addbibresource{\jobname.bib}
\usepackage[hang]{footmisc}
\setlength\footnotemargin{15pt}
\usepackage[justification=centering]{caption}
\usepackage{graphicx} % <=======================================
\usepackage{%
% fixltx2e,
bold-extra,
% geometry,
amssymb,mathtools, microtype,url
}
\usepackage[%
bookmarks=true, hidelinks,
pdftitle={THE MANAGEMENT AND PRICING OF WEATHER DERIVATIVES:The case of an HDD Call Option},
pdfauthor={Alessandro Pipitone}
]{hyperref}
\pagestyle{headings}
\graphicspath{{images/}}
%%%%%%%%%%%%%%%%% New Commands %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstset{
language=Matlab,
numbers=left,
numberstyle=\footnotesize, stepnumber=1, numbersep=5pt,backgroundcolor=\color{white},
showspaces=false, showstringspaces=false,
showtabs=false, frame=single,
tabsize=2,captionpos=b,
breaklines=true,
breakatwhitespace=false,
escapeinside={\%*}{*)}
}
%
\newcommand{\intentblankpage}{
% Leaves a blank page
\newpage
\null
\vfill
\thispagestyle{empty}
\begin{center}
\textit{This page intentionally left blank.}
%\textit{Questa pagina \`e lasciata intenzionalmente bianca.}
\end{center}
\newpage
}
\def\mclimits_#1{\limits_{\mathclap{#1}}}
%%%%%%%%%%%%%%%% End New Commands %%%%%%%%%%%%
\begin{document}
% \input{./titlepage}
\intentblankpage
\pagenumbering{Roman}
\tableofcontents
\chapter*{Introduction} \pagenumbering{arabic}
\addcontentsline{toc}{chapter}{Introduction}
\label{CH:Introc}
% \input{./introduzione}
\chapter{The Weather as a Source of Risk}
\label{CH:Teoria}
% \input{./capI}
\chapter{Inside the Market: How to Manage Risk Weather}
\label{CH:Val_num}
% \input{./capII}
\chapter{Forecasting and Pricing models: A Focus on Temperature}
\label{CH:Val_numa}
% \input{./capIII}
\chapter{Numerical Implementation of Pricing Models}
\label{CH:Val_numb}
% \input{./capIV}
\chapter*{Conclusion}
\addcontentsline{toc}{chapter}{Conclusion}
\label{CH:Intro}
% \input{./conclusioni}
\chapter*{Appendix A}
\addcontentsline{toc}{chapter}{Appendix A}
\label{CH:Introb}
% \input{./Appendix}
\nocite{*} % <==========================================================
\bibliographystyle{unsrt}
\bibliography{\jobname}
%\listoffigures
\end{document}
以及由此得出的参考书目: