[Tex/LaTex] Small bug in geometry.sty

geometry

Complete

alt text


Top Left Corner

alt text


Top Right Corner

alt text


Bottom Left Corner

alt text


Bottom Right Corner

alt text

\documentclass[dvipsnames,dvips,cmyk]{minimal}
\usepackage{xcolor,calc}
\usepackage[%
paperwidth=30mm,
paperheight=30mm,
textwidth=25mm,
textheight=25mm,
showframe]{geometry}
\setlength{\fboxsep}{5mm}
\setlength{\fboxrule}{5mm}
\usepackage{lipsum}
\begin{document}
\topskip0pt%
\noindent\color{red}\fbox{\parbox{\textwidth-2\fboxsep-2\fboxrule}{\color{green}\rule{5mm}{5mm}}}
\end{document}

EDIT 1:

Questions:

  1. These asymmetric frame rules are intentionally made or bugs?
  2. \textwidth equals to the horizontal distance between inner edges of the frame rules or outer edges of the frame rules?

EDIT 2:

  1. I think the frame enclosing the text content is created partially/separately using 4 rules rather than using \fbox (with \fboxsep set to zero, of course). Can it be changed to use \fbox ?

  2. If we use PSTrick's terminology in this discussion, I think the box enclosing the text content used dimen=inner, right? If it is right, then the \textwidth is measured as the horizontal distance between the inner edges of the box. Please kindly confirm whether or not my understanding is correct?


EDIT 3:

Except for the "asymmetric frame rules" produced by geometry.sty, my diagram below reproduce it with some annotations.

The frame produced by geometry.sty seems to expand outward. Thus, the \textwidth equals to horizontal distance between the inner edges of this frame.

Note: scale in mm.

alt text


This bug still exists.

Best Answer

I'd say that the behaviour seen is a bug in geometry. LaTeX's \fbox also has to use four rules to achieve the effect, but these do join up correctly. So I'd report the issue to the author of geometry and see what he says.

On framing around \textwidth, the frame should be 'outside' of the material (i.e. the TeX box containing the material should actually have a width of \textwidth plus twice the width of the rule used). Again, this is certainly what \fbox does.

Related Question