0

This question already has an answer here:

I am new to Latex and got the following template from my university. When I try 'build and view' in Texstudio, sometimes it works, but most of the time I get the warning "Over-specification in `h'-direction". Can anyone tell me what's going wrong?

\documentclass[11pt,a4paper]{book}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{picture}
\usepackage{color}
\usepackage{graphpap,color}
\usepackage{subfig}
\usepackage[percent]{overpic}

\usepackage[english]{babel}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
%\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\definecolor{kuleuven}{RGB}{29,141,176}
\definecolor{kuleuven1}{RGB}{82,189,236}
\usepackage{geometry}

\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}

\makeindex
\begin{document}

\frontmatter
\newgeometry{textwidth=540pt,textheight=780pt,top=20pt,left=20pt,right=20pt}
\begin{titlepage}

\begin{figure}[tc]{%
      \begin{overpic}[width=1\textwidth,natwidth=50,natheight=0]{Untitled.png}
        \put(46,6){\color{white}\large{\textbf{FACULTY OF ECONOMICS AND BUSINESS}}}
        \put(69.5,3){\color{white}\large{\textbf{FACULTY OF SCIENCE}}}
      \end{overpic}
    }
\end{figure}

\vspace*{4.5cm}
{\color{kuleuven1}{\Huge  Click and type the title}}

\vspace*{0.5cm}
{\Large Click and type the subtitle}

\begin{figure}[bl]
  %\centering
   \begin{minipage}[c]{0.4\textwidth}  {%
      \begin{overpic}[width=0.9\textwidth,natwidth=300,natheight=370]{Untitled2.png}
        \put(70,45){\begin{minipage}[c]{1.80\textwidth}
\begin{flushright}

{\Large your name} \linebreak
{studentnumber} \linebreak

\textbf{{\large Thesis submitted to obtain \linebreak
the degree of}} \linebreak
\linebreak
{\large MASTER OF FINANCIAL AND ACTUARIAL ENGINEERING}\linebreak
\linebreak
\textbf{{\large Promotor:}}   Prof. Dr. name promotor \linebreak
\textbf{{\large Assistant:}} name assistant
\linebreak

\textbf{{\large Academic year:}} {\large Choose the academic year}
\linebreak
\end{flushright}
  \end{minipage}}
      \end{overpic}
    }
  \end{minipage}


\begin{picture}(540,0.2)
\put(0,0){\colorbox{kuleuven1}{\makebox(540,0.2){}}}
\end{picture}
\end{figure}

\end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\restoregeometry
\setcounter{equation}{1}

\pagestyle{empty}
\tableofcontents

\chapter*{Preface\hfill} \addcontentsline{toc}{chapter}{Preface}

\begin{flushright}
Leuven, 29/06/2012.
\end{flushright}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\mainmatter

\pagestyle{headings}
\chapter{First Chapter}%in the brackets write the title of your chapter

\section{Heading 2}%in the brackets write the title of your section

\subsection{Heading 3}

\paragraph{Name of the Paragraph}

\chapter{Second Chapter}




\begin{thebibliography}{99}\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{plain}
%Examples are given below for bibliography. This isn't the only way,
%feel free to use your own ways, but this is the easiest one.

%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
\bibitem{feller:1968} 
{\sc Feller,\,W.} (1968).
An Introduction to Probability Theory and Its Applications Vol.I, third edition.
{\em}Wiley,\,New York.

%RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
\bibitem{resnick:willekens:1991} 
{\sc Resnick,\,S.I.and Willekens,\,E.}\,(1991).
Moving averages with random coefficients and random coefficient autoregressive models. 
{\em Comm. Statist. Stochastic Models} \,{\bf 7},\,no. 4,\,511--525 


\end{thebibliography}
\vfill

\appendix 
\tocless \chapter{}
\addcontentsline{toc}{chapter}{Appendix}
\section{Appendix}

\newpage
\thispagestyle{empty}
\newgeometry{textwidth=540pt,textheight=780pt,top=20pt,left=20pt,right=20pt}
\begin{figure}[ht]
\begin{flushright}
\includegraphics[width=0.5\textwidth,natwidth=310,natheight=10]{Untitled3.png}  
\end{flushright}
\end{figure}
\vfill
\begin{picture}(550,40)
\put(0,0){\colorbox{kuleuven}{\makebox(520,52){}}}
\end{picture}
\end{document}

\documentclass[11pt,a4paper]{book}
\usepackage{amsmath}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{picture}
\usepackage{color}
\usepackage{graphpap,color}
\usepackage{subfig}
\usepackage[percent]{overpic}

\usepackage[english]{babel}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
%\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\definecolor{kuleuven}{RGB}{29,141,176}
\definecolor{kuleuven1}{RGB}{82,189,236}
\usepackage{geometry}

\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}

\makeindex
\begin{document}

\frontmatter
\newgeometry{textwidth=540pt,textheight=780pt,top=20pt,left=20pt,right=20pt}
\begin{titlepage}

\begin{figure}[tc]{%
      \begin{overpic}[width=1\textwidth,natwidth=50,natheight=0]{Untitled.png}
        \put(46,6){\color{white}\large{\textbf{FACULTY OF ECONOMICS AND BUSINESS}}}
        \put(69.5,3){\color{white}\large{\textbf{FACULTY OF SCIENCE}}}
      \end{overpic}
    }
\end{figure}

\vspace*{4.5cm}
{\color{kuleuven1}{\Huge  Click and type the title}}

\vspace*{0.5cm}
{\Large Click and type the subtitle}

\begin{figure}[bl]
  %\centering
   \begin{minipage}[c]{0.4\textwidth}  {%
      \begin{overpic}[width=0.9\textwidth,natwidth=300,natheight=370]{Untitled2.png}
        \put(70,45){\begin{minipage}[c]{1.80\textwidth}
\begin{flushright}

{\Large your name} \linebreak
{studentnumber} \linebreak

\textbf{{\large Thesis submitted to obtain \linebreak
the degree of}} \linebreak
\linebreak
{\large MASTER OF FINANCIAL AND ACTUARIAL ENGINEERING}\linebreak
\linebreak
\textbf{{\large Promotor:}}   Prof. Dr. name promotor \linebreak
\textbf{{\large Assistant:}} name assistant
\linebreak

\textbf{{\large Academic year:}} {\large Choose the academic year}
\linebreak
\end{flushright}
  \end{minipage}}
      \end{overpic}
    }
  \end{minipage}


\begin{picture}(540,0.2)
\put(0,0){\colorbox{kuleuven1}{\makebox(540,0.2){}}}
\end{picture}
\end{figure}

\end{titlepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\restoregeometry
\setcounter{equation}{1}

\pagestyle{empty}
\tableofcontents

\chapter*{Preface\hfill} \addcontentsline{toc}{chapter}{Preface}

\begin{flushright}
Leuven, 29/06/2012.
\end{flushright}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\mainmatter

\pagestyle{headings}
\chapter{First Chapter}%in the brackets write the title of your chapter

\section{Heading 2}%in the brackets write the title of your section

\subsection{Heading 3}

\paragraph{Name of the Paragraph}

\chapter{Second Chapter}




\begin{thebibliography}{99}\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{plain}
%Examples are given below for bibliography. This isn't the only way,
%feel free to use your own ways, but this is the easiest one.

%FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
\bibitem{feller:1968} 
{\sc Feller,\,W.} (1968).
An Introduction to Probability Theory and Its Applications Vol.I, third edition.
{\em}Wiley,\,New York.

%RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
\bibitem{resnick:willekens:1991} 
{\sc Resnick,\,S.I.and Willekens,\,E.}\,(1991).
Moving averages with random coefficients and random coefficient autoregressive models. 
{\em Comm. Statist. Stochastic Models} \,{\bf 7},\,no. 4,\,511--525 


\end{thebibliography}
\vfill

\appendix 
\tocless \chapter{}
\addcontentsline{toc}{chapter}{Appendix}
\section{Appendix}

\newpage
\thispagestyle{empty}
\newgeometry{textwidth=540pt,textheight=780pt,top=20pt,left=20pt,right=20pt}
\begin{figure}[ht]
\begin{flushright}
\includegraphics[width=0.5\textwidth,natwidth=310,natheight=10]{Untitled3.png}  
\end{flushright}
\end{figure}
\vfill
\begin{picture}(550,40)
\put(0,0){\colorbox{kuleuven}{\makebox(520,52){}}}
\end{picture}
\end{document}

marked as duplicate by Martin Schröder, Stefan Pinnow, Maarten Dhondt, user13907, Zarko Jun 25 '16 at 12:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. – Martin Schröder Jun 25 '16 at 11:35
4
\newgeometry{textwidth=540pt,textheight=780pt,top=20pt,left=20pt,right=20pt}

the left and right margins plus \textwidth have to be the paper width, so you can not specify all of them. You can specify left and right and let it work out \textwidth or specify \textwidth and left and let it work out right

Not the answer you're looking for? Browse other questions tagged or ask your own question.