0

I am trying to work on a paper with specific size : 240mm x 160 mm. To generate my paper I am using pdflatex from texlive.

I used to do this :

\usepackage{ifpdf}
\ifpdf
  \pdfpageheight=240mm
  \pdfpagewidth=160mm
\else
  \special{papersize=240mm,160mm}
\fi

It was working perfectly, but it is not compatible with TikZ (see my previous thread).

Someone told me to use geometry: unfortunately, it doesn't seem to work. Here is my rather simple code :

\documentclass[12pt,twoside,draft]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\usepackage{geometry}
\usepackage[paperheight=240mm,paperwidth=160mm]{geometry}

\pdfpagewidth=\paperwidth
\pdfpageheight=\paperheight
\begin{document}
\end{document}

Unfortunately, the page is not correctly shaped... Any help would be really appreciated!

6
  • Why are you messing with \pdfpage... geometry will do that for you, has done for years
    – daleif
    Commented Apr 3, 2020 at 10:01
  • 2
    And don't ignore errors. You cannot load geometry twice where the first is without options and the latter is with options.
    – daleif
    Commented Apr 3, 2020 at 10:03
  • Thanks for your help, I havent seen the double geometry loading... I must have been working on this for too long ! It is all good now, thanks again.
    – Guliup
    Commented Apr 3, 2020 at 10:13
  • 1
    Don't remove your mistake from the MWE, then your question will no longer make any sense
    – daleif
    Commented Apr 3, 2020 at 10:20
  • 1
    Note we rolled back your edit so the question still makes sense.
    – daleif
    Commented Apr 3, 2020 at 10:48

1 Answer 1

2

Don't ignore compilation errors

\usepackage{geometry}
\usepackage[paperheight=240mm,paperwidth=160mm]{geometry}160mm]{geometry}

gives an option class error. Remove the first line and the generated PDF has the correct size

2
  • Thank you, my bad ! I am working on an online editor which is not showing compilation errors.
    – Guliup
    Commented Apr 3, 2020 at 13:46
  • @Guliup may I ask which online editor? No respectful online editor hides compilation errors
    – daleif
    Commented Apr 3, 2020 at 14:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .