1

I got a template for my dissertation in LaTex and all my references to BibTeX are pointing to the Main page instead of bibliography which is at the end of the document, could you please tell me what I am doing wrong?

The main page code:

\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

example.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 template can be found: https://github.com/UCL/ucl-latex-thesis-templates

I hope it gives better idea now. In this setting it points to the first page instead of to the References at the end of the document.

Thank you

Kat
  • 11
  • Not tested but I don't see a reason for that '\AtBeginDocument{}' try to remove it and test your code again (double compile) – koleygr Aug 10 '17 at 17:41
  • removed it, multiple times compiled, but nothing changed :-( – Kat Aug 10 '17 at 19:01
  • Sorry, but I can not really understand what you are doing there... You ask for nobibliography and also thi trick with saved bibitem doesn't make sense for me... I think it will be better to give a MWE (that means to have some citations and be full compilable to show the problem... I hope somebody who understands your code will help you this way) – koleygr Aug 10 '17 at 20:12
  • it is not my code, it is a template for a dissertation, unfortunately, I don't know LaTex to be able to create or change a template. I am happy to remove anything which is redundant, doesn't make sense or just will help me to make it work. – Kat Aug 10 '17 at 20:49
  • Take a look at this solution: https://tex.stackexchange.com/a/141460/117534, and see if it helps? If you search bibentry hyperref in google, you'll find several questions that appear to have the same problem. – Troy Aug 11 '17 at 01:23

1 Answers1

3

Well, please have a look to the github link you gave. There you will found the explanaition of your error:

enter image description here

After adding

\usepackage{natbib} % <=================================================

to your code it compiles as you wanted. See the following 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}

with the resulting first page linking the references to page two (bibliography):

first page

Mensch
  • 65,388
  • I am not getting that error while compiling, so I didn't try it, but it helped, thank you – Kat Aug 12 '17 at 11:54