# Problem hyperref package Slide document

I experience some problem with the hyperref package. When I add it, all my document slides to the right and all the content is sliced by the border page. In figure an example of my problem

Here a MWE:

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage{graphicx}
\usepackage{tabularx}
\usepackage[caption=false]{subfig}
\usepackage{afterpage}
\usepackage{booktabs}
\usepackage{color}
\usepackage{colortbl}
\usepackage{amsmath,amssymb}
\usepackage{enumerate}
\usepackage{rotating}
\usepackage{fancyhdr}
\usepackage[scriptsize]{caption}

\setlength{\paperwidth}{16cm}
\setlength{\paperheight}{24cm}
\setlength{\oddsidemargin} {2. cm}
\setlength{\evensidemargin} {2. cm}

\usepackage[latin1]{inputenc}
\renewcommand{\captionfont}{\normalfont \sffamily \itshape \small}

\newcommand{\p}{\partial}
\newcommand{\vect}[1]{\bold {#1} }
\newcommand{\aver}[1]{\left\langle {#1} \right\rangle}

\pagestyle{empty}

\begin{document}
\include{frontespizio}
\thispagestyle{empty} \normalfont \cleardoublepage
\include{dedica}
\thispagestyle{empty}  \cleardoublepage
\pagenumbering{Roman}
\include{sommario}
\thispagestyle{empty} \vspace*{.75truecm} \cleardoublepage
\include{ringraziamenti}
\thispagestyle{empty} \vspace*{.75truecm} \normalfont \cleardoublepage
\pagestyle{plain}\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\pagenumbering{arabic}

\tableofcontents

\listoffigures
\begingroup
\let\clearpage\relax
\listoftables
\endgroup

\include{capitolo1}
\include{capitolo2}
\include{capitolo3}
\include{capitolo4}
\include{capitolo5}
\include{capitolo6}
\include{capitolo7}

\cleardoublepage
% ---- Bibliography ----
\bibliographystyle{unsrt}
\bibliography{mq}
%\nocite{*}

\appendix

\pagestyle{fancy}
\fancyfoot{}
\renewcommand{\chaptermark}[1]{\markboth{\appendixname\ \thechapter.\ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}

\include{appendiceA}
\include{appendiceB}
\include{appendiceC}
\include{appendiceD}
\include{appendiceE}
\include{appendiceF}

\end{document}


Any suggestion?

Thanks for help, Yella

• This problem is not caused by hyperref but by the way you have set your paperwidth. Do you really want to set the width of the paper to be 16cm or is this the width of the text on an a4 paper? – leandriis Nov 25 '17 at 9:26
• welcome to tex.se! from your code fragments is difficult to figured out, what is going wrong. please extend your code snippet to complete small document by adding document body and , which show your problem, also show, where you add hyperref – Zarko Nov 25 '17 at 9:29
• @leandris Thank you for your response. I don't decide the setting because this is a file to write my thesis provided by my university. After reading some thesis i think i could change the width parameter – Yella Nov 25 '17 at 9:32
• Hi @Zarko, thank you too for your response. I update the code in the original past with the complete "main page" – Yella Nov 25 '17 at 9:38
• Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Nov 29 '17 at 14:53

The error you observe seems to be due to the combination of graphicx and setlength{\paperwidth} / \setlength{\paperheight}.

Instead of using thouse commands, I would suggest using the geometry package as shown in the following example:

\documentclass[11pt,a4paper,twoside,openright]{report}

\usepackage{graphicx}

\usepackage[textwidth=16cm,textheight=24cm]{geometry} % <---- (1)
%\usepackage[paperwidth=16cm,paperheight=24cm]{geometry}% <---- (2)
\usepackage[latin1]{inputenc}

\usepackage{lipsum}

\begin{document}

\lipsum

\end{document}


The above example uses a paper of a4 size and sets the width and height of the text block to be 16 and 24 cm respectively. The alternative line (currently commented out, marked with <---- (2)) instead changes the size of the actual paper to be 16 cm x 24 cm.

• Hi @leandriis it seems you suggestion works good. Many thanks. – Yella Nov 25 '17 at 10:33
• @Yella: glad to have helped you. As you have mentioned hyperref in your original question, please keep in mind the correct loading oder of packages. Generally, hyperref should be the last package loaded. A list of exeptions can be found here: tex.stackexchange.com/q/1863/134144 – leandriis Nov 25 '17 at 10:53