How can one change the colour, pitch, line style, etc of the rules generated by the geometry package's showframe option?

2 Answers 2



Compile and read this MWE:

\def\Gm@hrule{\color{red!20}\hrule height 4pt depth\z@ width\textwidth}%
\def\Gm@vrule{\color{red!20}\vrule width 4pt height\textheight depth\z@}%
\def\Gm@hruled{\color{red!20}\hrule height\z@ depth4pt width\textwidth}%


\title{How to change the color of \texttt{showframe}}


You need change the rules. Not all those of the society, but only the three
defined in \verb|geometry.sty| with the macros 
\verb|\Gm@vrule|  \verb|\Gm@hrule| and  \verb|\Gm@hruled|. 
Thus, simply define again these rules in your preamble, adding some color. 
Of course, include before the  \verb|color| or \verb|xcolor| package.

As these commands contain the character @, remember that you need put 
these definitions in a  \verb|\makeatletter| \dots  \verb|\makeatother| group.

The rest of this the \verb|lipsum| dummy text of any decent 
minimal  working example. 
You do not need read the following text.  \lipsum[1]



The internal macro \Gm@pageframes sets the frames, thus it can be extended to add a color:



\section{Hello World}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.