5

Consider the code

\documentclass[border=0pt]{book}
\usepackage[paperwidth=5.625in,paperheight=0.125in]{geometry}
%\paperwidth=5.625in \paperheight=0.125in
\usepackage{xcolor}

\pagecolor{red}
\begin{document}
    \pagestyle{empty}
    \par \emph{ }
\end{document}

which produces

enter image description here

Should not only one of these colored rectangles appear?---for, if I replace \usepackage[paperwidth=5.625in,paperheight=0.125in]{geometry} with \paperwidth=5.625in \paperheight=0.125in and run the code

\documentclass[border=0pt]{book}
%\usepackage[paperwidth=5.625in,paperheight=0.125in]{geometry}
\paperwidth=5.625in \paperheight=0.125in
\usepackage{xcolor}

\pagecolor{red}
\begin{document}
    \pagestyle{empty}
    \par \emph{ }
\end{document}

I get what is expected:

enter image description here

QUESTION: Is it the geometry package which is producing this occurrence? What code should I be using in order to produce a color-filled rectangle (in this case) of dimensions 5.625" x 0.125"?

For reasons related to the nature of the project I am working on, I compile this code with xelatex.

Thank you.

6
  • 2
    Off-topic: Neither book nor any of the used packages provide option border.
    – cabohah
    Commented Aug 14 at 14:51
  • @cabohah I did not know that. I am surprised when I compiled I did not get an error. Is border= reserved only for the standalone class?
    – DDS
    Commented Aug 14 at 15:51
  • @cabohah Also---when I ran the MWE without border=0pt, the phenomenon still occurred.
    – DDS
    Commented Aug 14 at 15:53
  • It's not reversed, it is just an option standalone provides but the standard classes don't. If you'd have a look into the log file you would find a warning about the unused global option, when usng book. And yes, removing the option changes nothing. That's the reason for using Off-topic at the start of my comment. BTW: To change the margins using geometry see options margin, top, left, etc.
    – cabohah
    Commented Aug 14 at 15:55
  • @cabohah Thanks for pointing this out.
    – DDS
    Commented Aug 14 at 15:58

2 Answers 2

7

You could use the standalone class and output a box of that size:

\documentclass[]{standalone}

\usepackage{xcolor}

\begin{document}
\textcolor{red}{\rule{5.625in}{0.125in}}
\end{document}
7

Your manual settings of \paperwidth and \paperheight do not change the size of the text area or the margins. The text area is just outside the specified paper size. You would see this, if you would add some text, e.g. \emph{Text} instead of \emph{}, because you won't see the text. geometry on the other hand tries to also set the text area. But because the paper height is too low, the height of text area is also too low (less than \baselineskip + \topskip) and also the margins + the height of the text area > \paperheight. This results in underfull and overfull \vboxes and also in several page breaks. Even for an empty document the too low \textheight results in two pages:

\documentclass{book}
\usepackage[paperwidth=5.625in,paperheight=0.125in]{geometry}
%\paperwidth=5.625in \paperheight=0.125in
\usepackage{xcolor}

\pagecolor{red}
\pagestyle{empty}
\begin{document}
\end{document}

You can compare the values also from within the information geometry writes to the log:

\documentclass{book}
\usepackage[pass]{geometry}% don't change anything
%\usepackage[paperwidth=5.625in,paperheight=0.125in,nohead,nofoot,margin=0pt]{geometry}
\paperwidth=5.625in \paperheight=0.125in
\usepackage{xcolor}

\pagecolor{red}
\pagestyle{empty}
\begin{document}
\end{document}

results in

* \paperwidth=406.51874pt
* \paperheight=9.03374pt
* \textwidth=345.0pt
* \textheight=550.0pt
* \oddsidemargin=35.0pt
* \evensidemargin=89.0pt
* \topmargin=22.0pt
* \headheight=12.0pt
* \headsep=18.06749pt
* \topskip=10.0pt
* \footskip=25.29494pt
* \marginparwidth=125.0pt
* \marginparsep=7.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidetrue
* \@mparswitchtrue
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

but

\documentclass{book}
\usepackage[paperwidth=5.625in,paperheight=0.125in]{geometry}
%\paperwidth=5.625in \paperheight=0.125in
\usepackage{xcolor}

\pagecolor{red}
\pagestyle{empty}
\begin{document}
\end{document}

results in

* layout: <same size as paper>
* layoutoffset:(h,v)=(0.0pt,0.0pt)
* modes: twoside 
* h-part:(L,W,R)=(48.78275pt, 284.56187pt, 73.17412pt)
* v-part:(T,H,B)=(1.08405pt, 6.32358pt, 1.62611pt)
* \paperwidth=406.51874pt
* \paperheight=9.03374pt
* \textwidth=284.56187pt
* \textheight=6.32358pt
* \oddsidemargin=-23.48724pt
* \evensidemargin=0.90413pt
* \topmargin=-101.25343pt
* \headheight=12.0pt
* \headsep=18.06749pt
* \topskip=10.0pt
* \footskip=25.29494pt
* \marginparwidth=125.0pt
* \marginparsep=7.0pt
* \columnsep=10.0pt
* \skip\footins=9.0pt plus 4.0pt minus 2.0pt
* \hoffset=0.0pt
* \voffset=0.0pt
* \mag=1000
* \@twocolumnfalse
* \@twosidetrue
* \@mparswitchtrue
* \@reversemarginfalse
* (1in=72.27pt=25.4mm, 1cm=28.453pt)

You must log in to answer this question.

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