% \iffalse meta-comment
%
% Copyright 1993-2015
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%
%% File `graphpap.dtx'.
%% Copyright (C) 1994 by Leslie Lamport
%%                       all rights reserved.
%%
%
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{graphpap}
%<package>      [1994/08/09 v1.0c Standard LaTeX graphpap package (LL)]
%
%<*driver>
\documentclass{ltxdoc}
\usepackage{graphpap}
\GetFileInfo{graphpap.sty}
\begin{document}
\title{The \textsf{graphpap} package\thanks{This file
        has version number \fileversion, last
        revised \filedate.}}
\author{Leslie Lamport}
\date{\filedate}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{graphpap.dtx}
\end{document}
%</driver>
% \fi
%
% \CheckSum{114}
%
% \changes{v1.0b}{1994/04/28}{(DPC) convert to doc format}
%
%
% |\graphpaper|\oarg{N}\parg{X,Y}\parg{DX,DY}
%    Makes a grid with left-hand corner at \parg{X,Y}, extending
%    \parg{DX,DY} units in the X and Y directions, where the lines are
%    \emph{N} units apart.  Every fifth line is thick and is numbered.
%    The default value of \emph{N} is 10.
%    The arguments must all be integers.
%
% \StopEventually
%
%  First, we define three counters.  The first two are defined
%  as raw TeX counters since multiplication and division must be
%  performed in them.
%
% \changes{v1.0b}{1994/04/28}{(DPC) Remove allocations.}
%    \begin{macrocode}
%<*package>
% \newcount\@gridx% now  (\@tempcnta)
% \newcount\@gridy% now  (\@tempcntb)
% \newcounter{@grid}
\let\c@@grid\count@
%    \end{macrocode}
%
% Next we define the following commands to draw vertical and horizontal
% grids.  The ``nonum'' commands just draw the grids; the other commands
% also print numbers.  All the arguments must be integers.
%
%   VERTICAL GRIDS
%
%   \noindent
%   |\@vgrid|\parg{xpos,ypos}\marg{xincrement}\\
%   |       |\marg{number-of-lines}\marg{length-of-lines}
%
%   \noindent
%   |\@nonumvgrid|\parg{xpos,ypos}\marg{xincrement}\\
%   |            |\marg{number-of-lines} \marg{length-of-lines}
%
%   HORIZONTAL GRIDS
%
%    \noindent
%     |\@hgrid|\parg{xpos,ypos}\marg{yincrement}\\
%     |       |\marg{number-of-lines}\marg{length-of-lines}
%
%   \noindent
%     |\@nonumhgrid| same as |\@hgrid| but no numbers drawn
%
%    \begin{macrocode}
\def\@vgrid(#1,#2)#3#4#5{%
  \setcounter{@grid}{#1}%
  \multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}%
  \multiput(#1,#2)(#3,0){#4}{\@vgridnumber{#3}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@vgridnumber#1{%
  \makebox(0,0)[t]{%
    \shortstack{\rule{0pt}{10pt}\\\arabic{@grid}}}%
  \addtocounter{@grid}{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@nonumvgrid(#1,#2)#3#4#5{%
  \multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@hgrid(#1,#2)#3#4#5{%
  \setcounter{@grid}{#2}%
  \multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}%
  \multiput(#1,#2)(0,#3){#4}{\@hgridnumber{#3}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@hgridnumber#1{%
  \makebox(0,0)[r]{\arabic{@grid}\hspace{10pt}}%
  \addtocounter{@grid}{#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@nonumhgrid(#1,#2)#3#4#5{%
  \multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}}
%    \end{macrocode}
%
% Finally, |\graphpaper| is defined in a straightforward way in terms of
% the commands above.
%
%  \begin{macro}{\graphpaper}
% \changes{v1.0c}{1994/08/09}{(DPC) add \cs{leavevmode}}
%    \begin{macrocode}
\newcommand\graphpaper[1][10]{\leavevmode\@grid{#1}}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@grid}
%
% \changes{v1.0b}{1994/04/28}
%     {(DPC) convert ignore spaces between arguments}
%    \begin{macrocode}
\def\@grid#1(#2,#3)#4{\@grid@i{#1}{#2}{#3}(}
%    \end{macrocode}
%  \end{macro}
%
%  \begin{macro}{\@grid@i}
%
% \changes{v1.0b}{1994/04/28}
%     {(DPC) macro introduced}
%    \begin{macrocode}
\def\@grid@i#1#2#3(#4,#5){%
  \@tempcnta=#4\relax
  \divide\@tempcnta#1\relax
  \advance\@tempcnta1\relax
   {\thinlines\@nonumvgrid(#2,#3){#1}{\@tempcnta}{#5}
    \@tempcnta#4\relax
    \divide\@tempcnta5\relax
    \divide\@tempcnta#1\relax
    \advance\@tempcnta1\relax
    \@tempcntb5\relax
    \multiply\@tempcntb#1\relax
    \thicklines\@vgrid(#2,#3){\@tempcntb}{\@tempcnta}{#5}
    \@tempcnta#5\relax
    \divide\@tempcnta #1\relax
    \advance\@tempcnta1\relax
    \thinlines\@nonumhgrid(#2,#3){#1}{\@tempcnta}{#4}
    \@tempcnta#5\relax
    \divide\@tempcnta5\relax
    \divide\@tempcnta#1\relax
    \advance\@tempcnta1\relax
    \thicklines\@hgrid(#2,#3){\@tempcntb}{\@tempcnta}{#4}}%
  \ignorespaces}
%</package>
%    \end{macrocode}
%  \end{macro}
%
% \Finale
%

