summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/vgrid/vgrid.sty
blob: d2d8ee5b6de5c768c5ee9910f0caba62a042b003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
%%
%% This is file `vgrid.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% vgrid.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from vgrid.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file vgrid.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{vgrid}
    [2013/12/20 0.1 Overlays a vertical grid]

\RequirePackage{everypage}
\RequirePackage{tikz}
\RequirePackage{ifoddpage}
\newlength\vgrid@l \setlength\vgrid@l{\baselineskip}
\newlength\vgrid@y
\AddEverypageHook{
\def\@csm{\ifoddpageoroneside\oddsidemargin\else\evensidemargin\fi}
\def\@left{\hoffset+\@csm}
\def\@right{\@left+\textwidth}
\def\@top{-\voffset-\topmargin-\headheight-\headsep}
\def\@gridline{\draw [thin, gray]}
\begin{tikzpicture}[overlay]
\def\y{\@top-\vgrid@y}
\@gridline (\@left, \@top) -- (\@left, \@top-\textheight);
\@gridline (\@right, \@top) -- (\@right, \@top-\textheight);
\setlength\vgrid@y{0pt}
\@whiledim\vgrid@y<\textheight\do{
\@gridline (\@left, \y) -- (\@right, \y);
\addtolength{\vgrid@y}{\vgrid@l}
}
\@gridline (\@left, \y) -- (\@right, \y);
\end{tikzpicture}
}

\endinput
%%
%% End of file `vgrid.sty'.