| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 1993-2025 |
| 4 |
% The LaTeX Project and any individual authors listed elsewhere |
| 5 |
% in this file. |
| 6 |
% |
| 7 |
% This file is part of the LaTeX base system. |
| 8 |
% ------------------------------------------- |
| 9 |
% |
| 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 |
% https://www.latex-project.org/lppl.txt |
| 15 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 16 |
% version 2008 or later. |
| 17 |
% |
| 18 |
% This file has the LPPL maintenance status "maintained". |
| 19 |
% |
| 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 |
| 22 |
% information. |
| 23 |
% |
| 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. |
| 27 |
% |
| 28 |
% \fi |
| 29 |
% \iffalse |
| 30 |
%% |
| 31 |
%% File `graphpap.dtx'. |
| 32 |
%% Copyright (C) 1994 by Leslie Lamport |
| 33 |
%% all rights reserved. |
| 34 |
%% |
| 35 |
% |
| 36 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 37 |
%<package>\ProvidesPackage{graphpap} |
| 38 |
%<package> [1994/08/09 v1.0c Standard LaTeX graphpap package (LL)] |
| 39 |
% |
| 40 |
%<*driver> |
| 41 |
\documentclass{ltxdoc} |
| 42 |
\usepackage{graphpap} |
| 43 |
\GetFileInfo{graphpap.sty} |
| 44 |
\begin{document} |
| 45 |
\title{The \textsf{graphpap} package\thanks{This file |
| 46 |
has version number \fileversion, last |
| 47 |
revised \filedate.}} |
| 48 |
\author{Leslie Lamport} |
| 49 |
\date{\filedate} |
| 50 |
\MaintainedByLaTeXTeam{latex} |
| 51 |
\maketitle |
| 52 |
\DocInput{graphpap.dtx} |
| 53 |
\end{document} |
| 54 |
%</driver> |
| 55 |
% \fi |
| 56 |
% |
| 57 |
% |
| 58 |
% \changes{v1.0b}{1994/04/28}{(DPC) convert to doc format} |
| 59 |
% |
| 60 |
% |
| 61 |
% |\graphpaper|\oarg{N}\parg{X,Y}\parg{DX,DY} |
| 62 |
% Makes a grid with left-hand corner at \parg{X,Y}, extending |
| 63 |
% \parg{DX,DY} units in the X and Y directions, where the lines are |
| 64 |
% \emph{N} units apart. Every fifth line is thick and is numbered. |
| 65 |
% The default value of \emph{N} is 10. |
| 66 |
% The arguments must all be integers. |
| 67 |
% |
| 68 |
% \MaybeStop |
| 69 |
% |
| 70 |
% First, we define three counters. The first two are defined |
| 71 |
% as raw TeX counters since multiplication and division must be |
| 72 |
% performed in them. |
| 73 |
% |
| 74 |
% \changes{v1.0b}{1994/04/28}{(DPC) Remove allocations.} |
| 75 |
% \begin{macrocode} |
| 76 |
%<*package> |
| 77 |
% \newcount\@gridx% now (\@tempcnta) |
| 78 |
% \newcount\@gridy% now (\@tempcntb) |
| 79 |
% \newcounter{@grid} |
| 80 |
\let\c@@grid\count@ |
| 81 |
% \end{macrocode} |
| 82 |
% |
| 83 |
% Next we define the following commands to draw vertical and horizontal |
| 84 |
% grids. The ``nonum'' commands just draw the grids; the other commands |
| 85 |
% also print numbers. All the arguments must be integers. |
| 86 |
% |
| 87 |
% VERTICAL GRIDS |
| 88 |
% |
| 89 |
% \noindent |
| 90 |
% |\@vgrid|\parg{xpos,ypos}\marg{xincrement}\\ |
| 91 |
% | |\marg{number-of-lines}\marg{length-of-lines} |
| 92 |
% |
| 93 |
% \noindent |
| 94 |
% |\@nonumvgrid|\parg{xpos,ypos}\marg{xincrement}\\ |
| 95 |
% | |\marg{number-of-lines} \marg{length-of-lines} |
| 96 |
% |
| 97 |
% HORIZONTAL GRIDS |
| 98 |
% |
| 99 |
% \noindent |
| 100 |
% |\@hgrid|\parg{xpos,ypos}\marg{yincrement}\\ |
| 101 |
% | |\marg{number-of-lines}\marg{length-of-lines} |
| 102 |
% |
| 103 |
% \noindent |
| 104 |
% |\@nonumhgrid| same as |\@hgrid| but no numbers drawn |
| 105 |
% |
| 106 |
% \begin{macrocode} |
| 107 |
\def\@vgrid(#1,#2)#3#4#5{% |
| 108 |
\setcounter{@grid}{#1}% |
| 109 |
\multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}% |
| 110 |
\multiput(#1,#2)(#3,0){#4}{\@vgridnumber{#3}}} |
| 111 |
% \end{macrocode} |
| 112 |
% |
| 113 |
% \begin{macrocode} |
| 114 |
\def\@vgridnumber#1{% |
| 115 |
\makebox(0,0)[t]{% |
| 116 |
\shortstack{\rule{0pt}{10pt}\\\arabic{@grid}}}% |
| 117 |
\addtocounter{@grid}{#1}} |
| 118 |
% \end{macrocode} |
| 119 |
% |
| 120 |
% \begin{macrocode} |
| 121 |
\def\@nonumvgrid(#1,#2)#3#4#5{% |
| 122 |
\multiput(#1,#2)(#3,0){#4}{\line(0,1){#5}}} |
| 123 |
% \end{macrocode} |
| 124 |
% |
| 125 |
% \begin{macrocode} |
| 126 |
\def\@hgrid(#1,#2)#3#4#5{% |
| 127 |
\setcounter{@grid}{#2}% |
| 128 |
\multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}% |
| 129 |
\multiput(#1,#2)(0,#3){#4}{\@hgridnumber{#3}}} |
| 130 |
% \end{macrocode} |
| 131 |
% |
| 132 |
% \begin{macrocode} |
| 133 |
\def\@hgridnumber#1{% |
| 134 |
\makebox(0,0)[r]{\arabic{@grid}\hspace{10pt}}% |
| 135 |
\addtocounter{@grid}{#1}} |
| 136 |
% \end{macrocode} |
| 137 |
% |
| 138 |
% \begin{macrocode} |
| 139 |
\def\@nonumhgrid(#1,#2)#3#4#5{% |
| 140 |
\multiput(#1,#2)(0,#3){#4}{\line(1,0){#5}}} |
| 141 |
% \end{macrocode} |
| 142 |
% |
| 143 |
% Finally, |\graphpaper| is defined in a straightforward way in terms of |
| 144 |
% the commands above. |
| 145 |
% |
| 146 |
% \begin{macro}{\graphpaper} |
| 147 |
% \changes{v1.0c}{1994/08/09}{(DPC) add \cs{leavevmode}} |
| 148 |
% \begin{macrocode} |
| 149 |
\newcommand\graphpaper[1][10]{\leavevmode\@grid{#1}} |
| 150 |
% \end{macrocode} |
| 151 |
% \end{macro} |
| 152 |
% |
| 153 |
% \begin{macro}{\@grid} |
| 154 |
% |
| 155 |
% \changes{v1.0b}{1994/04/28} |
| 156 |
% {(DPC) convert ignore spaces between arguments} |
| 157 |
% \begin{macrocode} |
| 158 |
\def\@grid#1(#2,#3)#4{\@grid@i{#1}{#2}{#3}(} |
| 159 |
% \end{macrocode} |
| 160 |
% \end{macro} |
| 161 |
% |
| 162 |
% \begin{macro}{\@grid@i} |
| 163 |
% |
| 164 |
% \changes{v1.0b}{1994/04/28} |
| 165 |
% {(DPC) macro introduced} |
| 166 |
% \begin{macrocode} |
| 167 |
\def\@grid@i#1#2#3(#4,#5){% |
| 168 |
\@tempcnta=#4\relax |
| 169 |
\divide\@tempcnta#1\relax |
| 170 |
\advance\@tempcnta1\relax |
| 171 |
{\thinlines\@nonumvgrid(#2,#3){#1}{\@tempcnta}{#5} |
| 172 |
\@tempcnta#4\relax |
| 173 |
\divide\@tempcnta5\relax |
| 174 |
\divide\@tempcnta#1\relax |
| 175 |
\advance\@tempcnta1\relax |
| 176 |
\@tempcntb5\relax |
| 177 |
\multiply\@tempcntb#1\relax |
| 178 |
\thicklines\@vgrid(#2,#3){\@tempcntb}{\@tempcnta}{#5} |
| 179 |
\@tempcnta#5\relax |
| 180 |
\divide\@tempcnta #1\relax |
| 181 |
\advance\@tempcnta1\relax |
| 182 |
\thinlines\@nonumhgrid(#2,#3){#1}{\@tempcnta}{#4} |
| 183 |
\@tempcnta#5\relax |
| 184 |
\divide\@tempcnta5\relax |
| 185 |
\divide\@tempcnta#1\relax |
| 186 |
\advance\@tempcnta1\relax |
| 187 |
\thicklines\@hgrid(#2,#3){\@tempcntb}{\@tempcnta}{#4}}% |
| 188 |
\ignorespaces} |
| 189 |
%</package> |
| 190 |
% \end{macrocode} |
| 191 |
% \end{macro} |
| 192 |
% |
| 193 |
% \Finale |
| 194 |
% |
| 195 |
|