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 have a 1 inch top margin in all the pages that I have in my DVI file. When I convert this to PDF however the top margin reduces! I am not sure why this is happening. Could someone tell me how to ensure a top margin of at least 1 inch in the PDF?

share|improve this question
6  
Which paper size do you expect to get, letter or A4? Do you produce PDF directly from DVI, using dvipdfmx? If yes, try dvipdfmx -p a4 or dvipdfmx -p letter. In case you produce PDF via Postscript, is the intermediate PS correctly sized? Try dvips -t a4, if not and you want A4. The final PDF should be correctly sized, if you do conversion with ps2pdf -sPAPERSIZE=a4 ... (or similar for letter). For Windows, the option must read -sPAPERSIZE#a4. –  AlexG Jun 28 '11 at 7:59
1  
The following produces constant 1in margins in both DVI and PDF (using dvipdf) for me. It also works when using letterpaper instead. \documentclass[a4paper]{article} \usepackage[margin=1in]{geometry} \usepackage{lipsum} \begin{document} \lipsum[1-20] \end{document} Please provide a MWE by yourself so we can see better what's going wrong. –  Martin Scharrer Jun 28 '11 at 20:03
1  
@rty: Try to use dvips to convert DVI -> PostScript, and then ps2pdf to convert PostScript -> PDF. Then you can specify the appropriate paper size on the dvips command line. For example, to get the A4 paper size, first run dvips -t a4 foo.dvi and then ps2pdf foo.ps foo.pdf. For letter paper size, run dvips -t letter foo.dvi, etc. The paper size specified on dvips command line should match the paper size selected in the Latex source code. –  Jukka Suomela Jun 28 '11 at 20:04
3  
And in future, I strongly recommend that you switch to pdflatex. It will produce a PDF document directly, without any intermediate formats, with the right paper size. –  Jukka Suomela Jun 28 '11 at 20:05
1  
@Martin: (At least my version of) dvipdf internally runs dvips with default settings. Depending on the system configuration, dvips might use letter or A4 paper size by default. Hence if it works for you, it does not necessarily work for someone else... –  Jukka Suomela Jun 28 '11 at 20:08
show 9 more comments

1 Answer 1

As Alexander Grahn suggested - instead of using dvipdf you could do it in two steps:

  1. Run dvips with the desired paper option, such as

    dvips -t a4 file.dvi
    
  2. Run ps2pdf with the desired paper option, it takes the same as gs aka ghostscript, such as

    ps2pdf -sPAPERSIZE=a4 file.ps
    

I recommend using pdfLaTeX for directly producing PDF without those conversions, it has further benefits for example its microtypographic capabilities.

share|improve this answer
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.