2

I am writing a class. I want to set geometry with geometry package, but I get an error

! Package geometry Error: \paperwidth (0.0pt) too short.

My class:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{probs}[2018/07/28]

\RequirePackage{geometry}

\DeclareOption{A5}{
    \geometry{
        paperheight =   8.27in,
        paperwidth  =   5.85in,
        top         =   0.5in,
        bottom      =   0.5in,
        outer       =   0.25in, 
        inner       =   0.25in,
        footskip    =   0.12in,
        headsep     =   0.12in,
        headheight  =   0.12in,
    }
}

\ExecuteOptions{A5}
\ProcessOptions

Testing file:

\documentclass[A5]{probs}


\begin{document}

Hello World!

\end{document}
  • It is actually not that difficult to set up the entire page geometry yourself. The only tricky bit is that the "origin" is 1in below and to the right of the upper left corner, so you will have \topmargin=-.74in etc. – John Kormylo Jul 28 '18 at 19:08
  • @JohnKormylo where can I find the list of lengths that need to be defined? – Michael Fraiman Jul 29 '18 at 12:25
  • Its in the geometry manual. See also https://tex.stackexchange.com/questions/131466/default-layout-is-not-as-expected/131477?s=21|0.0000#131477 – John Kormylo Jul 29 '18 at 13:45

1 Answers1

1

I am not sure about the style, but regarding the error message, you can use \RequirePackage{geometry} after having set the paper width and height.

Using

\setlength{\paperheight}{8.27in}
\setlength{\paperwidth}{5.85in}
\RequirePackage{geometry}

works. You can set any height and width as it is adjusted by geometry afterwards. Full MWE:

%% probs.cls
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{probs}[2018/07/28]

\setlength{\paperheight}{8.27in}
\setlength{\paperwidth}{5.85in}
\RequirePackage{geometry}


\DeclareOption{A5}{
    \geometry{
        paperheight =   8.27in,
        paperwidth  =   5.85in,
        top         =   0.5in,
        bottom      =   0.5in,
        outer       =   0.25in, 
        inner       =   0.25in,
        footskip    =   0.12in,
        headsep     =   0.12in,
        headheight  =   0.12in,
    }
}

\renewcommand\normalsize{\fontsize{10pt}{12pt}\selectfont}

\ExecuteOptions{A5}
\ProcessOptions

and

%% doc.tex
\documentclass{probs}

\begin{document}

Hello World!

\end{document}
nox
  • 4,160
  • 12
  • 26