Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the Thesis-template from http://www.latextemplates.com/template/masters-doctoral-thesis.

I have several LaTeX-documents to include in the Appendix. The best solution seems to be compiling each document and using pdfpages to include them. I tried combine, but there were too many conflicts.

The problem is that, although default pdfpages-behaviour should be to center the pdf on the page, it places it in the top-left corner.

Trying to offset it displaces the pages unevenly, as I am using twosided page layout.

I assume this is due to a conflict with the Thesis.cls, that it somehow removes any margins and applies it manually for only its own elements.

Any idea how I could either:

  • Use the offset to place the document appropriately
  • Introduce margins for just the pages with the PDF.

Usage:

\includepdfset{pages=-,pagecommand=\thispagestyle{fancy}}

\includepdf[fitpaper=true]{./../Forstudierapport/forstudierapport.pdf}

Result:

As you can see, the header is properly placed, but the PDF is displaced.

Image of the page

Notes:

\usepackage{geometry} removes margins from the entire document.

Env: Using BasicTeX 2011 from MacTeX. I'm on Mac OS X.7.

share|improve this question
    
While code snippets are useful sometimes, a complete MWE will go all the way in helping those who try to solve your problem -- Kindly add a MWE. BTW giving offset=10mm -14mm as an option to pdfpages may be helpful to you (you have to adjust the values as suitable). –  Harish Kumar May 15 '12 at 13:48
    
I would like to add an MWE, but any document displaying this error would rely on the Thesis.cls and its required packages in order to display the error. –  chknapp May 15 '12 at 15:33
    
I researched further. The problem only occurs when using Thesis.cls The issue is a conflict between Thesis.cls' layout and pdfpages. On both odd and even sides the pdf-page is inserted in the upper left corner. Asking pdfpages to offset the document moves it (correctly) from the centre and outward. This does however position one of the two correctly, while the other moves of canvas. I tried something similar to: \includepdf[pages=-,pagecommand={\ifodd{\addtolength{2in}{1.75in}}\fi}]{documen‌​t.pdf} Any idea what command might add the necessary margins in the pagecommand? –  chknapp May 15 '12 at 15:33
    
Another solution would be to make pdfpages ignore the fact that the document is twoside– making it believe it is oneside. –  chknapp May 15 '12 at 15:39
    
The main problem is that Thesis.cls uses vmargin to set the page parameters. This package is incompatible with pdfpages, unfortunately. You should try and persuade the authors to use geometry: it's not a big deal to change the few relevant lines in Thesis.cls. –  egreg May 15 '12 at 21:13
show 1 more comment

1 Answer

up vote 3 down vote accepted

The main problem is that Thesis.cls uses vmargin to set the page parameters. This package is incompatible with pdfpages, unfortunately; actually it's incompatible with atbegshi which is called by eso-pic.

I know because I found the same issue when some user had similar problems with my frontespizio package that uses atbegshi.

You should try and persuade the authors to use geometry: it's not a big deal to change the few relevant lines in Thesis.cls.

The same setting can be obtained with geometry with

\usepackage{geometry}
\geometry{includehead,includefoot,
  left=1.5in,right=1.0in,
  top=0.6in,bottom=0.8in,
  headheight=20pt,headsep=0.25in,
  footskip=0.3in}
share|improve this answer
    
Modified Thesis.cls as you suggested, by removing the (two) references \vmargin and \setmarginXX. Then simply adding \usepackage[a4paper]{geometry} solved the problem perfectly. Thank you so much for your help! –  chknapp May 15 '12 at 22:08
    
In my case, I had to replace \usepackage{vmargin} with egreg's geometry commands and remove the \setmarginsrb command a few lines down. –  Pieter Sep 27 '13 at 8:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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