%% %% This is file `typogrid.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% typogrid.dtx (with options: `package') %% %% typogrid package %% %% Copyright 2003, 2011 Harald Harders, Rolf Niepraschk %% %% 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, rolf.niepraschk@ptb.de %% \ProvidesPackage{typogrid} [2011/12/31 v0.21 Typographic grid] \RequirePackage{calc} \RequirePackage{keyval} \newlength{\gridwidth}% \newcount\tpg@blocks% \newcounter{tpg@blocks@new}% \setcounter{tpg@blocks@new}{12}% \newcommand*\typogridsetup[1]{% \expandafter\setkeys\expandafter{typogrid}{#1}} \define@key{typogrid}{columns}{% \setcounter{tpg@blocks@new}{#1}% \ifnum\the\c@tpg@blocks@new<1\relax \PackageError{typogrid}{Less than 1 column given}{You have to declare at least 1 column.}% \setcounter{tpg@blocks@new}{1}% \fi } \newif\iftpg@headings \newif\iftpg@headings@new \tpg@headings@newtrue \define@key{typogrid}{headings}[true]{% \csname tpg@headings@new#1\endcsname } \newif\iftpg@margin \newif\iftpg@margin@new \tpg@margin@newtrue \define@key{typogrid}{margin}[true]{% \csname tpg@margin@new#1\endcsname } \newif\iftpg@draft \DeclareOption{draft}{\tpg@drafttrue} \DeclareOption{final}{\tpg@draftfalse} \DeclareOption{colorgrid}{\PassOptionsToPackage{\CurrentOption}{eso-pic}} \DeclareOption{grid}{\PassOptionsToPackage{\CurrentOption}{eso-pic}} \DeclareOption*{\expandafter\typogridsetup\expandafter{\CurrentOption}} \ExecuteOptions{final} \ProcessOptions\relax \RequirePackage{eso-pic}[2002/11/16] \newcommand*\typogrid{% \begingroup \normalcolor \thinlines \@tempcnta=\tpg@blocks \advance\@tempcnta by -1% \AtTextLowerLeft{% \put(0,0){% \framebox(\LenToUnit{\textwidth},\LenToUnit{\textheight}){}}% \multiput(\LenToUnit{\gridwidth},0)% (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% \line(0,1){\LenToUnit{\textheight}}}% }% \iftpg@headings \AtTextUpperLeft{% \put(0,\LenToUnit{\headsep}){% \framebox(\LenToUnit{\textwidth},\LenToUnit{\headheight}){}}% \multiput(\LenToUnit{\gridwidth},\LenToUnit{\headsep})% (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% \line(0,1){\LenToUnit{\headheight}}}% }% \AtTextLowerLeft{% \put(0,\LenToUnit{-\footskip}){% \line(1,0){\LenToUnit{\textwidth}}}% \put(0,\LenToUnit{-\footskip}){% \line(0,1){\LenToUnit{\baselineskip}}}% \put(\LenToUnit{\textwidth},\LenToUnit{-\footskip}){% \line(0,1){\LenToUnit{\baselineskip}}}% \multiput(\LenToUnit{\gridwidth},\LenToUnit{-\footskip})% (\LenToUnit{\gridwidth},0){\the\@tempcnta}{% \line(0,1){\LenToUnit{\baselineskip}}}% }% \fi \iftpg@margin \AtTextLowerLeft{% \@tempdima=\textwidth\advance\@tempdima\marginparsep% \if@twoside% \ifodd\c@page \else \@tempdima=-\marginparsep\advance\@tempdima-\marginparwidth% \fi% \fi% \put(\LenToUnit{\@tempdima},0){% \framebox(\LenToUnit{\marginparwidth},% \LenToUnit{\textheight}){}}% }% \fi \endgroup \setlength\gridwidth{\textwidth/\arabic{tpg@blocks@new}}% \global\gridwidth=\gridwidth \global\tpg@blocks=\arabic{tpg@blocks@new}% \iftpg@headings@new \global\tpg@headingstrue \else \global\tpg@headingsfalse \fi \iftpg@margin@new \global\tpg@margintrue \else \global\tpg@marginfalse \fi } \AtBeginDocument{% \iftpg@draft \typeout{Typographic grid switched on}% \AddToShipoutPicture{\typogrid}% \else \typeout{Typographic grid switched off}% \fi \setlength\gridwidth{\textwidth/\arabic{tpg@blocks@new}}% \global\tpg@blocks=\arabic{tpg@blocks@new}% \iftpg@headings@new \tpg@headingstrue \else \tpg@headingsfalse \fi \iftpg@margin@new \tpg@margintrue \else \tpg@marginfalse \fi } \endinput %% %% End of file `typogrid.sty'.