0% found this document useful (0 votes)
50 views

The Vgrid Package: Scott Lawrence 0.1 From 2013/12/20

The vgrid package overlays a grid on each page intended to help authors enforce vertical rhythm. The grid spacing is based on the baselineskip setting, with the first line at the top of the text area. Adding \usepackage{vgrid} to the preamble will add the grid to each page using baselineskip as the line height. The package uses EveryPage and TikZ to calculate coordinates and draw grid lines from the left and right margins to the text height in baselineskip increments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

The Vgrid Package: Scott Lawrence 0.1 From 2013/12/20

The vgrid package overlays a grid on each page intended to help authors enforce vertical rhythm. The grid spacing is based on the baselineskip setting, with the first line at the top of the text area. Adding \usepackage{vgrid} to the preamble will add the grid to each page using baselineskip as the line height. The package uses EveryPage and TikZ to calculate coordinates and draw grid lines from the left and right margins to the text height in baselineskip increments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

.

The vgrid package


Scott Lawrence
[email protected]
0.1 from 2013/12/20

Introduction

The vgrid package overlays a grid intended to help the author enforce vertical
rhythm on each page. The spacing of the grid is taken from \baselineskip, with
the first line at the top of the text area.
Note that vgrid itself does not change any spacing other packages (or careful font settings) must be used to achieve vertical rhythm. This document, for
example, can be clearly seen to not have vertical rhythm.

Usage

To add a grid to each page, just place \usepackage{vgrid} in your documents


preamble. As of this version, there is no fine-grained control to allow grids to be
excluded from certain pages. The grid will use \baselineskip as the line height.

Implementation

\RequirePackage{everypage}
\RequirePackage{tikz}
3 \RequirePackage{ifoddpage}
4 \newlength\vgrid@l \setlength\vgrid@l{\baselineskip}
5 \newlength\vgrid@y
6 \AddEverypageHook{
1
2

For every page, we need to re-calculate the coordinates of the grid.


\def\@csm{\ifoddpageoroneside\oddsidemargin\else\evensidemargin\fi}
\def\@left{\hoffset+\@csm}
9 \def\@right{\@left+\textwidth}
10 \def\@top{-\voffset-\topmargin-\headheight-\headsep}
11 \def\@gridline{\draw [thin, gray]}
12 \begin{tikzpicture}[overlay]
13 \def\y{\@top-\vgrid@y}
14 \@gridline (\@left, \@top) -- (\@left, \@top-\textheight);
15 \@gridline (\@right, \@top) -- (\@right, \@top-\textheight);
7
8

\setlength\vgrid@y{0pt}
\@whiledim\vgrid@y<\textheight\do{
18 \@gridline (\@left, \y) -- (\@right, \y);
19 \addtolength{\vgrid@y}{\vgrid@l}
20 }
21 \@gridline (\@left, \y) -- (\@right, \y);
22 \end{tikzpicture}
23 }
16
17

You might also like