1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
31 %% File `graphpap.dtx'.
32 %% Copyright (C) 1994 by Leslie Lamport
33 %% all rights reserved.
36 %<package>\NeedsTeXFormat{LaTeX2e}
37 %<package>\ProvidesPackage{graphpap}
38 %<package> [1994/08/09 v1.0c Standard LaTeX graphpap package (LL)]
41 \documentclass{ltxdoc}
43 \GetFileInfo{graphpap.sty}
45 \title{The \textsf{graphpap} package\thanks{This file
46 has version number \fileversion, last
48 \author{Leslie Lamport}
50 \MaintainedByLaTeXTeam{latex}
52 \DocInput{graphpap.dtx}
59 % \changes{v1.0b}{1994/04/28}{(DPC) convert to doc format}
62 % |\graphpaper|\oarg{N}\parg{X,Y}\parg{DX,DY}
63 % Makes a grid with left-hand corner at \parg{X,Y}, extending
64 % \parg{DX,DY} units in the X and Y directions, where the lines are
65 % \emph{N} units apart. Every fifth line is thick and is numbered.
66 % The default value of \emph{N} is 10.
67 % The arguments must all be integers.
71 % First, we define three counters. The first two are defined
72 % as raw TeX counters since multiplication and division must be
75 % \changes{v1.0b}{1994/04/28}{(DPC) Remove allocations.}
78 % \newcount\@gridx% now (\@tempcnta)
79 % \newcount\@gridy% now (\@tempcntb)
84 % Next we define the following commands to draw vertical and horizontal
85 % grids. The ``nonum'' commands just draw the grids; the other commands
86 % also print numbers. All the arguments must be integers.
91 % |\@vgrid|\parg{xpos,ypos}\marg{xincrement}\\
92 % | |\marg{number-of-lines}\marg{length-of-lines}
95 % |\@nonumvgrid|\parg{xpos,ypos}\marg{xincrement}\\
96 % | |\marg{number-of-lines} \marg{length-of-lines}
101 % |\@hgrid|\parg{xpos,ypos}\marg{yincrement}\\
102 % | |\marg{number-of-lines}\marg{length-of-lines}
105 % |\@nonumhgrid| same as |\@hgrid| but no numbers drawn
108 \def\@vgrid(#1,#2)#3#4#5{%
109 \setcounter{@grid}{#1}%
110 \multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}%
111 \multiput(#1,#2)(#3,0){#4}{\@vgridnumber{#3}}}
115 \def\@vgridnumber#1{%
117 \shortstack{\rule{0pt}{10pt}\\\arabic{@grid}}}%
118 \addtocounter{@grid}{#1}}
122 \def\@nonumvgrid(#1,#2)#3#4#5{%
123 \multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}}
127 \def\@hgrid(#1,#2)#3#4#5{%
128 \setcounter{@grid}{#2}%
129 \multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}%
130 \multiput(#1,#2)(0,#3){#4}{\@hgridnumber{#3}}}
134 \def\@hgridnumber#1{%
135 \makebox(0,0)[r]{\arabic{@grid}\hspace{10pt}}%
136 \addtocounter{@grid}{#1}}
140 \def\@nonumhgrid(#1,#2)#3#4#5{%
141 \multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}}
144 % Finally, |\graphpaper| is defined in a straightforward way in terms of
145 % the commands above.
147 % \begin{macro}{\graphpaper}
148 % \changes{v1.0c}{1994/08/09}{(DPC) add \cs{leavevmode}}
150 \newcommand\graphpaper[1][10]{\leavevmode\@grid{#1}}
154 % \begin{macro}{\@grid}
156 % \changes{v1.0b}{1994/04/28}
157 % {(DPC) convert ignore spaces between arguments}
159 \def\@grid#1(#2,#3)#4{\@grid@i{#1}{#2}{#3}(}
163 % \begin{macro}{\@grid@i}
165 % \changes{v1.0b}{1994/04/28}
166 % {(DPC) macro introduced}
168 \def\@grid@i#1#2#3(#4,#5){%
170 \divide\@tempcnta#1\relax
171 \advance\@tempcnta1\relax
172 {\thinlines\@nonumvgrid(#2,#3){#1}{\@tempcnta}{#5}
174 \divide\@tempcnta5\relax
175 \divide\@tempcnta#1\relax
176 \advance\@tempcnta1\relax
178 \multiply\@tempcntb#1\relax
179 \thicklines\@vgrid(#2,#3){\@tempcntb}{\@tempcnta}{#5}
181 \divide\@tempcnta #1\relax
182 \advance\@tempcnta1\relax
183 \thinlines\@nonumhgrid(#2,#3){#1}{\@tempcnta}{#4}
185 \divide\@tempcnta5\relax
186 \divide\@tempcnta#1\relax
187 \advance\@tempcnta1\relax
188 \thicklines\@hgrid(#2,#3){\@tempcntb}{\@tempcnta}{#4}}%