summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/base/graphpap.dtx
blob: effe3f70092a25e6004433cdd0ca3c6d0925d337 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
% \iffalse meta-comment
%
% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009
% 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}
 \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
%
%   |\@vgrid|\parg{xpos,ypos}\marg{xincrement}^^A
%              \marg{number-of-lines}\marg{length-of-lines}\\
%   |\@nonumvgrid|\parg{xpos,ypos}\marg{xincrement}^^A
%              \marg{number-of-lines} \marg{length-of-lines}
%     
%   HORIZONTAL GRIDS
%
%     |\@hgrid|\parg{xpos,ypos}\marg{yincrement}^^A
%                \marg{number-of-lines}\marg{length-of-lines}\\
%     |\@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
%