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

enter image description here

Here a MWE:



\setlength{\oddsidemargin} {2. cm}
\setlength{\evensidemargin} {2. cm}
\addtolength{\oddsidemargin} {-0.4 cm}
\addtolength{\evensidemargin} {-0.4 cm}

\renewcommand{\captionfont}{\normalfont \sffamily \itshape \small}

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


\thispagestyle{empty} \normalfont \cleardoublepage
\thispagestyle{empty}  \cleardoublepage
\thispagestyle{empty} \vspace*{.75truecm} \cleardoublepage
\thispagestyle{empty} \vspace*{.75truecm} \normalfont \cleardoublepage
\pagestyle{plain}\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}} 
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}         






% ---- Bibliography ----


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




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:



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





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
  • 1
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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