%%
%% This is file `typogrid.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% typogrid.dtx  (with options: `package')
%% 
%%   typogrid package
%% 
%%   Copyright  2003 Harald Harders
%% 
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%% 
%%   h.harders@tu-bs.de
%% 
\def\fileversion{0.10}
\def\filedate{2003/10/30}
\def\docdate{2003/10/30}
\ProvidesPackage{typogrid}[2003/10/29 v\fileversion\space Typographic grid]
\RequirePackage{eso-pic}[2002/11/16]
\RequirePackage{calc}
\RequirePackage{keyval}
\newlength{\tpg@left}%
\newlength{\tpg@top}%
\newlength{\tpg@bottom}%
\newlength{\tpg@gridwidth}%
\newcounter{tpg@bloecke}%
\setcounter{tpg@bloecke}{12}%
\newcommand*\typogridsetup[1]{%
  \expandafter\setkeys\expandafter{typogrid}{#1}}
\define@key{typogrid}{columns}{%
  \setcounter{tpg@bloecke}{#1}%
  \ifnum\arabic{tpg@bloecke}<1
    \PackageError{typogrid}{Less than 1 column given}{You have to
      declare at least 1 column.}%
    \setcounter{tpg@bloecke}{1}%
  \fi
}
\newif\iftpg@draft
\DeclareOption{draft}{\tpg@drafttrue}
\DeclareOption{final}{\tpg@draftfalse}
\DeclareOption*{\expandafter\typogridsetup\expandafter{\CurrentOption}}
\ExecuteOptions{final}
\ProcessOptions\relax
\AtBeginDocument{%
  \iftpg@draft
    \typeout{Typographic grid switched on}%
    \AddToShipoutPicture{%
      \begingroup
      \normalcolor
      \setlength{\unitlength}{1pt}%
      \thinlines
      \setlength{\tpg@top}{\paperheight-1in-\topmargin-\headheight-\headsep}%
      \setlength{\tpg@bottom}{\tpg@top-\textheight}%
      \setlength{\tpg@gridwidth}{\textwidth/\thetpg@bloecke}%
      \@tempcnta=\thetpg@bloecke
      \advance\@tempcnta by 1
      \ifodd\arabic{page}%
        \setlength{\tpg@left}{\oddsidemargin+1in}%
      \else
        \setlength{\tpg@left}{\evensidemargin+1in}%
      \fi
      \put(\strip@pt\tpg@left,\strip@pt\tpg@top){%
        \line(1,0){\strip@pt\textwidth}}%
      \put(\strip@pt\tpg@left,\strip@pt\tpg@bottom){%
        \line(1,0){\strip@pt\textwidth}}%
      \multiput(\strip@pt\tpg@left,\strip@pt\tpg@bottom)%
               (\strip@pt\tpg@gridwidth,0){\the\@tempcnta}{%
        \line(0,1){\strip@pt\textheight}}%
      \endgroup
    }%
  \else
    \typeout{Typographic grid switched off}%
  \fi
}

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