我在 LaTex 中获得了论文模板,所有对 BibTeX 的引用都指向主页而不是文档末尾的参考书目,你能告诉我我做错了什么吗?
主页代码:
\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[12pt,msc,a4paper,oneside]{ucl_thesis}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german, english]{babel}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{url}
\usepackage{comment}
\newcommand{\say}[1]{\marginpar{#1}}
\usepackage{multirow}
\usepackage{colortbl}
%\usepackage{subfigure}
\usepackage{appendix}
\usepackage{afterpage}
\usepackage{tikz}
\usepackage{here}
\newcommand{\katnote}{\todo[color=green!40,inline]}
\input{LinksAndMetadata}
\input{FloatSettings} % For things like figures and tables
\input{BibSettings} % For bibliographies
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}
\nobibliography*
\include{LitRew}
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{example}
\end{document}
LinksAndMetadata.tex:
\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage[pdftex,hidelinks]{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\makeatletter
\AtBeginDocument{
\hypersetup{
pdfsubject={Thesis Subject},
pdfkeywords={Thesis Keywords},
pdfauthor={Author},
pdftitle={Title},
}
}
\makeatother
FloatSettings.tex:
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\setcounter{dbltopnumber}{2}
\renewcommand{\dbltopfraction}{0.9}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.7}
\renewcommand{\dblfloatpagefraction}{0.7}
BibSettings.tex:
\bibliographystyle{plain}
%contains only this
LitRew.tex:
% fill here some text to make at least one full page
... Even though there exist both, centralized and decentralized, approaches, more common is the centralized approach which is leading to a
mixed integer programming formulation~\cite{VRPbook}. ...
In this section, we introduce different models extending original
Capacitated Vehicle Routing Problem (CVRP) model proposed by Dantzig and Ramser~\cite{dantzig1959truck}. We describe the motivation and mathematical model for five most common models of VRP starting with CVRP. ...
% enter another at least one page of text
例如.bib:
@article{dantzig1959truck,
title={The truck dispatching problem},
author={Dantzig, George B and Ramser, John H},
journal={Management science},
volume={6},
number={1},
pages={80--91},
year={1959},
publisher={Informs}
}
@book{VRPbook,
title={The vehicle routing problem},
author={Toth, Paolo and Vigo, Daniele},
year={2001},
publisher={Society for Industrial and Applied Mathematics}
}
ucl_thesis模板可以在以下位置找到:https://github.com/UCL/ucl-latex-thesis-templates
我希望它现在能给出更好的想法。在此设置中,它指向第一页,而不是指向文档末尾的参考资料。
谢谢
答案1
好吧,请查看您提供的 github 链接。您将在那里找到错误的解释:
添加后
\usepackage{natbib} % <=================================================
它会按照你的需要编译你的代码。请参阅以下 MWE
\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{dantzig1959truck,
title={The truck dispatching problem},
author={Dantzig, George B and Ramser, John H},
journal={Management science},
volume={6},
number={1},
pages={80--91},
year={1959},
publisher={Informs}
}
@book{VRPbook,
title={The vehicle routing problem},
author={Toth, Paolo and Vigo, Daniele},
year={2001},
publisher={Society for Industrial and Applied Mathematics}
}
\end{filecontents}
\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[12pt,msc,a4paper,oneside]{ucl_thesis}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german, english]{babel}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{url}
\usepackage{comment}
\newcommand{\say}[1]{\marginpar{#1}}
\usepackage{multirow}
\usepackage{colortbl}
%\usepackage{subfigure}
\usepackage{appendix}
\usepackage{afterpage}
\usepackage{tikz}
\usepackage{here}
\usepackage{natbib} % <=================================================
\newcommand{\katnote}{\todo[color=green!40,inline]}
\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage[pdftex,hidelinks]{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\makeatletter
\AtBeginDocument{
\hypersetup{
pdfsubject={Thesis Subject},
pdfkeywords={Thesis Keywords},
pdfauthor={Author},
pdftitle={Title},
}
}
\makeatother
\renewcommand{\topfraction}{0.9}
\renewcommand{\bottomfraction}{0.8}
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{4}
\setcounter{dbltopnumber}{2}
\renewcommand{\dbltopfraction}{0.9}
\renewcommand{\textfraction}{0.07}
\renewcommand{\floatpagefraction}{0.7}
\renewcommand{\dblfloatpagefraction}{0.7}
\bibliographystyle{plain}
%contains only this
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}
\nobibliography*
% fill here some text to make at least one full page
... Even though there exist both, centralized and decentralized,
approaches, more common is the centralized approach which is leading to a
mixed integer programming formulation~\cite{VRPbook}. ...
In this section, we introduce different models extending original
Capacitated Vehicle Routing Problem (CVRP) model proposed by Dantzig
and Ramser~\cite{dantzig1959truck}. We describe the motivation and
mathematical model for five most common models of VRP starting with CVRP. ...
% enter another at least one page of text
\addcontentsline{toc}{chapter}{Bibliography}
\bibliography{\jobname}
\end{document}
得到的第一页将参考文献链接到第二页(参考书目):