Debian Codegraph @

texmf-dist/source/latex/logpap/logpap.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Package logpap
4 % Copyright (c) 2004 Mike Kaufmann, all rights reserved
5 %
6 % This program is provided under the terms of the
7 % LaTeX Project Public License distributed from CTAN
8 % archives in directory macros/latex/base/lppl.txt.
9 %
10 % Author: Mike Kaufmann
11 % [email protected]
12 % \fi
13 %% \CharacterTable
14 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
15 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
16 %% Digits \0\1\2\3\4\5\6\7\8\9
17 %% Exclamation \! Double quote \" Hash (number) \#
18 %% Dollar \$ Percent \% Ampersand \&
19 %% Acute accent \' Left paren \( Right paren \)
20 %% Asterisk \* Plus \+ Comma \,
21 %% Minus \- Point \. Solidus \/
22 %% Colon \: Semicolon \; Less than \<
23 %% Equals \= Greater than \> Question mark \?
24 %% Commercial at \@ Left bracket \[ Backslash \\
25 %% Right bracket \] Circumflex \^ Underscore \_
26 %% Grave accent \` Left brace \{ Vertical bar \|
27 %% Right brace \} Tilde \~}
28 %%
29 % \CheckSum{1968}
30 %
31 % \iffalse meta-comment
32 %
33 %<*package>
34 \def\fileversion{0.6}
35 \def\filedate{2004/02/01}
36 %</package>
37 %
38 %<*driver>
39 \documentclass{ltxdoc}
40 \usepackage{logpap}
41 \setlength{\unitlength}{1mm}
42 \EnableCrossrefs
43 \CodelineIndex
44 \RecordChanges
45 %\OnlyDescription
46 \begin{document}
47 \DocInput{logpap.dtx}
48 \end{document}
49 %</driver>
50 %
51 %<*package>
52 % \fi
53 %
54 % \DoNotIndex{\,,\ }
55 % \DoNotIndex{\@@end,\@break@tfor,\@empty,\@ifnextchar}
56 % \DoNotIndex{\@ne,\@tempa,\@tempb,\@tempc,\@tempd,\@tempcnta,\@tempcntb}
57 % \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tfor}
58 % \DoNotIndex{\advance}
59 % \DoNotIndex{\begin,\begingroup}
60 % \DoNotIndex{\csname,\color,\CurrentOption}
61 % \DoNotIndex{\DeclareOption,\def,\divide,\do}
62 % \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname,\ExecuteOption}
63 % \DoNotIndex{\expandafter,\ExecuteOptions}
64 % \DoNotIndex{\fi,\filedate,\fileversion}
65 % \DoNotIndex{\global}
66 % \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifx,\InputIfFileExists}
67 % \DoNotIndex{\LaTeX,\let,\line,\linethickness,\loop}
68 % \DoNotIndex{\m@ne,\makebox,\multiply,\MessageBreak}
69 % \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif}
70 % \DoNotIndex{\or}
71 % \DoNotIndex{\p@,\PackageError,\PackageWarning,\PackageInfo}
72 % \DoNotIndex{\PassOptionToPackage,\ProcessOptions,\ProvidesPackage,\put}
73 % \DoNotIndex{\quad}
74 % \DoNotIndex{\real,\relax,\renewcommand,\repeat,\RequirePackage}
75 % \DoNotIndex{\setlength,\settoheight,\scriptsize,\space,\strut}
76 % \DoNotIndex{\the,\textsf,\times,\typeout}
77 % \DoNotIndex{\unitlength}
78 % \DoNotIndex{\xdef,\z@}
79 %
80 % ^^A\changes{0.3}{2004/01/20}{initial release}
81 %
82 % ^^A \MakeShortVerb{\+}
83 % ^^A \DeleteShortVerb{\|}
84 %
85 % \makeatletter
86 % \let\PrintDescribeOpt\PrintDescribeEnv
87 % \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
88 % \Describe@Opt}
89 % \def\Describe@Opt#1{\endgroup
90 % \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
91 % \SpecialOptIndex{#1}\@esphack\ignorespaces}
92 % \def\SpecialOptIndex#1{\@bsphack
93 % \index{#1\actualchar{\protect\ttfamily#1}
94 % (option)\encapchar usage}%
95 % \index{options:\levelchar{\protect\ttfamily#1}\encapchar
96 % usage}\@esphack}
97 % \makeatother
98 %
99 % \newcommand*{\bs}{\char '134 }
100 % \newcommand*{\lb}{\char '173 }
101 % \newcommand*{\rb}{\char '175 }
102 % \newcommand*{\param}[1]{\texttt{\textit{#1}}}
103 % \newcommand*{\lp}{\textsf{logpap}}
104 % \newcommand*{\newmac}{\vspace{2ex}\noindent}
105 %
106 % \title{The \lp\ Package\\Logarithmic Graph Paper with \LaTeX}
107 % \author{Mike Kaufmann\\|[email protected]|}
108 % \date{\filedate (v\fileversion)}
109 % ^^A--------------------------------------------------------------------------
110 % \maketitle
111 % \begin{abstract}
112 % The \lp\ package provides four macros for drawing logarithmic-logarithmic,
113 % logarithmic-linear, linear-logarithmic and (because it was easy to implement)
114 % linear-linear graph paper with \LaTeX.
115 % \end{abstract}
116 %
117 % \tableofcontents
118 %
119 % ^^A--------------------------------------------------------------------------
120 % \section{Introduction}
121 % \subsection{Why this Package}
122 % Well, at least here in Germany logarithmic graph paper is expensive. And you
123 % might not get graph paper with the number of decades you just need. With the
124 % \lp\ package you can make your own graph paper now. And you can get your
125 % graph paper even when shops are closed.\footnote{The first parts of this
126 % package were made a weekend before I needed logarithmic graph paper for an
127 % experiment report, because the experiment took place on Monday morning.}
128 %
129 % ^^A---------------------------------------------
130 % \subsection{Packages used by the \lp\ Package}
131 % The \lp\ package uses the following two packages
132 % \begin{description}
133 % \item[calc] used for some divisions by a real number
134 % \item[color] used for drawing the graph paper in color
135 % \end{description}
136 %
137 % ^^A---------------------------------------------
138 % \subsection{Legal Stuff}
139 % This program is provided under the terms of the
140 % \LaTeX\ Project Public License distributed from CTAN
141 % archives in directory macros/latex/base/lppl.txt.
142 %
143 % ^^A--------------------------------------------------------------------------
144 % \section{Overview}\label{sec:ov}
145 % Altough the \lp\ package only draws logarithmic graph paper, there are
146 % various things that can be changed. Figure \ref{fig:ov} will give an
147 % overwiev. Here the first graph paper part where made with the default
148 % settings and the command
149 % |\put(0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}|.
150 % On the right side you can find the commands used to change the appearance.
151 %
152 % Not all commands possible are shown here. Every option can be used with
153 % |\LPSet{|\param{option1}|,|\param{option2}|,...}| within the document,
154 % every \param{option} has a counterpart |no|\param{option} and for every
155 % \param{option}|x| also an \param{option}|y| exists. Also commands to set
156 % the three line widths, colors and the appearance of the $\mu$ are not shown.
157 %
158 % \begin{figure}[ht]
159 % \centering
160 % \begin{picture}(140,120)
161 % \put( 0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
162 % \put(85,110){\makebox(0,0)[cl]{with default settings}}
163 %
164 % \LPSet{nodimensions,noticksupright,tenlower}
165 % \put( 0, 80){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
166 % \put(85, 89){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
167 % \put(85, 85){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
168 % \put(85, 81){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
169 % \LPSet{dimensions,ticksupright,notenlower}
170 %
171 % \LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
172 % \put( 0, 55){\loglinpap(80mm,10mm)(1,1){1}{0}}
173 % \put(85, 64){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
174 % \put(85, 60){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
175 % \put(85, 56){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
176 % \LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}
177 %
178 % \DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
179 % \put( 0, 30){\loglinpap(80mm,10mm)(1,1){1}{0}}
180 % \put(85, 41){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
181 % \put(85, 37){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
182 % \put(85, 33){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
183 % \put(85, 29){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
184 % \DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}
185 %
186 % \DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
187 % \put( 0, 5){\loglinpap(80mm,10mm)(1,1){1}{0}}
188 % \put(85, 14){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
189 % \put(85, 10){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
190 % \put(85, 6){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
191 % \DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
192 % \end{picture}
193 % \caption{Overview}\label{fig:ov}
194 % \end{figure}
195 %
196 % ^^A--------------------------------------------------------------------------
197 % \newpage
198 % \section{Using the Package}
199 % \subsection{Drawing Logarithmic Graph Paper}\label{sec:dlgp}
200 % \DescribeMacro\loglogpap
201 % \DescribeMacro\loglinpap
202 % \DescribeMacro\linlogpap
203 % \DescribeMacro\linlinpap
204 % There are four commands for drwaing graph paper. They can be used as a
205 % single paragraph, in a \LaTeX\ \texttt{picture} environment or in a
206 % \LaTeX\ \texttt{figure} environment. But due to the fact that the ticks,
207 % the labeling, the text and the X- and Y-axis names are drawn outside of the
208 % given area (see first parameter), it would be the best to use them within
209 % a \texttt{picture} environment.
210 % \begin{description}
211 % \item[\texttt{\bs loglogpap}] draws double logarithmic graph paper
212 % \item[\texttt{\bs loglinpap}] draws logarithmic-linear graph paper
213 % (logarithmic X-axis)
214 % \item[\texttt{\bs linlogpap}] draws linear-logarithmic graph paper
215 % (logarithmic Y-axis)
216 % \item[\texttt{\bs linlinpap}] draws double linear graph paper
217 % \end{description}
218 % These macros all have six parameters:
219 % \begin{description}
220 % \item[\texttt{(\emph{x-length},\emph{y-length})}]
221 % are the dimensions of the graph paper in x- and y-direction. You can
222 % use everything accepted as a length by \TeX, such as a number followed
223 % by a unit accepted by \TeX\ (200mm, 500pt, \ldots) or a length register
224 % like |\textheight| or |\textwidth|.
225 % \item[\texttt{(\emph{x-decades/divisions},\emph{y-decades/divisions})}]
226 % specifys the number decades for a logarithmic axis or the number of
227 % divisions for a linear axis. You can use real numbers, but only the
228 % first digit after the decimal point is used. For logarithmic axis a
229 % value like 2.3 means that you will get two full decades (from 1 to 10)
230 % and a partial decade from 1 to 3.
231 %
232 % For logarithmic axis the minimum is 0.2 and values like $x.1$ are
233 % not alowed. For linear axis the minimum is 0.1. You'll get an
234 % appropriate error message if you type wrong values.
235 % \item[\texttt{\lb\emph{x-start},\emph{factor/increment}\rb}]
236 % specifys the start value and a factor or increment for the x-axis
237 % labeling.
238 %
239 % The general format for \param{x-start} is: an optional ``$+$'' or
240 % ``$-$'', followed by 1 to 3 digits, optionally followed by one of the
241 % letters y, z, a, f, p, n, u, m, k, M, G, T, P, E, Z or Y. The letters
242 % are for the exponents $10^{-24}$, $10^{-21}$, \ldots, $10^{21}$ and
243 % $10^{24}$.
244 %
245 % The \param{factor/increment} part is optional, it must be an integer
246 % number. The default value is 1. For a logarithmic axis it is used as
247 % factor, for a linear one as increment.
248 %
249 % For logarithmic axis you can use 1, $-1$, 10, $-10$, 100 or $-100$
250 % optionally followed by one of the exponent letters as start value
251 % (\param{x-start}) and values from 2 to 9 as factor
252 % (\param{factor/increment}). The exponent letter is included in
253 % calculating the next value for a full decade. If the value is
254 % 1000 $\cdot$ \param{factor} it will be set to 1 $\cdot$ \param{factor}
255 % and the next letter in order is appended (see first Example). Examples:
256 % \begin{description}
257 % \item[\texttt{\lb 10m,2\rb}] leads to ``20m'', ``200m'', ``2'',
258 % ``20'', ``200'', ``2k'' and so on for the full decade and
259 % ``4'', ``6'', \ldots\ ``18'' between them.
260 % \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-1$k''
261 % \ldots\ and ``$-2$'', ``$-3$'', \ldots\ ``$-9$'' between them.
262 % \end{description}
263 %
264 % For linear axis you can use a positive or negative integer number
265 % optionally followed by one of the exponent letters as start value
266 % (\param{x-start}) and a positive or negative one as increment
267 % (\param{factor/increment}). The start value range is from $-999$ to
268 % 999\footnote{This restriction is caused by the parsing algorithem
269 % used, which can only handle three digits in this version.}, for the
270 % increment only 0 is not allowed. The exponent letter is not used when
271 % calculating the next value, it is only appended to all values (see
272 % first Example) and never changed (see third Example). Examples:
273 % \begin{description}
274 % \item[\texttt{\lb 10m,2\rb}] leads to ``10m'', ``12m'', ``14m'',
275 % ``16m'', ``18m'' and so on.
276 % \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-99$'' \ldots.
277 % \item[\texttt{\lb 100,100\rb}] leads to ``100'', ``200'' \ldots
278 % ``900'', ``1000''.
279 % \end{description}
280 %
281 % If the format or the values are not correct, you'll get anappropriate
282 % error message.
283 % \item[\texttt{\lb\emph{y-start},\emph{factor/increment}\rb}]
284 % specifys the start value and a factor or increment for the y-axis
285 % labeling on the same way as for the x-axis.
286 % \item[\texttt{[\emph{x-axis name}]}]
287 % specifys a name for the x-axis, it can be an mathematical expression.
288 % The name is set behind the right end and under the x-axis.
289 % The parameter is optional.
290 % \item[\texttt{[\emph{y-axis name}]}]
291 % specifys a name for the y-axis, it can be an mathematical expression.
292 % The name is set over the upper end and left from the y-axis.
293 % The parameter is optional. If you want to have an y-axis name but no
294 % x-axis name you must specify an empty x-axis name with \texttt{[]}.
295 % \end{description}
296 %
297 % ^^A---------------------------------------------
298 % \subsection{Package Options and Settings}\label{sec:opt}
299 % The package has eight option pairs. This means that every option
300 % \texttt{\emph{option}} has an counterpart \texttt{no\emph{option}}. The first
301 % switches on something the second switches off the same thing.
302 % The options are:
303 % \begin{description}
304 % \item[\texttt{[no]ticksupright}]
305 % \DescribeOpt{ticksupright}
306 % \DescribeOpt{noticksupright}
307 % the drawing of ticks on the upper and the right side of the
308 % graph paper will be switched on or off. Default is on.
309 % \item[\texttt{[no]twoninex}]
310 % \DescribeOpt{twoninex}
311 % \DescribeOpt{notwoninex}
312 % applies only to logarithmic x-axis. The axis labeling for the values
313 % for 2 to 9 within a decade will be switched on or off.
314 % Default is on.
315 % \item[\texttt{[no]twoniney}]
316 % \DescribeOpt{twoniney}
317 % \DescribeOpt{notwoniney}
318 % applies only to logarithmic y-axis. The axis labeling for the values
319 % for 2 to 9 within a decade will be switched on or off.
320 % Default is on.
321 % \item[\texttt{[no]fsnx}]
322 % \DescribeOpt{fsnx}
323 % \DescribeOpt{nofsnx}
324 % applies only to logarithmic x-axis. The axis labeling for the values
325 % for 5, 7 and 9 within a decade will be switched on or off. Note that
326 % if \texttt{notwoninex} is set, the values for 5, 7 and 9 will never
327 % appear. Default is on.
328 % \item[\texttt{[no]fsny}]
329 % \DescribeOpt{fsny}
330 % \DescribeOpt{nofsny}
331 % applies only to logarithmic y-axis. The axis labeling for the values
332 % for 5, 7 and 9 within a decade will be switched on or off. Note that
333 % if \texttt{notwoniney} is set, the values for 5, 7 and 9 will never
334 % appear. Default is on.
335 % \item[\texttt{[no]tenlower}]
336 % \DescribeOpt{tenlower}
337 % \DescribeOpt{notenlower}
338 % applies only to logarithmic x-axis.The axis labeling for the values for
339 % 10 (at a decades border) will be set lower if on. Default is off.
340 % \item[\texttt{[no]text}]
341 % \DescribeOpt{text}
342 % \DescribeOpt{notext}
343 % the text ``made with \LaTeX\ and \lp'' will be set left over the
344 % graph paper if on. Default is on. The text can be changed.
345 % \item[\texttt{[no]dimensions}]
346 % \DescribeOpt{dimensions}
347 % \DescribeOpt{nodimensions}
348 % the dimensions of the graph paper in decades and/or divisions will be
349 % shown (after the text ``made with \LaTeX\ and \lp'') if on. Default
350 % is on.
351 % \end{description}
352 % Options unknown by the \lp\ package will be passed to the color package. So
353 % you can use all options of the color package too. But note: global option
354 % (options passed to the document class) are not passed to the package.
355 %
356 % \newmac
357 % \DescribeMacro\LPSet
358 % Everything set with package options can allso be set with the |\LPSet|
359 % command. So you can have more then one graph paper with different settings
360 % in one document. It takes a comma seperated list of option as parameter.
361 % Example:
362 % \begin{verbatim}
363 % \LPSet{noticksupright,notext,nodimensions}\end{verbatim}
364 % ^^A\end{verbatim}
365 % Unknown options passed to |\LPSet| are silently ignored.
366 %
367 % The new settings are then valid from the point you called the command until
368 % the end of the current environment or, if not inside of an environment, until
369 % the end of the document.
370 %
371 % ^^A---------------------------------------------
372 % \subsection{Setup Commands}
373 % The command for changing settings done by package options were allready
374 % described in subsection \ref{sec:opt}. Here the rest of the setup commands
375 % are following. These settings are also valid from the point you called a
376 % command until the end of the current environment or, if not inside of an
377 % environment, until the end of the document.
378 %
379 % \newmac
380 % \DescribeMacro\DefineLPThickLineThickness
381 % \DescribeMacro\DefineLPMedLineThickness
382 % \DescribeMacro\DefineLPThinLineThickness
383 % As seen in section \ref{sec:ov} there are three different line widths used.
384 % They can be set with the commands
385 %
386 % \vspace{1ex}\noindent{\small
387 % \texttt{\bs DefineLPThickLineThickness\lb\emph{thickness}\rb}\\
388 % \texttt{\bs DefineLPMedLineThickness\lb\emph{thickness}\rb}\\
389 % \texttt{\bs DefineLPThinLineThickness\lb\emph{thickness}\rb}}
390 %
391 % \vspace{1ex}\noindent
392 % where \texttt{\emph{thickness}} can be everything accepted as a length by
393 % \TeX. The default values are 0.8\,pt for thick lines, 0.5\,pt for medium
394 % lines and 0.2\,pt for thin lines.
395 %
396 % Setting these values is a little bit critical, because they depend on the
397 % printer resolution.
398 %
399 % If you set the thin line thickness to the minimum line thickness your printer
400 % can draw, it is possible that your printer draws some thin lines with double
401 % thickness. With a medium line thickness of twice the thin line thickness then
402 % you might not be able to distinguish between thin and medium lines.
403 %
404 % With a thin line thickness value of 1.6 times the minimum line thickness of
405 % your printer this (hopefully) will not happen, but it might be only once
406 % this minimum. The medium line thickness then should be at least twice the
407 % thin line thickness and the thick line thickness more than three times the
408 % thin line thickness and more than 1.5 times the medium line thickness. Here
409 % the fact that a printer pixel is larger than guessed due to the resolution
410 % and some printers are capable of subpixel printing (printing some smaller
411 % pixels) where not taken into account. The default values should fit for a
412 % 600\,dpi printer, but anyway it would be a good idea to test them with your
413 % printer.
414 %
415 % This problem was the reason for supporting a configuration file (see
416 % subsection \ref{sec:conf}). There you can put these values for your printer
417 % and so there is no need to put them in every document. And if you give your
418 % source to anyone else he will automaticly use his own configuration file if
419 % he has one.
420 %
421 % \newmac
422 % \DescribeMacro\DefineLPMinLineDist
423 % With \texttt{\bs DefineLPMinLineDist\lb\emph{minimum-line-distance}\rb} you
424 % can set the minimum distance between the lines drawn. Note that due to
425 % rounding error it might be necessary to give a value a little bit lesser
426 % then the value you want. So the default value is not 1\,mm but 0.9999\,mm.
427 %
428 % Another thing to keep in mind is that the thick lines will allways be drawn.
429 % If they are to close together you will get a warning message, and an ugly
430 % result of course.
431 %
432 % \newmac
433 % \DescribeMacro\DefineLPThickTickLen
434 % With \texttt{\bs DefineLPThickTickLen\lb\emph{thick-tick-length}\rb} you can
435 % set the length of the ticks for thick lines, the default value is 2\,mm.
436 %
437 % \newmac
438 % \DescribeMacro\DefineLPMedTickLen
439 % And with \texttt{\bs DefineLPMedTickLen\lb\emph{medium-tick-length}\rb} you
440 % can set the length of the ticks for medium lines, the default value is 1\,mm.
441 %
442 % Note: there is no |\DefineLPThinTickLen| command, because thin lines will
443 % never have ticks.
444 %
445 % \newmac
446 % \DescribeMacro\DefineLPLabelDist
447 % The command \texttt{\bs DefineLPLabelDist\lb\emph{label-distance}\rb}
448 % sets the distance between the axis labeling and the ticks, the default
449 % value is 1\,mm. The label distance for a full decades label with option
450 % \texttt{tenlower} is calculated so that the label is set one
451 % \texttt{\emph{label-distance}} under the normal labels. The value of
452 % \texttt{\emph{label-distance}} is also used as distance between the text
453 % above the graph paper and the ticks and the axis names and the ticks.
454 %
455 % \newmac
456 % \DescribeMacro\DefineLPLabelFont
457 % And the command \texttt{\bs DefineLPLabelFont\lb\emph{label-font}\rb}
458 % sets the font used for axis labeling and the text above the graph paper.
459 % Here you can use all font size commands and commands like |\sffamily|,
460 % |\bfseries| and |\itshape| for the font you want. Note: the |\text..|
461 % commands are not possible here. The default is |\scriptsize|.
462 %
463 % \newmac
464 % \DescribeMacro\DefineLPLineColor
465 % \DescribeMacro\DefineLPLabelColor
466 % The two commands \texttt{\bs DefineLPLineColor\lb...\rb} and
467 % \texttt{\bs DefineLPLabelColor\lb...\rb} sets the colors for
468 % lines and labeling. Here you have to use a complete |\color|
469 % command\footnote{Please refer to \texttt{grfguide} for the description
470 % of the \texttt{\bs color} command.} (with the advantage to have all
471 % capabilities of it). The defaults are |\color[cmyk]{1,0,0,0}| (cyan) for
472 % line color and |\color[cmyk]{0,0,0,1}| (black) for labeling color.
473 %
474 % There are three reasons for the line color default:
475 % \begin{enumerate}
476 % \item The printer colors are (normaly) cyan, magenta, yellow and black, so
477 % the |cmyk| color model where chosen.
478 % \item Only one of these printer colors where chosen, so there is no
479 % need of rastering (which might be worse for thin lines).
480 % \item The color cyan where chosen, because with black you wouldn't see your
481 % (handdrawn) graph, with yellow the lines are to bright and magenta
482 % lines are (in my opinion) to heavy.
483 % \end{enumerate}
484 %
485 % \newmac
486 % \DescribeMacro\DefineLPmu
487 % On the axis labeling there might be a letter appended for ``micro''
488 % ($10^{-6}$). Due to the fact that not all fonts provide a upright
489 % text-$\mu$, the default is just the letter ``u''. But with
490 % \texttt{\bs DefineLPmu\lb\emph{mu}\rb} you can redefine it to the
491 % letter you want (e.g.\ |$\mu$| or |\textmu| if provided).
492 %
493 % \newmac
494 % \DescribeMacro\DefineLPText
495 % With \texttt{\bs DefineLPText\lb\emph{new-text}\rb} you can change the text
496 % displayed above the graph paper. It only changes the first part, not the
497 % second where the dimensions are shown. The distance between the two text
498 % parts has to be a part of the new text. The default text is
499 % ``made with \LaTeX\ and \lp'' followed by a |\quad|.
500 %
501 % ^^A---------------------------------------------
502 % \subsection{Length of Decades/Divisions}
503 % \DescribeMacro\lpgridx
504 % \DescribeMacro\lpgridy
505 % After drawing the graph paper the length of a single decade or division on
506 % the x-axis can be found in |\lpgridx|. And the length of a decade or division
507 % on the y-axis can be found in |\lpgridy|. This might be usefull to put
508 % something into or around the graph paper, but unfortunately it won't be easy
509 % to do such a thing.
510 %
511 % ^^A---------------------------------------------
512 % \subsection{Configuration File}\label{sec:conf}
513 % At the end of the \lp\ package a config file with the name
514 % \texttt{logpap.cfg} is loaded. It has to be somewhere where \TeX\ can find
515 % it. An appropriate place should be the folder
516 % \texttt{.../texmf/tex/latex/config/}.
517 %
518 % Allthough you can make any kind of settings in this file, it is strictly
519 % recommended to use it only for setting the line widths. There should also
520 % be a |\ProvidesFile| command as first line. Here an example
521 % configuration file:
522 %
523 % \begin{verbatim}
524 % \ProvidesFile{logpap.cfg}[2004/02/01 v0.6 configuration for a 600dpi printer]
525 % \DefineLPThickLineThickness{0.8pt}
526 % \DefineLPMedLineThickness{0.5pt}
527 % \DefineLPThinLineThickness{0.2pt}\end{verbatim}
528 % ^^A\end{verbatim}
529 %
530 % ^^A---------------------------------------------
531 % \subsection{Warnings and Errors}
532 % There are two warning messages and six error messages, which can occur.
533 % Both warning messages can occur several times for one graph paper. And if
534 % you ignore an error message (by not correcting the error), you might get
535 % more error messages. For all error messages there is an appropriate help
536 % text, just type |h| at the |?|-prompt to see it.
537 %
538 % \newmac
539 % The first warning message is
540 % \begin{verbatim}
541 % Package logpap Warning: lines are to close together
542 % (logpap) on input line ...\end{verbatim}
543 % ^^A\end{verbatim}
544 % Because thick lines are always drawn, it can happen that they are closer
545 % than the minimum line distance.
546 %
547 % \newmac
548 % The second warning message is
549 % \begin{verbatim}
550 % Package logpap Warning: log. axis value went to large
551 % (logpap) (no more letters for exponent, used X)
552 % (logpap) on input line ...\end{verbatim}
553 % ^^A\end{verbatim}
554 % If the value for a full decade of a logarithmic axis is $10^{27}$ or larger,
555 % there are no more letters for the exponent. The package then uses an X.
556 %
557 % \newmac
558 % The first error message is
559 % \begin{verbatim}
560 % ! Package logpap Error: number of decades for logaritmic axis to small.\end{verbatim}
561 % ^^A\end{verbatim}
562 % It occurs, when the number of decades is less then 0.2.
563 %
564 % \newmac
565 % The second error message is
566 % \begin{verbatim}
567 % ! Package logpap Error: wrong number of decades for logaritmic axis.\end{verbatim}
568 % ^^A\end{verbatim}
569 % It occurs, when the number of decades is something like $x.1$, which doesn't
570 % make sense.
571 %
572 % \newmac
573 % The third error message is
574 % \begin{verbatim}
575 % ! Package logpap Error: number of divisions for linear axis to small.\end{verbatim}
576 % ^^A\end{verbatim}
577 % It occurs, when the number of divisins is less then 0.1.
578 %
579 % \newmac
580 % The fourth error message is
581 % \begin{verbatim}
582 % ! Package logpap Error: wrong format of start value.\end{verbatim}
583 % ^^A\end{verbatim}
584 % It occurs, when the format of start value for logarithmic or linear axis is
585 % not correct. The format is: an optional $+$ or $-$, followed by 1-3 digits,
586 % optionaly followed by one of the letters ``yzafpnumkMGTPEZY''.
587 %
588 % \newmac
589 % The fifth error message is
590 % \begin{verbatim}
591 % ! Package logpap Error: wrong increment for linear axis.\end{verbatim}
592 % ^^A\end{verbatim}
593 % It occurs only, when the increment for a linear axis is 0, which doesn't make
594 % any sense.
595 %
596 % \newmac
597 % The sixth error message is
598 % \begin{verbatim}
599 % ! Package logpap Error: wrong logarithmic start value.\end{verbatim}
600 % ^^A\end{verbatim}
601 % It occurs, when the start value for a logarithmic axis is not $-100$,
602 % $-10$, $-1$, 1, 10 or 100.
603 %
604 % \newmac
605 % The seventh error message is
606 % \begin{verbatim}
607 % ! Package logpap Error: wrong factor for logarithmic axis.\end{verbatim}
608 % ^^A\end{verbatim}
609 % It occurs, when the factor for a logarithmic axis is not in the range from
610 % 1 to 9.
611 %
612 % ^^A--------------------------------------------------------------------------
613 % \StopEventually{\newpage\PrintIndex \PrintChanges}
614 %
615 % ^^A--------------------------------------------------------------------------
616 % \newpage
617 % \section{The Code}
618 % \subsection{The Usual}
619 % First the usual things.
620 % \begin{macrocode}
621 \NeedsTeXFormat{LaTeX2e}[2001/06/01]
622 \ProvidesPackage{logpap}[\filedate\space
623 v\fileversion\space drawing logarithmic graph paper]
624 % \end{macrocode}
625 %
626 % ^^A---------------------------------------------
627 % \subsection{The Options and Settings}
628 % Bevor declaring the options and settings, the booleans used by them are
629 % defined.
630 %
631 % \begin{macro}{\iflp@ticksupright}
632 % \begin{macro}{\lp@ticksuprighttrue}
633 % \begin{macro}{\lp@ticksuprightfalse}
634 % If the boolean |\iflp@ticksupright| is true ticks at the upper and the right
635 % side of the graph paper will be drawn.
636 % \begin{macrocode}
637 \newif\iflp@ticksupright
638 % \end{macrocode}
639 % \end{macro}
640 % \end{macro}
641 % \end{macro}
642 %
643 % \begin{macro}{\iflp@text}
644 % \begin{macro}{\lp@texttrue}
645 % \begin{macro}{\lp@textfalse}
646 % If the boolean |\iflp@text| is true the text (not the dimensions) above the
647 % graph paper is shown.
648 % \begin{macrocode}
649 \newif\iflp@text
650 % \end{macrocode}
651 % \end{macro}
652 % \end{macro}
653 % \end{macro}
654 %
655 % \begin{macro}{\iflp@dimensions}
656 % \begin{macro}{\lp@dimensionstrue}
657 % \begin{macro}{\lp@dimensionsfalse}
658 % If the boolean |\iflp@dimensions| is true the dimensions (not the text) above
659 % the graph paper is shown.
660 % \begin{macrocode}
661 \newif\iflp@dimensions
662 % \end{macrocode}
663 % \end{macro}
664 % \end{macro}
665 % \end{macro}
666 %
667 % \begin{macro}{\iflp@twoninex}
668 % \begin{macro}{\lp@twoninextrue}
669 % \begin{macro}{\lp@twoninexfalse}
670 % If the boolean |\iflp@twoninex| is false the labels for 2 to 9 within a
671 % decade of the x-axis will not appear.
672 % \begin{macrocode}
673 \newif\iflp@twoninex
674 % \end{macrocode}
675 % \end{macro}
676 % \end{macro}
677 % \end{macro}
678 %
679 % \begin{macro}{\iflp@fsnx}
680 % \begin{macro}{\lp@fsnxtrue}
681 % \begin{macro}{\lp@fsnxfalse}
682 % If the boolean |\iflp@fsnx| is false the labels for 5, 7 and 9 within a
683 % decade of the x-axis will not appear.
684 % \begin{macrocode}
685 \newif\iflp@fsnx
686 % \end{macrocode}
687 % \end{macro}
688 % \end{macro}
689 % \end{macro}
690 %
691 % \begin{macro}{\iflp@twoniney}
692 % \begin{macro}{\lp@twonineytrue}
693 % \begin{macro}{\lp@twonineyfalse}
694 % If the boolean |\iflp@twoniney| is false the labels for 2 to 9 within a
695 % decade of the y-axis will not appear.
696 % \begin{macrocode}
697 \newif\iflp@twoniney
698 % \end{macrocode}
699 % \end{macro}
700 % \end{macro}
701 % \end{macro}
702 %
703 % \begin{macro}{\iflp@fsny}
704 % \begin{macro}{\lp@fsnytrue}
705 % \begin{macro}{\lp@fsnyfalse}
706 % If the boolean |\iflp@fsny| is false the labels for 5, 7 and 9 within a
707 % decade of the y-axis will not appear.
708 % \begin{macrocode}
709 \newif\iflp@fsny
710 % \end{macrocode}
711 % \end{macro}
712 % \end{macro}
713 % \end{macro}
714 %
715 % \begin{macro}{\iflp@tenlower}
716 % \begin{macro}{\lp@tenlowertrue}
717 % \begin{macro}{\lp@tenlowerfalse}
718 % If the boolean |\iflp@tenlower| is true the labels for a full decade of
719 % the x-axis will be set lower (under the other labels). The label for the
720 % origin is not affected by |\iflp@tenlower|.
721 % \begin{macrocode}
722 \newif\iflp@tenlower
723 % \end{macrocode}
724 % \end{macro}
725 % \end{macro}
726 % \end{macro}
727 %
728 % \begin{macro}{\lp@DeclareOS}
729 % With |\lp@DeclareOS| an option and an internal setting command in the form
730 % |\lp@@set|\param{option} is defined simultaneously.
731 % \begin{macrocode}
732 \newcommand*\lp@DeclareOS[2]{\DeclareOption{#1}{#2}
733 \expandafter\def\csname lp@@set#1\endcsname{#2}}
734 % \end{macrocode}
735 % \end{macro}
736 %
737 % \begin{macro}{\LPSet}
738 % The command |\LPSet| just passes the comma seperated list of option (|#1|)
739 % to |\lp@set|.
740 % \begin{macrocode}
741 \newcommand*\LPSet[1]{\lp@set#1,\@@end}
742 % \end{macrocode}
743 % \end{macro}
744 %
745 % \begin{macro}{\lp@set}
746 % In |\lp@set| the first option is executed, then it is called recursively
747 % until the list is empty. Unknown options passed to |\LPSet| are silently
748 % ignored.
749 % \begin{macrocode}
750 \def\lp@set#1,#2\@@end{\csname lp@@set#1\endcsname
751 \def\@tempa{#2}\ifx\@tempa\@empty\else\lp@set#2\@@end\fi}
752 % \end{macrocode}
753 % \end{macro}
754 % Now all options and internal setting commands are declared.
755 % \begin{macrocode}
756 \lp@DeclareOS{ticksupright}{\lp@ticksuprighttrue}
757 \lp@DeclareOS{noticksupright}{\lp@ticksuprightfalse}
758 \lp@DeclareOS{twoninex}{\lp@twoninextrue}
759 \lp@DeclareOS{notwoninex}{\lp@twoninexfalse}
760 \lp@DeclareOS{twoniney}{\lp@twonineytrue}
761 \lp@DeclareOS{notwoniney}{\lp@twonineyfalse}
762 \lp@DeclareOS{fsnx}{\lp@fsnxtrue}
763 \lp@DeclareOS{nofsnx}{\lp@fsnxfalse}
764 \lp@DeclareOS{fsny}{\lp@fsnytrue}
765 \lp@DeclareOS{nofsny}{\lp@fsnyfalse}
766 \lp@DeclareOS{tenlower}{\lp@tenlowertrue}
767 \lp@DeclareOS{notenlower}{\lp@tenlowerfalse}
768 \lp@DeclareOS{text}{\lp@texttrue}
769 \lp@DeclareOS{notext}{\lp@textfalse}
770 \lp@DeclareOS{dimensions}{\lp@dimensionstrue}
771 \lp@DeclareOS{nodimensions}{\lp@dimensionsfalse}
772 % \end{macrocode}
773 % Options unknown to the \lp\ package are passed to the color package.
774 % \begin{macrocode}
775 \DeclareOption*{\PassOptionToPackage{\CurrentOption}{color}}
776 % \end{macrocode}
777 % The booleans defaults are set and the options are processed.
778 % \begin{macrocode}
779 \ExecuteOptions{ticksupright,twoninex,twoniney,fsnx,fsny,notenlower,text,dimensions}
780 \ProcessOptions\relax
781 % \end{macrocode}
782 % The calc package is needed to calculate the length of a divison or decade.
783 % The color package is used to get colored lines for the graph paper.
784 % These packages are loaded here.
785 % \begin{macrocode}
786 \RequirePackage{calc}
787 \RequirePackage{color}
788 % \end{macrocode}
789 %
790 % ^^A---------------------------------------------
791 % \subsection{The logarithmic Values}
792 % Because it wouldn't be easy to calculate a logarithem with \TeX\footnote{And
793 % because I'm no mathematician, which means I don't know how to calculate a
794 % logarithem numerical.} the logarithmic value for $x.y$ is stored in a macro
795 % |\lp@log|\param{x.y}
796 %
797 % \begin{macro}{\deflp@logline}
798 % Such a value is defined with
799 % |\deflp@logline{|\param{value}|}{|\param{logarithem-of-value}|}|.
800 % \begin{macrocode}
801 \newcommand*{\deflp@logline}[2]{\expandafter\def\csname lp@log#1\endcsname{#2}}
802 % \end{macrocode}
803 % \end{macro}
804 %
805 % \begin{macro}{\getlp@logline}
806 % With |\getlp@logline{|\param{value}|}| the logarithem of the value can be
807 % requested (if defined before).
808 % \begin{macrocode}
809 \newcommand*{\getlp@logline}[1]{\csname lp@log#1\endcsname}
810 % \end{macrocode}
811 % \end{macro}
812 % Now the logarithems of 1.0 to 10.0 in steps of 0.1 are defined.
813 % \begin{macrocode}
814 \deflp@logline{1.0}{0}
815 \deflp@logline{1.1}{.041393}
816 \deflp@logline{1.2}{.078181}
817 \deflp@logline{1.3}{.113943}
818 \deflp@logline{1.4}{.146128}
819 \deflp@logline{1.5}{.176091}
820 \deflp@logline{1.6}{.20412}
821 \deflp@logline{1.7}{.230449}
822 \deflp@logline{1.8}{.255273}
823 \deflp@logline{1.9}{.278754}
824 \deflp@logline{2.0}{.30103}
825 \deflp@logline{2.1}{.322219}
826 \deflp@logline{2.2}{.342423}
827 \deflp@logline{2.3}{.361728}
828 \deflp@logline{2.4}{.380211}
829 \deflp@logline{2.5}{.39794}
830 \deflp@logline{2.6}{.414973}
831 \deflp@logline{2.7}{.431364}
832 \deflp@logline{2.8}{.447158}
833 \deflp@logline{2.9}{.462398}
834 \deflp@logline{3.0}{.477121}
835 \deflp@logline{3.1}{.491362}
836 \deflp@logline{3.2}{.50515}
837 \deflp@logline{3.3}{.518514}
838 \deflp@logline{3.4}{.531479}
839 \deflp@logline{3.5}{.544068}
840 \deflp@logline{3.6}{.556303}
841 \deflp@logline{3.7}{.568202}
842 \deflp@logline{3.8}{.579784}
843 \deflp@logline{3.9}{.591065}
844 \deflp@logline{4.0}{.60206}
845 \deflp@logline{4.1}{.612784}
846 \deflp@logline{4.2}{.623249}
847 \deflp@logline{4.3}{.633468}
848 \deflp@logline{4.4}{.643453}
849 \deflp@logline{4.5}{.653213}
850 \deflp@logline{4.6}{.662758}
851 \deflp@logline{4.7}{.672098}
852 \deflp@logline{4.8}{.681241}
853 \deflp@logline{4.9}{.690196}
854 \deflp@logline{5.0}{.69897}
855 \deflp@logline{5.1}{.70757}
856 \deflp@logline{5.2}{.716003}
857 \deflp@logline{5.3}{.724276}
858 \deflp@logline{5.4}{.732394}
859 \deflp@logline{5.5}{.740363}
860 \deflp@logline{5.6}{.748188}
861 \deflp@logline{5.7}{.755875}
862 \deflp@logline{5.8}{.763428}
863 \deflp@logline{5.9}{.770852}
864 \deflp@logline{6.0}{.778151}
865 \deflp@logline{6.1}{.78533}
866 \deflp@logline{6.2}{.792392}
867 \deflp@logline{6.3}{.799341}
868 \deflp@logline{6.4}{.80618}
869 \deflp@logline{6.5}{.812913}
870 \deflp@logline{6.6}{.819544}
871 \deflp@logline{6.7}{.826075}
872 \deflp@logline{6.8}{.832509}
873 \deflp@logline{6.9}{.838849}
874 \deflp@logline{7.0}{.845098}
875 \deflp@logline{7.1}{.851258}
876 \deflp@logline{7.2}{.857332}
877 \deflp@logline{7.3}{.863323}
878 \deflp@logline{7.4}{.869232}
879 \deflp@logline{7.5}{.875061}
880 \deflp@logline{7.6}{.880814}
881 \deflp@logline{7.7}{.886491}
882 \deflp@logline{7.8}{.892095}
883 \deflp@logline{7.9}{.897627}
884 \deflp@logline{8.0}{.90309}
885 \deflp@logline{8.1}{.908485}
886 \deflp@logline{8.2}{.913814}
887 \deflp@logline{8.3}{.919078}
888 \deflp@logline{8.4}{.924279}
889 \deflp@logline{8.5}{.929419}
890 \deflp@logline{8.6}{.934498}
891 \deflp@logline{8.7}{.939519}
892 \deflp@logline{8.8}{.944483}
893 \deflp@logline{8.9}{.94939}
894 \deflp@logline{9.0}{.954243}
895 \deflp@logline{9.1}{.959041}
896 \deflp@logline{9.2}{.963788}
897 \deflp@logline{9.3}{.968483}
898 \deflp@logline{9.4}{.973128}
899 \deflp@logline{9.5}{.977724}
900 \deflp@logline{9.6}{.982271}
901 \deflp@logline{9.7}{.986772}
902 \deflp@logline{9.8}{.991226}
903 \deflp@logline{9.9}{.995635}
904 \deflp@logline{10.0}{1}
905 % \end{macrocode}
906 % I thought about making an extra package for the logarithmic values. Perhaps
907 % it might be usefull for other packages. But, because I'm not able to write
908 % a macro that calculates the logarithem, I decided not doing this.
909 %
910 % ^^A---------------------------------------------
911 % \subsection{Registers and other Booleans needed}
912 % \begin{macro}{\lp@dcntx}
913 % In the counter |\lp@dcntx| the number of full decades or divisions of the
914 % x-axis is stored and counted down when drawing lines.
915 % \begin{macrocode}
916 \newcount\lp@dcntx
917 % \end{macrocode}
918 % \end{macro}
919 %
920 % \begin{macro}{\lp@dcnty}
921 % In the counter |\lp@dcnty| the number of full decades or divisions of the
922 % y-axis is stored and counted down when drawing lines.
923 % \begin{macrocode}
924 \newcount\lp@dcnty
925 % \end{macrocode}
926 % \end{macro}
927 %
928 % \begin{macro}{\lpgridx}
929 % The dimen |\lpgridx| holds the length of a full decade or division for the
930 % x-axis.
931 % \begin{macrocode}
932 \newdimen\lpgridx
933 % \end{macrocode}
934 % \end{macro}
935 %
936 % \begin{macro}{\lpgridy}
937 % The dimen |\lpgridy| holds the length of a full decade or division for the
938 % y-axis.
939 % \begin{macrocode}
940 \newdimen\lpgridy
941 % \end{macrocode}
942 % \end{macro}
943 %
944 % \begin{macro}{\lp@thicklinelenx}
945 % In the dimen |\lp@thicklinelenx| the length of a horizontal thick line is
946 % calculated and stored.
947 % \begin{macrocode}
948 \newdimen\lp@thicklinelenx
949 % \end{macrocode}
950 % \end{macro}
951 %
952 % \begin{macro}{\lp@thicklineleny}
953 % In the dimen |\lp@thicklineleny| the length of a vertical thick line is
954 % calculated and stored.
955 % \begin{macrocode}
956 \newdimen\lp@thicklineleny
957 % \end{macrocode}
958 % \end{macro}
959 %
960 % \begin{macro}{\lp@medlinelenx}
961 % In the dimen |\lp@medlinelenx| the length of a horizontal medium line is
962 % calculated and stored.
963 % \begin{macrocode}
964 \newdimen\lp@medlinelenx
965 % \end{macrocode}
966 % \end{macro}
967 %
968 % \begin{macro}{\lp@medlineleny}
969 % In the dimen |\lp@medlineleny| the length of a vertical medium line is
970 % calculated and stored.
971 % \begin{macrocode}
972 \newdimen\lp@medlineleny
973 % \end{macrocode}
974 % \end{macro}
975 %
976 % \begin{macro}{\lp@osg}
977 % The dimen |\lp@osg| is used while drawing lines. Here the offset from the
978 % origin of the graph paper to the begin of the actual decade or division is
979 % calculated and stored.
980 % \begin{macrocode}
981 \newdimen\lp@osg
982 % \end{macrocode}
983 % \end{macro}
984 %
985 % \begin{macro}{\lp@osl}
986 % The dimen |\lp@osl| is used while drawing lines. Here first the offset from
987 % the beginning of the actual decade or division to the actual line is
988 % calculated. And then |\lp@osg| is added to it to get the offset from the
989 % origin of the graph paper to the actual line.
990 % \begin{macrocode}
991 \newdimen\lp@osl
992 % \end{macrocode}
993 % \end{macro}
994 %
995 % \begin{macro}{\iflp@partdecx}
996 % \begin{macro}{\lp@partdecxtrue}
997 % \begin{macro}{\lp@partdecxfalse}
998 % The boolean |\iflp@partdecx| will be set if the last decade or division on
999 % the x-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
1000 % of decades or divisions).
1001 % \begin{macrocode}
1002 \newif\iflp@partdecx
1003 % \end{macrocode}
1004 % \end{macro}
1005 % \end{macro}
1006 % \end{macro}
1007 %
1008 % \begin{macro}{\iflp@partdecy}
1009 % \begin{macro}{\lp@partdecytrue}
1010 % \begin{macro}{\lp@partdecyfalse}
1011 % The boolean |\iflp@partdecy| will be set if the last decade or division on
1012 % the y-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
1013 % of decades or divisions).
1014 % \begin{macrocode}
1015 \newif\iflp@partdecy
1016 % \end{macrocode}
1017 % \end{macro}
1018 % \end{macro}
1019 % \end{macro}
1020 %
1021 % \begin{macro}{\iflp@fulldecx}
1022 % \begin{macro}{\lp@fulldecxtrue}
1023 % \begin{macro}{\lp@fulldecxfalse}
1024 % The boolean |\iflp@fulldecx| will be set if there is at least one full
1025 % decade or division for the x-axis ($x.y$ or $x$ and not $0.y$ as the number
1026 % of decades or divisions).
1027 % \begin{macrocode}
1028 \newif\iflp@fulldecx
1029 % \end{macrocode}
1030 % \end{macro}
1031 % \end{macro}
1032 % \end{macro}
1033 %
1034 % \begin{macro}{\iflp@fulldecy}
1035 % \begin{macro}{\lp@fulldecytrue}
1036 % \begin{macro}{\lp@fulldecyfalse}
1037 % The boolean |\iflp@fulldecy| will be set if there is at least one full
1038 % decade or division for the y-axis ($x.y$ or $x$ and not $0.y$ as the number
1039 % of decades or divisions).
1040 % \begin{macrocode}
1041 \newif\iflp@fulldecy
1042 % \end{macrocode}
1043 % \end{macro}
1044 % \end{macro}
1045 % \end{macro}
1046 %
1047 % \begin{macro}{\iflp@twonine}
1048 % \begin{macro}{\lp@twoninetrue}
1049 % \begin{macro}{\lp@twoninefalse}
1050 % Because the same macro is used to get the next label for a logarithmic
1051 % x- and y-axis, the boolean |\iflp@twonine| is needed. It is set to the
1052 % meaning of |\iflp@twoninex| or |\iflp@twoniney| before labeling is done.
1053 % \begin{macrocode}
1054 \newif\iflp@twonine
1055 % \end{macrocode}
1056 % \end{macro}
1057 % \end{macro}
1058 % \end{macro}
1059 %
1060 % \begin{macro}{\iflp@fsn}
1061 % \begin{macro}{\lp@fsntrue}
1062 % \begin{macro}{\lp@fsnfalse}
1063 % Because the same macro is used to get the next label for a logarithmic
1064 % x- and y-axis, the boolean |\iflp@fsn| is needed. It is set to the
1065 % meaning of |\iflp@fsnx| or |\iflp@fsny| before labeling is done.
1066 % \begin{macrocode}
1067 \newif\iflp@fsn
1068 % \end{macrocode}
1069 % \end{macro}
1070 % \end{macro}
1071 % \end{macro}
1072 %
1073 % \begin{macro}{\iflp@ten}
1074 % \begin{macro}{\lp@tentrue}
1075 % \begin{macro}{\lp@tenfalse}
1076 % The boolean |\iflp@ten| is needed to distinguish between the labels within
1077 % decade and the labels of a full decade, to be able to set only the last
1078 % lower.
1079 % \begin{macrocode}
1080 \newif\iflp@ten
1081 % \end{macrocode}
1082 % \end{macro}
1083 % \end{macro}
1084 % \end{macro}
1085 %
1086 % \begin{macro}{\iflp@logx}
1087 % \begin{macro}{\lp@logxtrue}
1088 % \begin{macro}{\lp@logxfalse}
1089 % The boolean |\iflp@logx| is true if the x-axis is logarithmic. It is needed
1090 % to setup things on different ways for logarithmic and linear axis.
1091 % \begin{macrocode}
1092 \newif\iflp@logx
1093 % \end{macrocode}
1094 % \end{macro}
1095 % \end{macro}
1096 % \end{macro}
1097 %
1098 % \begin{macro}{\iflp@logy}
1099 % \begin{macro}{\lp@logytrue}
1100 % \begin{macro}{\lp@logyfalse}
1101 % The boolean |\iflp@logy| is true if the y-axis is logarithmic. It is needed
1102 % to setup things on different ways for logarithmic and linear axis.
1103 % \begin{macrocode}
1104 \newif\iflp@logy
1105 % \end{macrocode}
1106 % \end{macro}
1107 % \end{macro}
1108 % \end{macro}
1109 %
1110 % \begin{macro}{\iflp@preached}
1111 % \begin{macro}{\lp@preachedtrue}
1112 % \begin{macro}{\lp@preachedfalse}
1113 % The boolean |\iflp@preached| is used while parsing the start value for axis
1114 % labeling. It will be true if the parsed character is one of the letters for
1115 % the exponent. It is also used to get the next exponent letter when labeling
1116 % is done. There it will be true if the start exponent letter (not the next
1117 % one) is reached.
1118 % \begin{macrocode}
1119 \newif\iflp@preached
1120 % \end{macrocode}
1121 % \end{macro}
1122 % \end{macro}
1123 % \end{macro}
1124 %
1125 % ^^A---------------------------------------------
1126 % \subsection{Setup Commands}
1127 % Everything set with the |\DefineLP...| commands is stored in a macro. For
1128 % the first seven this where done to save dimen registers. For the last five
1129 % it seems to be the natural way.
1130 %
1131 % \begin{macro}{\DefineLPThickLineThickness}
1132 % \begin{macro}{\lp@tkltkness}
1133 % With |\DefineLPThickLineThickness| the thick line width is stored in
1134 % |\lp@tkltkness|, which is initialized in the next line.
1135 % \begin{macrocode}
1136 \newcommand*\DefineLPThickLineThickness[1]{\renewcommand*\lp@tkltkness{#1}}
1137 \newcommand*\lp@tkltkness{0.8\p@}
1138 % \end{macrocode}
1139 % \end{macro}
1140 % \end{macro}
1141 %
1142 % \begin{macro}{\DefineLPMedLineThickness}
1143 % \begin{macro}{\lp@mdltkness}
1144 % With |\DefineLPMedLineThickness| the medium line width is stored in
1145 % |\lp@mdltkness|, which is initialized in the next line.
1146 % \begin{macrocode}
1147 \newcommand*\DefineLPMedLineThickness[1]{\renewcommand*\lp@mdltkness{#1}}
1148 \newcommand*\lp@mdltkness{0.5\p@}
1149 % \end{macrocode}
1150 % \end{macro}
1151 % \end{macro}
1152 %
1153 % \begin{macro}{\DefineLPThinLineThickness}
1154 % \begin{macro}{\lp@tnltkness}
1155 % With |\DefineLPThinLineThickness| the thin line width is stored in
1156 % |\lp@tnltkness|, which is initialized in the next line.
1157 % \begin{macrocode}
1158 \newcommand*\DefineLPThinLineThickness[1]{\renewcommand*\lp@tnltkness{#1}}
1159 \newcommand*\lp@tnltkness{0.2\p@}
1160 % \end{macrocode}
1161 % \end{macro}
1162 % \end{macro}
1163 %
1164 % \begin{macro}{\DefineLPMinLineDist}
1165 % \begin{macro}{\lp@mindist}
1166 % With |\DefineLPMinLineDist| the minimum distance between two lines drawn
1167 % is stored in |\lp@mindist|, which is initialized in the next line.
1168 % \begin{macrocode}
1169 \newcommand*\DefineLPMinLineDist[1]{\renewcommand*\lp@mindist{#1}}
1170 \newcommand*\lp@mindist{0.9999mm}
1171 % \end{macrocode}
1172 % \end{macro}
1173 % \end{macro}
1174 %
1175 % \begin{macro}{\DefineLPThickTickLen}
1176 % \begin{macro}{\lp@tol}
1177 % With |\DefineLPThickTickLen| the tick length of thick lines
1178 % is stored in |\lp@tol|, which is initialized in the next line.
1179 % \begin{macrocode}
1180 \newcommand*\DefineLPThickTickLen[1]{\renewcommand*\lp@tol{#1}}
1181 \newcommand*\lp@tol{2mm}
1182 % \end{macrocode}
1183 % \end{macro}
1184 % \end{macro}
1185 %
1186 % \begin{macro}{\DefineLPMedTickLen}
1187 % \begin{macro}{\lp@mol}
1188 % With |\DefineLPMedTickLen| the tick length of medium lines
1189 % is stored in |\lp@mol|, which is initialized in the next line.
1190 % \begin{macrocode}
1191 \newcommand*\DefineLPMedTickLen[1]{\renewcommand*\lp@mol{#1}}
1192 \newcommand*\lp@mol{1mm}
1193 % \end{macrocode}
1194 % \end{macro}
1195 % \end{macro}
1196 %
1197 % \begin{macro}{\DefineLPLabelDist}
1198 % \begin{macro}{\lp@lpos}
1199 % With |\DefineLPLabelDist| the distance betweens ticks and labeling
1200 % is stored in |\lp@lpos|, which is initialized in the next line.
1201 % \begin{macrocode}
1202 \newcommand*\DefineLPLabelDist[1]{\renewcommand*\lp@lpos{#1}}
1203 \newcommand*\lp@lpos{1mm}
1204 % \end{macrocode}
1205 % \end{macro}
1206 % \end{macro}
1207 %
1208 % \begin{macro}{\DefineLPLabelFont}
1209 % \begin{macro}{\lp@font}
1210 % With |\DefineLPLabelFont| the commands needed to choose the font for the
1211 % labeling and the text above the graph paper are stored in |\lp@font|, which
1212 % is initialized in the next line.
1213 % \begin{macrocode}
1214 \newcommand*\DefineLPLabelFont[1]{\renewcommand*\lp@font{#1}}
1215 \newcommand*\lp@font{\scriptsize}
1216 % \end{macrocode}
1217 % \end{macro}
1218 % \end{macro}
1219 %
1220 % \begin{macro}{\DefineLPLineColor}
1221 % \begin{macro}{\lp@linecolor}
1222 % With |\DefineLPLineColor| the command for setting the line color
1223 % is stored in |\lp@linecolor|, which is initialized in the next line.
1224 % \begin{macrocode}
1225 \newcommand*\DefineLPLineColor[1]{\renewcommand*\lp@linecolor{#1}}
1226 \newcommand*\lp@linecolor{\color[cmyk]{1,0,0,0}}
1227 % \end{macrocode}
1228 % \end{macro}
1229 % \end{macro}
1230 %
1231 % \begin{macro}{\DefineLPLabelColor}
1232 % \begin{macro}{\lp@labelcolor}
1233 % With |\DefineLPLabelColor| the command for setting the labels color
1234 % is stored in |\lp@labelcolor|, which is initialized in the next line.
1235 % \begin{macrocode}
1236 \newcommand*\DefineLPLabelColor[1]{\renewcommand*\lp@labelcolor{#1}}
1237 \newcommand*\lp@labelcolor{\color[cmyk]{0,0,0,1}}
1238 % \end{macrocode}
1239 % \end{macro}
1240 % \end{macro}
1241 %
1242 % \begin{macro}{\DefineLPmu}
1243 % \begin{macro}{\lp@mu}
1244 % With |\DefineLPmu| the exponent letter for ``micro'' ($10^{-6}$) is stored in
1245 % |\lp@mu|, which is initialized in the next line.
1246 % \begin{macrocode}
1247 \newcommand*\DefineLPmu[1]{\renewcommand*\lp@mu{#1}}
1248 \newcommand*\lp@mu{u}
1249 % \end{macrocode}
1250 % \end{macro}
1251 % \end{macro}
1252 %
1253 % \begin{macro}{\DefineLPText}
1254 % \begin{macro}{\lp@textone}
1255 % With |\DefineLPText| the first part of the text above the graph paper and
1256 % the distance to the second part is stored in |\lp@textone|, which is
1257 % initialized in the next line.
1258 % \begin{macrocode}
1259 \newcommand*\DefineLPText[1]{\renewcommand*\lp@textone{#1}}
1260 \newcommand*\lp@textone{made with \LaTeX\ and \textsf{logpap}\quad}
1261 % \end{macrocode}
1262 % \end{macro}
1263 % \end{macro}
1264 %
1265 % ^^A---------------------------------------------
1266 % \subsection{Making Lists}
1267 % Before describing the next commands, the mechanism how lines are drawn has
1268 % to be explained:
1269 %
1270 % First the length of a division or decade for an axis is calculated.
1271 % Then a comma separated list is built for every line width. Such a list
1272 % contains normalized\footnote{The Values are all in the range from 0 to 1.
1273 % To get the absolute value it has to be multiplied with the length of a
1274 % division or decade.} offsets from beginning of a decade or division to the
1275 % line to draw. The list for thick lines will always contain offsets for all
1276 % possible lines. The lists for medium and thin lines may contain all offsets
1277 % for a part from $x$ to $(x+1)$, the offsets for $x.2$, $x.4$, $x.6$ and $x.8$
1278 % (no medium line), only the offsets for the medium lines ($x.5$) or no offsets
1279 % at all.\footnote{Here $x$ is 0 for linear axis and 1 to 9 for logarithmic
1280 % axis.} Therefor the distances between $x.9$ to $(x+1).0$, $x.8$ to $(x+1).0$
1281 % and $x.5$ to $(x+1).0$ are calculated and compared to the given minimum line
1282 % distance. The distance between $x$ to $(x+1)$ is only calculated and
1283 % compared to get a warning message if necessary. At last every list is passed
1284 % to a macro, which works it up recursively. This is done once for every decade
1285 % or division (the lists contain the offsets for one decade or division only).
1286 %
1287 % For a partial division only the offsets for $0.1$ to $0.y$ are appended to
1288 % the list, where $y$ is the first digit after the decimal point of the
1289 % \texttt{\emph{decades/divisions}} argument to the linear axis.
1290 % For a partial decade only the offsets for $1.1$ to $x.0$ are appended to the
1291 % list, where $x$ is the first digit after the decimal point of the
1292 % \texttt{\emph{decades/divisions}} argument to the logarithmic axis.
1293 %
1294 % \begin{macro}{\lp@thicklines}
1295 % \begin{macro}{\lp@medlines}
1296 % \begin{macro}{\lp@thinlines}
1297 % In |\lp@thicklines|, |\lp@medlines| and |\lp@thinlines| the comma separated
1298 % lists of normalized offsets form a decades or divisions beginning to the line
1299 % to draw for thick, medium and thin lines are stored.
1300 %
1301 % \begin{macro}{\lp@lllist}
1302 % In |\lp@lllist| the values form 2 to (maximal) 10 for logarithmic axis
1303 % labeling are stored, but in the same order as the offsets for the thick
1304 % lines in |\lp@thicklines|, because latter is used for labeling too.
1305 %
1306 % \begin{macro}{\lp@clearlists}
1307 % With |\lp@clearlists| all theses lists are cleared.
1308 % \begin{macrocode}
1309 \def\lp@clearlists{%
1310 \def\lp@thicklines{,}\def\lp@medlines{,}\def\lp@thinlines{,}%
1311 \def\lp@lllist{,}}
1312 % \end{macrocode}
1313 % \end{macro}
1314 % \end{macro}
1315 % \end{macro}
1316 % \end{macro}
1317 % \end{macro}
1318 %
1319 % ^^A------------------------------
1320 % \subsubsection{Making Lists for logarithmic Axis}
1321 % \begin{macro}{\lp@mkthickloglist}
1322 % \begin{macro}{\lp@thicklines}
1323 % \begin{macro}{\lp@lllist}
1324 % With |\lp@mkthickloglist| the lists in |\lp@thicklines| and |\lp@lllist|
1325 % are built. The parameter is 10 to build lists for a full decade and the
1326 % first digit after the decimal point of the \texttt{\emph{decades/divisions}}
1327 % argument to the logarithmic axis for a partial decade.
1328 % \begin{macrocode}
1329 \def\lp@mkthickloglist#1{%
1330 \@tempcnta\@ne\loop
1331 \advance\@tempcnta\@ne
1332 \edef\lp@thicklines{\getlp@logline{\the\@tempcnta.0},\lp@thicklines}%
1333 \edef\lp@lllist{\the\@tempcnta,\lp@lllist}%
1334 \ifnum\@tempcnta<#1\repeat}
1335 % \end{macrocode}
1336 % \end{macro}
1337 % \end{macro}
1338 % \end{macro}
1339 %
1340 % \begin{macro}{\lp@mkmedloglist}
1341 % \begin{macro}{\lp@medlines}
1342 % In |\lp@mkmedloglist| one offset value is appended to the list in
1343 % |\lp@medlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
1344 % of course |\lp@mkmedloglist| will be called only with values like $x.5$.
1345 % \begin{macrocode}
1346 \def\lp@mkmedloglist#1{%
1347 \edef\lp@medlines{\getlp@logline{#1},\lp@medlines}}
1348 % \end{macrocode}
1349 % \end{macro}
1350 % \end{macro}
1351 %
1352 % \begin{macro}{\lp@mkthinloglist}
1353 % \begin{macro}{\lp@thinlines}
1354 % In |\lp@mkthinloglist| one offset value is appended to the list in
1355 % |\lp@thinlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
1356 % of course |\lp@mkthinloglist| will be called only with values from $x.1$ to
1357 % $x.4$ and from $x.6$ to $x.9$.
1358 % \begin{macrocode}
1359 \def\lp@mkthinloglist#1{%
1360 \edef\lp@thinlines{\getlp@logline{#1},\lp@thinlines}}
1361 % \end{macrocode}
1362 % \end{macro}
1363 % \end{macro}
1364 %
1365 % \begin{macro}{\lp@mkthinloglisttwo}
1366 % The command |\lp@mkthinloglisttwo| appends the offset values for
1367 % $x.2$, $x.4$, $x.6$ and $x.8$ to |\lp@thinlines|. Here $x$ is from 1 to 9
1368 % and passed as parameter |#1|.
1369 % \begin{macrocode}
1370 \def\lp@mkthinloglisttwo#1{%
1371 \lp@mkthinloglist{#1.2}\lp@mkthinloglist{#1.4}%
1372 \lp@mkthinloglist{#1.6}\lp@mkthinloglist{#1.8}}
1373 % \end{macrocode}
1374 % \end{macro}
1375 %
1376 % \begin{macro}{\lp@mkthinloglistone}
1377 % The command |\lp@mkthinloglistone| appends the offset values for
1378 % $x.1$ to $x.4$ and $x.6$ to $x.9$ to |\lp@thinlines|. Here $x$ is from
1379 % 1 to 9 and passed as parameter |#1|.
1380 % \begin{macrocode}
1381 \def\lp@mkthinloglistone#1{\lp@mkthinloglisttwo{#1}%
1382 \lp@mkthinloglist{#1.1}\lp@mkthinloglist{#1.3}%
1383 \lp@mkthinloglist{#1.7}\lp@mkthinloglist{#1.9}}
1384 % \end{macrocode}
1385 % \end{macro}
1386 %
1387 % \begin{macro}{\lp@getdist}
1388 % In |\lp@getdist| the absolute distance between two lines is calculated.
1389 % With parameter |#1| the length of a decade is passed, it has to be one
1390 % of the dimens |\lpgridx| or |\lpgridy|. The parameters |#2| and |#3| are the
1391 % decimal values for the two lines (in the range from 1.0 to 10.0). Note that
1392 % |#2| must be greater then |#3|. After calling |\lp@getdist| the dimen
1393 % |\@tempdima| will contain the absolute distance.
1394 % \begin{macrocode}
1395 \def\lp@getdist#1#2#3{%
1396 \expandafter\@tempdima\getlp@logline{#2}#1%
1397 \expandafter\@tempdimb\getlp@logline{#3}#1%
1398 \advance\@tempdima-\@tempdimb}
1399 % \end{macrocode}
1400 % \end{macro}
1401 %
1402 % \begin{macro}{\lp@mkloglistpart}
1403 % The macro |\lp@mkloglistpart| extends the lists for medium and thin lines
1404 % with the line offsets for the part between $x$ and $(x+1)$, where $x$ is
1405 % from 1 to 9. The decision which offsets are appended (as described earlier)
1406 % is made here. Parameter |#1| is the length of a decade, passed with one
1407 % of the dimens |\lpgridx| or |\lpgridy|. Parameters |#2| is $(x+1)$ and
1408 % parameter |#3| is $x$.
1409 % \begin{macrocode}
1410 \def\lp@mkloglistpart#1#2#3{%
1411 \lp@getdist{#1}{#2.0}{#3.9}\ifdim\@tempdima<\lp@mindist
1412 \lp@getdist{#1}{#2.0}{#3.8}\ifdim\@tempdima<\lp@mindist
1413 \lp@getdist{#1}{#2.0}{#3.5}\ifdim\@tempdima<\lp@mindist
1414 \lp@getdist{#1}{#2.0}{#3.0}\ifdim\@tempdima<\lp@mindist
1415 \PackageWarning{logpap}{%
1416 lines are to close together\MessageBreak}%
1417 \fi
1418 \else
1419 \lp@mkmedloglist{#3.5}%
1420 \fi
1421 \else
1422 \lp@mkthinloglisttwo{#3}%
1423 \fi
1424 \else
1425 \lp@mkmedloglist{#3.5}\lp@mkthinloglistone{#3}%
1426 \fi}
1427 % \end{macrocode}
1428 % \end{macro}
1429 %
1430 % \begin{macro}{\lp@mkloglist}
1431 % With |\lp@mkloglist| all lists for full or partial decade are built.
1432 % Again parameter |#1| is the length of a decade (|\lpgridx| or |\lpgridy|).
1433 % Parameter |#2| is 10 for a full decade and the first digit after the
1434 % decimal point of the \texttt{\emph{decades/divisions}} argument to the
1435 % logarithmic axis for a partial decade.
1436 % \begin{macrocode}
1437 \def\lp@mkloglist#1#2{\lp@clearlists\lp@mkthickloglist{#2}%
1438 \@tempcnta#2\@tempcntb\@tempcnta\advance\@tempcntb\m@ne
1439 \loop
1440 \lp@mkloglistpart{#1}{\the\@tempcnta}{\the\@tempcntb}%
1441 \advance\@tempcnta\m@ne\advance\@tempcntb\m@ne
1442 \ifnum\@tempcnta>\@ne\repeat}
1443 % \end{macrocode}
1444 % \end{macro}
1445 %
1446 % ^^A------------------------------
1447 % \subsubsection{Making Lists for linear Axis}
1448 % \begin{macro}{\lp@mkthicklinlist}
1449 % \begin{macro}{\lp@thicklines}
1450 % With |\lp@mkthicklinlist| the list for thick lines is built. Because it
1451 % will contain only one line at maximum, here no |\edef| is needed. Parameter
1452 % |#1| is 1 for a full division and $.y$ for a partial division, where $y$
1453 % is the first digit after the decimal point of the
1454 % \texttt{\emph{decades/divisions}} argument to the linear axis.
1455 % The decision if the offset has to be appended is made here.
1456 % \begin{macrocode}
1457 \def\lp@mkthicklinlist#1{%
1458 \@tempdima#1\p@\relax\ifdim\@tempdima>.99\p@\def\lp@thicklines{1,}\fi}
1459 % \end{macrocode}
1460 % \end{macro}
1461 % \end{macro}
1462 %
1463 % \begin{macro}{\lp@mkmedlinlist}
1464 % \begin{macro}{\lp@medlines}
1465 % With |\lp@mkmedlinlist| the list for medium lines is built. It also
1466 % will contain only one line at maximum, so no |\edef| is needed here too.
1467 % Parameter |#1| is 1 for a full division and $.y$ for a partial division,
1468 % where $y$ is the first digit after the decimal point of the
1469 % \texttt{\emph{decades/divisions}} argument to the linear axis.
1470 % One part of the decision if the offset has to be appended is made here.
1471 % \begin{macrocode}
1472 \def\lp@mkmedlinlist#1{%
1473 \@tempdima#1\p@\relax\ifdim\@tempdima>.49\p@\def\lp@medlines{.5,}\fi}
1474 % \end{macrocode}
1475 % \end{macro}
1476 % \end{macro}
1477 %
1478 % \begin{macro}{\lp@mkthinlinlist}
1479 % \begin{macro}{\lp@thinlines}
1480 % With |\lp@mkthinlinlist| one line offset is appended to the list for thin
1481 % lines. Parameter |#1| is this offset, only the values .1 to .4 and .6 to .9
1482 % are used.
1483 % \begin{macrocode}
1484 \def\lp@mkthinlinlist#1{%
1485 \edef\lp@thinlines{#1,\lp@thinlines}}
1486 % \end{macrocode}
1487 % \end{macro}
1488 % \end{macro}
1489 %
1490 % \begin{macro}{\lp@mkthinlinlisttwo}
1491 % In |\lp@mkthinlinlisttwo| the offsets (for) .2, .4, .6 and .8 are appended
1492 % if necessary. The decision is made by parameter |#1|, which is 1 for a full
1493 % division and $.y$ for a partial division, where $y$ is the first digit after
1494 % the decimal point of the \texttt{\emph{decades/divisions}} argument to the
1495 % linear axis. One part of the decision, which offsets has to be appended is
1496 % made here.
1497 % \begin{macrocode}
1498 \def\lp@mkthinlinlisttwo#1{%
1499 \@tempdima#1\p@\relax
1500 \ifdim\@tempdima>.19\p@\lp@mkthinlinlist{.2}%
1501 \ifdim\@tempdima>.39\p@\lp@mkthinlinlist{.4}%
1502 \ifdim\@tempdima>.59\p@\lp@mkthinlinlist{.6}%
1503 \ifdim\@tempdima>.79\p@\lp@mkthinlinlist{.8}%
1504 \fi\fi\fi\fi}
1505 % \end{macrocode}
1506 % \end{macro}
1507 %
1508 % \begin{macro}{\lp@mkthinlinlistone}
1509 % In |\lp@mkthinlinlisttwo| the offsets (for) .1 to .4 and .6 to .9 are
1510 % appended if necessary. The decision is made by parameter |#1|, which is 1 for
1511 % a full division and $.y$ for a partial division, where $y$ is the first digit
1512 % after the decimal point of the \texttt{\emph{decades/divisions}} argument to
1513 % the linear axis. One part of the decision, which offsets has to be appended
1514 % is made here.
1515 % \begin{macrocode}
1516 \def\lp@mkthinlinlistone#1{\lp@mkthinlinlisttwo{#1}%
1517 \@tempdima#1\p@\relax
1518 \ifdim\@tempdima>.09\p@\lp@mkthinlinlist{.1}%
1519 \ifdim\@tempdima>.29\p@\lp@mkthinlinlist{.3}%
1520 \ifdim\@tempdima>.69\p@\lp@mkthinlinlist{.7}%
1521 \ifdim\@tempdima>.89\p@\lp@mkthinlinlist{.9}%
1522 \fi\fi\fi\fi}
1523 % \end{macrocode}
1524 % \end{macro}
1525 %
1526 % \begin{macro}{\lp@getlindist}
1527 % In |\lp@getlindist| the absolute distance between two lines is calculated.
1528 % Parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|). The
1529 % parameters |#2| and |#3| are the two line offsets, here |#2| has to be
1530 % greater then |#3|. After calling |\lp@getlindist| the dimen |\@tempdima|
1531 % will contain the absolute distance.
1532 % \begin{macrocode}
1533 \def\lp@getlindist#1#2#3{%
1534 \@tempdima#2#1\@tempdimb#3#1%
1535 \advance\@tempdima-\@tempdimb}
1536 % \end{macrocode}
1537 % \end{macro}
1538 %
1539 % \begin{macro}{\lp@mklinlist}
1540 % With |\lp@mklinlist| all lists for full or partial division are built.
1541 % Again parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|).
1542 % Parameter |#2| is 1 for a full division and $.y$ for a partial division,
1543 % where $y$ is the first digit after the decimal point of the
1544 % \texttt{\emph{decades/divisions}} argument to the linear axis.
1545 % The first part of the decision, which offsets has to be appended is
1546 % made here.
1547 % \begin{macrocode}
1548 \def\lp@mklinlist#1#2{\lp@clearlists\lp@mkthicklinlist{#2}%
1549 \lp@getlindist{#1}{1.0}{0.9}\ifdim\@tempdima<\lp@mindist
1550 \lp@getlindist{#1}{1.0}{0.8}\ifdim\@tempdima<\lp@mindist
1551 \lp@getlindist{#1}{1.0}{0.5}\ifdim\@tempdima<\lp@mindist
1552 \lp@getlindist{#1}{1.0}{0.0}\ifdim\@tempdima<\lp@mindist
1553 \PackageWarning{logpap}{%
1554 lines are to close together\MessageBreak}%
1555 \fi
1556 \else
1557 \lp@mkmedlinlist{#2}%
1558 \fi
1559 \else
1560 \lp@mkthinlinlisttwo{#2}%
1561 \fi
1562 \else
1563 \lp@mkmedlinlist{#2}\lp@mkthinlinlistone{#2}%
1564 \fi}
1565 % \end{macrocode}
1566 % \end{macro}
1567 %
1568 % ^^A---------------------------------------------
1569 % \subsection{Drawing Lines}
1570 % \begin{macro}{\lp@dolinesx}
1571 % The command |\lp@dolinesx| draws all lines from one list of line offsets
1572 % (which contains the offsets for one decade or division). The offset from
1573 % the origin of the graph paper to the start of the decade or division to
1574 % draw is calculated and stored in |\lp@osg|. Parameter |#1| is the macro,
1575 % where the list is stored. Parameter |#2| is the thickness of the lines,
1576 % |#3| is the start positions of the lines in y-direction and |#4| is the
1577 % line length. The real work is done by |\lp@dolinex|, which is called with
1578 % the expanded list.
1579 % \begin{macrocode}
1580 \def\lp@dolinesx#1#2#3#4{\linethickness#2%
1581 \lp@osg\lp@dcntx\lpgridx
1582 \expandafter\lp@dolinex#1,\@@end{#3}{#4}}
1583 % \end{macrocode}
1584 % \end{macro}
1585 %
1586 % \begin{macro}{\lp@dolinex}
1587 % If the list is not empty, |\lp@dolinex| first calculates the offset form
1588 % the origin of the graph paper to the line to draw in |\lp@osl|. Then the
1589 % line is drawn. Note: the command |\put| works with a dimen, because
1590 % |\unitlength| was disabled (with |\let\unitlength\relax|) before starting
1591 % the \texttt{picture} environment. At last |\lp@dolinex| calls itself
1592 % recursively, until the list is empty. Parameter |#1| is the first element of
1593 % the list and parameter |#2| its rest. Parameter |#3| is the start positions
1594 % of the lines in y-direction and |#4| is the line length.
1595 % \begin{macrocode}
1596 \def\lp@dolinex#1,#2,\@@end#3#4{%
1597 \def\@tempc{#1}\ifx\@tempc\@empty\else
1598 \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
1599 \put(\lp@osl,#3){\line(0,1){#4}}%
1600 \def\@tempc{#2}\ifx\@tempc\@empty\else
1601 \lp@dolinex#2,\@@end{#3}{#4}\fi\fi}
1602 % \end{macrocode}
1603 % \end{macro}
1604 %
1605 % \begin{macro}{\lp@dolinesy}
1606 % The command |\lp@dolinesy| works the same way as |\lp@dolinesx|. It has the
1607 % same parameters, except that |#3| is the start position in x-direction.
1608 % \begin{macrocode}
1609 \def\lp@dolinesy#1#2#3#4{\linethickness#2%
1610 \lp@osg\lp@dcnty\lpgridy
1611 \expandafter\lp@doliney#1,\@@end{#3}{#4}}
1612 % \end{macrocode}
1613 % \end{macro}
1614 %
1615 % \begin{macro}{\lp@doliney}
1616 % And |\lp@doliney| works the same way as |\lp@dolinex|. It has also the same
1617 % parameters, except that here |#3| is the start position in x-direction too.
1618 % \begin{macrocode}
1619 \def\lp@doliney#1,#2,\@@end#3#4{%
1620 \def\@tempc{#1}\ifx\@tempc\@empty\else
1621 \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
1622 \put(#3,\lp@osl){\line(1,0){#4}}%
1623 \def\@tempc{#2}\ifx\@tempc\@empty\else
1624 \lp@doliney#2,\@@end{#3}{#4}\fi\fi}
1625 % \end{macrocode}
1626 % \end{macro}
1627 %
1628 % ^^A---------------------------------------------
1629 % \subsection{Labeling}
1630 % \subsubsection{Setup for Labels}
1631 % During setup the \texttt{\emph{x/y-start},\emph{factor/increment}} argument
1632 % is tested and split into four macros. These macros and their contents
1633 % after setup (if everything is correct) are shown in table \ref{tab:sfi}.
1634 % \begin{table}[ht]
1635 % \begin{tabular}{lp{10cm}}\hline\\
1636 % \texttt{\bs lp@sign} & If \texttt{\emph{x/y-start}} is negativ, it contains
1637 % a ``$-$'', else it is empty.\\[.8ex]
1638 % \texttt{\bs lp@sll} & It contains the absolute \texttt{\emph{x/y-start}}
1639 % value (1 to 3 digits), the value itself is not tested
1640 % here (but it will be done later).\\[.8ex]
1641 % \texttt{\bs lp@sllp} & It contains the exponent letter if appended, else it
1642 % is empty.\\[.8ex]
1643 % \texttt{\bs lp@lfi} & It contains the \texttt{\emph{factor/increment}}
1644 % value, which is not tested here (but a range test
1645 % will be done later). If no
1646 % \texttt{\emph{factor/increment}} is given,
1647 % it is 1.\\[2.5ex]\hline
1648 % \end{tabular}
1649 % \caption{Macros for \texttt{\emph{x/y-start},\emph{factor/increment}}
1650 % after Setup}\label{tab:sfi}
1651 % \end{table}
1652 %
1653 % \begin{macro}{\lp@setuplabel}
1654 % \begin{macro}{\lp@lfi}
1655 % For setup the command |\lp@setuplabel| has to be called with the
1656 % \texttt{\emph{x/y-start}, \emph{factor/increment}} argument and a trailing
1657 % comma appended to it, to make it work without a
1658 % \texttt{\emph{factor/increment}} part. The \texttt{\emph{x/y-start}} part
1659 % is processed with |\lp@getsign@ndparse|. If no
1660 % \texttt{\emph{factor/increment}} part is given, |\lp@lfi| is set to 1
1661 % (the default), else this part is processed with |\lp@setup@lfi|.
1662 % \begin{macrocode}
1663 \def\lp@setuplabel#1,#2\@@end{%
1664 \lp@getsign@ndparse#1\@@end
1665 \def\@tempa{#2}\ifx\@tempa\@empty\def\lp@lfi{1}\else
1666 \def\@tempb{,}\ifx\@tempa\@tempb\def\lp@lfi{1}\else
1667 \lp@setup@lfi#2\@@end\fi\fi}
1668 % \end{macrocode}
1669 % \end{macro}
1670 % \end{macro}
1671 %
1672 % \begin{macro}{\lp@setup@lfi}
1673 % \begin{macro}{\lp@lfi}
1674 % The command |\lp@setup@lfi| discards the trailing comma from
1675 % \texttt{\emph{factor/increment},} and stores the factor or increment to
1676 % |\lp@lfi|.
1677 % \begin{macrocode}
1678 \def\lp@setup@lfi#1,\@@end{\def\lp@lfi{#1}}
1679 % \end{macrocode}
1680 % \end{macro}
1681 % \end{macro}
1682 %
1683 % \begin{macro}{\lp@getsign@ndparse}
1684 % \begin{macro}{\lp@sign}
1685 % In |\lp@getsign@ndparse| a leading ``$+$'' or ``$-$'' is discarded from
1686 % \texttt{\emph{x/y-start}}. If it was a ``$-$'', it is stored in |\lp@sign|,
1687 % otherwise |\lp@sign| will be empty. The rest (digits and exponent letter)
1688 % is passed to |\lp@parsesll| together with four ``x'', so that there are
1689 % at least five characters.
1690 % \begin{macrocode}
1691 \def\lp@getsign@ndparse#1#2\@@end{%
1692 \if#1-\relax
1693 \def\lp@sign{#1}\lp@parsesll#2xxxx\@@end
1694 \else\if#1+\relax
1695 \def\lp@sign{}\lp@parsesll#2xxxx\@@end
1696 \else
1697 \def\lp@sign{}\lp@parsesll#1#2xxxx\@@end
1698 \fi\fi}
1699 % \end{macrocode}
1700 % \end{macro}
1701 % \end{macro}
1702 %
1703 % \begin{macro}{\lp@parsesll}
1704 % \begin{macro}{\lp@sll}
1705 % \begin{macro}{\lp@sllp}
1706 % In |\lp@parsesll| the first four parameters takes the first four characters
1707 % passed from |\lp@getsign@ndparse| and parameter |#5| takes the rest (1 to 4
1708 % times ``x''). The first character has to be a digit, if not an error message
1709 % (|\lp@formaterr|) will occur. The next two characters can be a digit,
1710 % one of the exponent letters or an ``x''. If not, the same error message
1711 % will occur. And the fourth character can be an exponent letter or an ``x''.
1712 % Again the error message will occur, if it is not. When an exponent letters or
1713 % an ``x'' is detected, no further characters are tested. The digits are stored
1714 % in |\lp@sll|. The exponent letter is stored in |\lp@sllp|, if there isn't
1715 % one, |\lp@sllp| will be empty.
1716 % \begin{macrocode}
1717 \def\lp@parsesll#1#2#3#4#5\@@end{%
1718 \if\lp@isdigit#1\relax
1719 \if\lp@isdigit#2\relax
1720 \if\lp@isdigit#3\relax
1721 \lp@testletter#4\iflp@preached
1722 \def\lp@sll{#1#2#3}\def\lp@sllp{#4}%
1723 \else\if#4x\relax
1724 \def\lp@sll{#1#2#3}\def\lp@sllp{}%
1725 \else
1726 \lp@formaterr
1727 \fi\fi
1728 \else\lp@testletter#3\iflp@preached
1729 \def\lp@sll{#1#2}\def\lp@sllp{#3}%
1730 \else\if#3x\relax
1731 \def\lp@sll{#1#2}\def\lp@sllp{}%
1732 \else
1733 \lp@formaterr
1734 \fi\fi\fi
1735 \else\lp@testletter#2\iflp@preached
1736 \def\lp@sll{#1}\def\lp@sllp{#2}%
1737 \else\if#2x\relax
1738 \def\lp@sll{#1}\def\lp@sllp{}%
1739 \else
1740 \lp@formaterr
1741 \fi\fi\fi
1742 \else
1743 \lp@formaterr
1744 \fi}
1745 % \end{macrocode}
1746 % \end{macro}
1747 % \end{macro}
1748 % \end{macro}
1749 %
1750 % \begin{macro}{\lp@formaterr}
1751 % The command |\lp@formaterr| gives an error message for a wrong
1752 % \texttt{\emph{x/y-start}} argument. It is used only in |\lp@parsesll|.
1753 % \begin{macrocode}
1754 \def\lp@formaterr{%
1755 \PackageError{logpap}{wrong format of start value}%
1756 {The format of the start value is:\MessageBreak
1757 optional + or -, followed by 1-3 digits, optionaly\MessageBreak
1758 followed by one of the letters [yzafpnumkMGTPEZY].\MessageBreak
1759 Please correct it before going on,\MessageBreak
1760 otherwise you might get more error messages.}}
1761 % \end{macrocode}
1762 % \end{macro}
1763 %
1764 % \begin{macro}{\lp@isdigit}
1765 % With |\lp@isdigit| parameter |#1| is tested, whether it is a digit or
1766 % not.\footnote{This macro was kept from the UK-\TeX FAQ,
1767 % chapter ``Macro programming'', section ``Is the argument a number?''.}
1768 % It has to be invoked as follows: |\if\lp@isdigit|\meta{character}
1769 % \meta{stuff for character is a digit} |\else|
1770 % \meta{stuff for character is not a digit} |\fi|. The |\if| is needed to make
1771 % it work in nested if-strctures, therefor |\lp@isdigit| begins with |TT\fi|
1772 % to end this |\if|. The |\else| and |\fi| then belongs to the (uncomplete)
1773 % |\ifcat|. The comparison is done by the |\ifnum|. If |#1| is a digit the
1774 % second value will be 10 or greater, so the |\ifnum| expands to ``|_|'' and
1775 % the |\ifcat| will be true. In the other case|\ifnum| expands to ``|A|'' and
1776 % the |\ifcat| will be false. The macro would also work for positive numbers.
1777 % \begin{macrocode}
1778 \def\lp@isdigit#1{TT\fi\ifcat_\ifnum9<1#1 _\else A\fi}
1779 % \end{macrocode}
1780 % \end{macro}
1781 %
1782 % \begin{macro}{\lp@testletter}
1783 % In |\lp@testletter| parameter |#1|, which has to be one character,
1784 % is compared to all possible exponent letter. The boolean |\iflp@preached|
1785 % is set to true if |#1| is one of the letters, else it is set to false.
1786 % \begin{macrocode}
1787 \def\lp@testletter#1{%
1788 \def\@tempb{#1}\lp@preachedfalse
1789 \@tfor\@tempc:=yzafpnumkMGTPEZY\do{%
1790 \if\@tempc\@tempb\relax\relax\lp@preachedtrue\@break@tfor\fi}}
1791 % \end{macrocode}
1792 % \end{macro}
1793 %
1794 % ^^A------------------------------
1795 % \subsubsection{Range Test for Label Values}
1796 % The next two macros (|\lp@testrangelin| and |\lp@testrangelog|) are not
1797 % invoked directly. Their meaning is assigned to |\lp@testrangex| and
1798 % |\lp@testrangey| by |\lp@@@logpap| instead, so the right test for an axis
1799 % takes place.
1800 %
1801 % \begin{macro}{\lp@testrangelin}
1802 % In |\lp@testrangelin| the start value for a linear axis is not tested,
1803 % because due to the tests in |\lp@parsesll| it is in the range from
1804 % $-999$ to 999 and there is no other limitation. The increment is only
1805 % tested against 0, because this doesn't make any sense.
1806 % \begin{macrocode}
1807 \def\lp@testrangelin{\@tempcnta\lp@lfi\relax
1808 \ifnum\@tempcnta=0\relax
1809 \PackageError{logpap}{wrong increment for linear axis}%
1810 {The increment value is 0, which doesn't make any sense.\MessageBreak
1811 Please correct it before going on.}%
1812 \fi}
1813 % \end{macrocode}
1814 % \end{macro}
1815 %
1816 % \begin{macro}{\lp@testrangelog}
1817 % In |\lp@testrangelog| first the start value is tested whether it is 1, 10
1818 % or 100. If not, an error message will occur. A test against the possible
1819 % negative values is not necessary, because |\lp@sll| only contains the
1820 % absolute value (the sign is in |\lp@sign|). The test against 0 is not realy
1821 % necessary, but I could resist ;-) At last the factor is tested whether
1822 % it is in the range from 1 to 9.
1823 % \begin{macrocode}
1824 \def\lp@testrangelog{\@tempcnta\lp@sll\relax
1825 \ifnum\@tempcnta=1\else\ifnum\@tempcnta=10\else\ifnum\@tempcnta=100\else
1826 \ifnum\@tempcnta=0\relax
1827 \PackageError{logpap}{wrong logarithmic start value}%
1828 {0 as start value for a logarithmic axis?\MessageBreak
1829 This is a typo, isn't it?\MessageBreak
1830 If not, you should learn more mathematics\MessageBreak
1831 before using this package ;-)\MessageBreak
1832 Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
1833 Please correct it before going on.}%
1834 \else
1835 \PackageError{logpap}{wrong logarithmic start value}%
1836 {Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
1837 Please correct it before going on.}%
1838 \fi
1839 \fi\fi\fi
1840 \@tempcnta\lp@lfi\relax
1841 \ifnum\@tempcnta<1\lp@logfacerr\else\ifnum\@tempcnta>9\lp@logfacerr\fi\fi}
1842 % \end{macrocode}
1843 % \end{macro}
1844 %
1845 % \begin{macro}{\lp@logfacerr}
1846 % The command |\lp@logfacerr| just gives out an error message for a wrong
1847 % factor for logarithmic axis labeling.
1848 % \begin{macrocode}
1849 \def\lp@logfacerr{\PackageError{logpap}{wrong factor for logarithmic axis}%
1850 {The factor has to be in the range from 1 to 9.\MessageBreak
1851 Please correct it before going on.}}
1852 % \end{macrocode}
1853 % \end{macro}
1854 %
1855 % ^^A------------------------------
1856 % \subsubsection{Getting next Label}
1857 % The two macros |\lp@nextlinlabel| and |\lp@nextloglabel| are not invoked
1858 % directly, but assigned to |\lp@nextxlabel| and |\lp@nextylabel| by
1859 % |\lp@@@logpap|.
1860 %
1861 % \begin{macro}{\lp@nextlinlabel}
1862 % \begin{macro}{\lp@label}
1863 % In |\lp@nextlinlabel| first the labels value is calculated. Therefore the
1864 % increment (|#3|) is multiplied with the number of the division (|#4|) and
1865 % to the result the increment is added, because the label is at the end of
1866 % the actual division. To get the final value the signed (|#6|) start value
1867 % (|#1|) has to be added. After that if the exponent letter (|#2|) is ``u''
1868 % it is replaced with |\lp@mu|. The complete label is stored in |\lp@label|,
1869 % but with the exponent letter discarded if the value is 0. Note: parameter
1870 % |#5| is not used here, but it is necessary to be parameter compatible with
1871 % |\lp@nextloglabel|.
1872 % \begin{macrocode}
1873 \def\lp@nextlinlabel#1#2#3#4#5#6{\@tempcnta#3\multiply\@tempcnta#4\relax
1874 \advance\@tempcnta#3\advance\@tempcnta#6#1\relax
1875 \def\@tempa{#2}\def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
1876 \edef\lp@label{\the\@tempcnta\ifnum\@tempcnta=0\else\@tempa\fi}}
1877 % \end{macrocode}
1878 % \end{macro}
1879 % \end{macro}
1880 %
1881 % \begin{macro}{\lp@nextloglabel}
1882 % The parameters for |\lp@nextloglabel| are the absolut start value (|#1|),
1883 % the start exponent letter (|#2|), the factor (|#3|), the decades count
1884 % (beginning with 0, |#4|), a number from 2 to 10 (|#5|) and the sign (|#6|).
1885 %
1886 % First the number is used to distinguish between a label within a decade
1887 % (values from 2 to 9) and a label for a full decade (10). The latter label
1888 % consists of the sign, the factor multiplied with one of the values 1, 10 or
1889 % 100 and the trailing exponent letter.
1890 % \begin{macrocode}
1891 \def\lp@nextloglabel#1#2#3#4#5#6{%
1892 \@tempcnta#5\relax\ifnum\@tempcnta=10
1893 \lp@tentrue
1894 % \end{macrocode}
1895 % The values 1, 10 and 100 can also be expressed as $10^a$, where the exponent
1896 % $a$ (in |\@tempcnta|) is 0, 1 or 2. To get this exponent the decades count
1897 % (|#4|) has to be advanced by one if the start value (|#1|) is 1, by two if
1898 % the start value is 10 or by three if the start value is 100.
1899 % \begin{macrocode}
1900 \@tempcnta#4\relax\@tempcntb#1\relax
1901 \advance\@tempcnta\@ne
1902 \ifnum\@tempcntb>1\advance\@tempcnta\@ne
1903 \ifnum\@tempcntb>10\advance\@tempcnta\@ne\fi\fi
1904 % \end{macrocode}
1905 % After a modulo 3 (next four lines) $a$ is in the right range and |\lp@label|
1906 % can be defined as the value needed within a case structure.
1907 % \begin{macrocode}
1908 \@tempcntb\@tempcnta
1909 \divide\@tempcntb 3\relax
1910 \multiply\@tempcntb 3\relax
1911 \advance\@tempcnta-\@tempcntb
1912 \ifcase\@tempcnta
1913 \def\lp@label{1}\or
1914 \def\lp@label{10}\or
1915 \def\lp@label{100}\fi
1916 % \end{macrocode}
1917 % From the modulo operation the vaule $a-(a\;\mbox{mod}\;3)$ remains in
1918 % |\@tempcntb|. After dividing it by 3 it contains the number of exponent
1919 % letters to step further. This is done in |\lp@getpot| after that |\@tempa|
1920 % will contain the needed letter, or an ``X'' if there are no more letters.
1921 % In the latter case a warning is given.
1922 % \begin{macrocode}
1923 \divide\@tempcntb 3\relax
1924 \lp@getpot{#2}\@tempcntb
1925 \def\@tempb{X}\ifx\@tempa\@tempb
1926 \PackageWarning{logpap}{%
1927 log. axis value went to large\MessageBreak
1928 (no more letters for exponent, used X)\MessageBreak}%
1929 \fi
1930 % \end{macrocode}
1931 % \begin{macro}{\lp@label}
1932 % If the exponent letter is ``u'', it is replaced by |\lp@mu|. Then the value
1933 % (1, 10 or 100) is multiplied with the factor (|#3|) and the signed (|#6|)
1934 % label is built in |\lp@label|.
1935 % \begin{macrocode}
1936 \def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
1937 \@tempcnta\lp@label\multiply\@tempcnta#3\relax
1938 \edef\lp@label{#6\the\@tempcnta\@tempa}%
1939 \else
1940 % \end{macrocode}
1941 % This method building the complte label is independent of the order drawing
1942 % the decades.
1943 %
1944 % \begin{macro}{\lp@label}
1945 % If a label for within a decade is needed, the number (|#5|) is multiplied
1946 % with the factor (|#3|) and then the signed (|#6|) label is built in
1947 % |\lp@label|. But if the option |notwonine| where given, |\lp@label| will be
1948 % empty and if the option |nofsn| where given, the already built |\lp@label|
1949 % for 5, 7 and 9 will be cleared.
1950 % \begin{macrocode}
1951 \lp@tenfalse
1952 \iflp@twonine
1953 \multiply\@tempcnta#3\relax
1954 \edef\lp@label{#6\the\@tempcnta}%
1955 \iflp@fsn\else
1956 \divide\@tempcnta#3\relax
1957 \ifnum\@tempcnta=9\def\lp@label{}\fi
1958 \ifnum\@tempcnta=7\def\lp@label{}\fi
1959 \ifnum\@tempcnta=5\def\lp@label{}\fi
1960 \fi
1961 \else
1962 \def\lp@label{}%
1963 \fi
1964 \fi}
1965 % \end{macrocode}
1966 % \end{macro}
1967 % \end{macro}
1968 % \end{macro}
1969 %
1970 % \begin{macro}{\lp@getpot}
1971 % In |\lp@getpot| the exponent letter needed for a full decades label is
1972 % ascertained. It takes the letter to start with (|#1|) and the number of
1973 % of letters to step further (|#2|) as parameters. The macro |\@tempa| will
1974 % contain the ascertained letter after operation. It is predefined as ``X'',
1975 % which will be the result, if there are not enough letters.
1976 %
1977 % Within the |\@tfor| loop the boolean |\iflp@preached| is set to true in the
1978 % pass the start letter is reached. From the same pass on the number of letters
1979 % to step further is counted down once a pass until it is $-1$. Then |\@tempa|
1980 % is set to the actual letter. Note: the |{}| in the token list (between |:=|
1981 % and |\do|) stands for the nonexisting letter for $10^0$. The |\@tfor| loop
1982 % will always run completely, because (for whatever reasons) |\@break@tfor|
1983 % doesn't work within the |\ifnum|.
1984 % \begin{macrocode}
1985 \def\lp@getpot#1#2{%
1986 \def\@tempb{#1}\def\@tempa{X}\@tempcnta#2\relax\lp@preachedfalse
1987 \@tfor\@tempc:=yzafpnum{}kMGTPEZY\do{%
1988 \if\@tempc\@tempb\relax\relax\lp@preachedtrue\fi
1989 \iflp@preached\advance\@tempcnta\m@ne
1990 \ifnum\@tempcnta=\m@ne\edef\@tempa{\@tempc}\fi
1991 \fi}}
1992 % \end{macrocode}
1993 % \end{macro}
1994 %
1995 % ^^A------------------------------
1996 % \subsubsection{Drawing Labels}
1997 % \begin{macro}{\lp@xlabel}
1998 % With |\lp@xlabel| one label for the x-axis is drawn. Parameter |#1| is the
1999 % offset from the origin of the graph paper to the thick line, where the label
2000 % has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
2001 % is already advanced by |\lp@tol|, when calling |\lp@xlabel|. Note (2): the
2002 % command |\put| works with a dimen, because |\unitlength| was disabled before
2003 % starting the \texttt{picture} environment.
2004 % \begin{macrocode}
2005 \def\lp@xlabel#1#2{\let\@tempb\lp@lpos
2006 \iflp@tenlower\iflp@ten\let\@tempb\lp@llpos\fi\fi
2007 \put(#1,-\@tempb){\makebox(\z@,\z@)[tc]{\lp@font #2}}}
2008 % \end{macrocode}
2009 % \end{macro}
2010 %
2011 % \begin{macro}{\lp@ylabel}
2012 % With |\lp@ylabel| one label for the y-axis is drawn. Parameter |#1| is the
2013 % offset from the origin of the graph paper to the thick line, where the label
2014 % has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
2015 % is already advanced by |\lp@tol|, when calling |\lp@ylabel|. Note (2): here
2016 % also |\put| works with a dimen, because of the disabled |\unitlength|.
2017 % \begin{macrocode}
2018 \def\lp@ylabel#1#2{\put(-\lp@lpos,#1){\makebox(\z@,\z@)[cr]{\lp@font #2}}}
2019 % \end{macrocode}
2020 % \end{macro}
2021 %
2022 % \begin{macro}{\lp@nextlllist}
2023 % \begin{macro}{\lp@llno}
2024 % \begin{macro}{\lp@lllist}
2025 % In |\lp@nextlllist| the first element of the list in |\lp@lllist| is
2026 % discarded from it and stored in |\lp@llno|. The macro has to be called
2027 % with the expanded |\lp@lllist|.
2028 % \begin{macrocode}
2029 \def\lp@nextlllist#1,#2\@@end{%
2030 \def\lp@llno{#1}\def\lp@lllist{#2}}
2031 % \end{macrocode}
2032 % \end{macro}
2033 % \end{macro}
2034 % \end{macro}
2035 %
2036 % \begin{macro}{\lp@dolabelsx}
2037 % \begin{macro}{\lp@lllist}
2038 % With |\lp@dolabelsx| the labels for one decade or division are drawn. Here
2039 % first the offset from the origin of the graph paper to the beginning of the
2040 % actual decade or division is calculated and stored in |\lp@osg|. Then the
2041 % list containing the values for logarithmic axis labels (|#5|) is assigned to
2042 % |\lp@lllist|.\footnote{The name \texttt{\bs lp@lllist} can be used here,
2043 % because after building the list in \texttt{\bs lp@lllist} it is assigned to
2044 % one of the names \texttt{\bs lp@lllistx}, \texttt{\bs lp@lllisty},
2045 % \texttt{\bs lp@partlllistx} or \texttt{\bs lp@partlllisty}.} At last
2046 % |\lp@dolabelx| is called with the expanded list of offsets from the beginning
2047 % of a decade or division to the thick lines, where the labels has to appear
2048 % at, and the other papameters. These parameters are the start value (|#2|),
2049 % the start exponent letter (|#3|), the factor or increment (|#4|) and the
2050 % start values sign (|#6|).
2051 % \begin{macrocode}
2052 \def\lp@dolabelsx#1#2#3#4#5#6{\lp@osg\lp@dcntx\lpgridx
2053 \let\lp@lllist#5\relax
2054 \expandafter\lp@dolabelx#1,\@@end{#2}{#3}{#4}{#6}}
2055 % \end{macrocode}
2056 % \end{macro}
2057 % \end{macro}
2058 %
2059 % \begin{macro}{\lp@dolabelx}
2060 % If the list is not empty, |\lp@dolabelx| first calculates the offset form
2061 % the origin of the graph paper to the line, where the label has to appear at,
2062 % in |\lp@osl|. Then the next element of |\lp@lllist| is stored in |\lp@llno|,
2063 % the next label is built and it is drawn. At last |\lp@dolabelx| calls itself
2064 % recursively, until the list is empty. Parameter |#1| is the first element of
2065 % the list of offsets and parameter |#2| its rest. Parameter |#3| is the start
2066 % value, |#4| the start exponent letter, |#5| the factor or increment and |#6|
2067 % the start values sign.
2068 % \begin{macrocode}
2069 \def\lp@dolabelx#1,#2,\@@end#3#4#5#6{%
2070 \def\@tempc{#1}\ifx\@tempc\@empty\else
2071 \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
2072 \expandafter\lp@nextlllist\lp@lllist\@@end
2073 \lp@nextxlabel{#3}{#4}{#5}\lp@dcntx\lp@llno{#6}%
2074 \lp@xlabel\lp@osl\lp@label
2075 \def\@tempc{#2}\ifx\@tempc\@empty\else
2076 \lp@dolabelx#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
2077 % \end{macrocode}
2078 % \end{macro}
2079 %
2080 % \begin{macro}{\lp@dolabelsy}
2081 % \begin{macro}{\lp@lllist}
2082 % The command |\lp@dolabelsy| works the same way and has the same parameters
2083 % as |\lp@dolabelsx|, but of course for the y-axis.
2084 % \begin{macrocode}
2085 \def\lp@dolabelsy#1#2#3#4#5#6{\lp@osg\lp@dcnty\lpgridy
2086 \let\lp@lllist#5\relax
2087 \expandafter\lp@dolabely#1,\@@end{#2}{#3}{#4}{#6}}
2088 % \end{macrocode}
2089 % \end{macro}
2090 % \end{macro}
2091 %
2092 % \begin{macro}{\lp@dolabely}
2093 % The command |\lp@dolabely| works the same way and has the same parameters
2094 % as |\lp@dolabelx|, but of course for the y-axis.
2095 % \begin{macrocode}
2096 \def\lp@dolabely#1,#2,\@@end#3#4#5#6{%
2097 \def\@tempc{#1}\ifx\@tempc\@empty\else
2098 \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
2099 \expandafter\lp@nextlllist\lp@lllist\@@end
2100 \lp@nextylabel{#3}{#4}{#5}\lp@dcnty\lp@llno{#6}%
2101 \lp@ylabel\lp@osl\lp@label
2102 \def\@tempc{#2}\ifx\@tempc\@empty\else
2103 \lp@dolabely#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
2104 % \end{macrocode}
2105 % \end{macro}
2106 %
2107 % ^^A---------------------------------------------
2108 % \subsection{Some Macros for Initialization}
2109 % \subsubsection{Setting Lists}
2110 % \begin{macro}{\lp@setlinesx}
2111 % \begin{macro}{\lp@thicklinesx}
2112 % \begin{macro}{\lp@medlinesx}
2113 % \begin{macro}{\lp@thinlinesx}
2114 % \begin{macro}{\lp@lllistx}
2115 % In |\lp@setlinesx| only the already built lists for a full decade or
2116 % divisions are assigned the macros special to the x-axis.
2117 % \begin{macrocode}
2118 \def\lp@setlinesx{\let\lp@thicklinesx\lp@thicklines
2119 \let\lp@medlinesx\lp@medlines \let\lp@thinlinesx\lp@thinlines
2120 \let\lp@lllistx\lp@lllist}
2121 % \end{macrocode}
2122 % \end{macro}
2123 % \end{macro}
2124 % \end{macro}
2125 % \end{macro}
2126 % \end{macro}
2127 %
2128 % \begin{macro}{\lp@setlinesy}
2129 % \begin{macro}{\lp@thicklinesy}
2130 % \begin{macro}{\lp@medlinesy}
2131 % \begin{macro}{\lp@thinlinesy}
2132 % \begin{macro}{\lp@lllisty}
2133 % In |\lp@setlinesy| only the already built lists for a full decade or
2134 % divisions are assigned the macros special to the y-axis.
2135 % \begin{macrocode}
2136 \def\lp@setlinesy{\let\lp@thicklinesy\lp@thicklines
2137 \let\lp@medlinesy\lp@medlines \let\lp@thinlinesy\lp@thinlines
2138 \let\lp@lllisty\lp@lllist}
2139 % \end{macrocode}
2140 % \end{macro}
2141 % \end{macro}
2142 % \end{macro}
2143 % \end{macro}
2144 % \end{macro}
2145 %
2146 % \begin{macro}{\lp@setpartlinesx}
2147 % \begin{macro}{\lp@partthicklinesx}
2148 % \begin{macro}{\lp@partmedlinesx}
2149 % \begin{macro}{\lp@partthinlinesx}
2150 % \begin{macro}{\lp@partlllistx}
2151 % In |\lp@setpartlinesx| only the already built lists for a partial decade or
2152 % divisions are assigned the macros special to the x-axis.
2153 % \begin{macrocode}
2154 \def\lp@setpartlinesx{\let\lp@partthicklinesx\lp@thicklines
2155 \let\lp@partmedlinesx\lp@medlines \let\lp@partthinlinesx\lp@thinlines
2156 \let\lp@partlllistx\lp@lllist}
2157 % \end{macrocode}
2158 % \end{macro}
2159 % \end{macro}
2160 % \end{macro}
2161 % \end{macro}
2162 % \end{macro}
2163 %
2164 % \begin{macro}{\lp@setpartlinesy}
2165 % \begin{macro}{\lp@partthicklinesy}
2166 % \begin{macro}{\lp@partmedlinesy}
2167 % \begin{macro}{\lp@partthinlinesy}
2168 % \begin{macro}{\lp@partlllisty}
2169 % In |\lp@setpartlinesy| only the already built lists for a partial decade or
2170 % divisions are assigned the macros special to the y-axis.
2171 % \begin{macrocode}
2172 \def\lp@setpartlinesy{\let\lp@partthicklinesy\lp@thicklines
2173 \let\lp@partmedlinesy\lp@medlines \let\lp@partthinlinesy\lp@thinlines
2174 \let\lp@partlllisty\lp@lllist}
2175 % \end{macrocode}
2176 % \end{macro}
2177 % \end{macro}
2178 % \end{macro}
2179 % \end{macro}
2180 % \end{macro}
2181 %
2182 % ^^A------------------------------
2183 % \subsubsection{Parsing Number of Decades/Divisions}
2184 % \begin{macro}{\lp@ipart}
2185 % The macro |\lp@ipart| expands to the integer part of a real number, which
2186 % is passed to it.
2187 % \begin{macrocode}
2188 \def\lp@ipart#1.#2\@@end{#1}
2189 % \end{macrocode}
2190 % \end{macro}
2191 %
2192 % \begin{macro}{\lp@rpart}
2193 % The macro |\lp@rpart| expands to the part after the decimal point of
2194 % a real number, which is passed to it.
2195 % \begin{macrocode}
2196 \def\lp@rpart#1.#2\@@end{#2}
2197 % \end{macrocode}
2198 % \end{macro}
2199 %
2200 % \begin{macro}{\lp@firstdigit}
2201 % The macro |\lp@firstdigit| expands to the first digit of a (integer) number,
2202 % which is passed to it.
2203 % \begin{macrocode}
2204 \def\lp@firstdigit#1#2\@@end{#1}
2205 % \end{macrocode}
2206 % \end{macro}
2207 %
2208 % \begin{macro}{\lp@getreal}
2209 % In |\lp@getreal| the number of decades or division as passed to the
2210 % \texttt{\emph{decades/divisions}} argument of an axis (parameter |#1|)
2211 % is split. The integer part is stored in |\@tempa|, if there is no integer
2212 % part |\@tempa| will be 0. The first digit after the decimal point is stored
2213 % in |\@tempb| if it is not equal 0, else |\@tempb| will be empty. This works
2214 % for $x$, $x.$, $x.0$, $x.y$, $x.0z$, $x.yz$, $0.y$, $0.yz$, $.y$ and $.yz$
2215 % (here $x$ and $y$ are single digits and $z$ is the rest).
2216 % \begin{macrocode}
2217 \def\lp@getreal#1{%
2218 \edef\@tempa{\lp@ipart#1.\@@end}%
2219 \ifx\@tempa\@empty\def\@tempa{0}\fi
2220 \edef\@tempc{\lp@rpart#1.\@@end}%
2221 \ifx\@tempc\@empty\let\@tempb\@empty\else
2222 \if\@tempc.\let\@tempb\@empty\else
2223 \edef\@tempd{\expandafter\lp@firstdigit\@tempc\@@end}%
2224 \if\@tempd0\let\@tempb\@empty\else
2225 \let\@tempb\@tempd\fi\fi\fi}
2226 % \end{macrocode}
2227 % \end{macro}
2228 %
2229 % ^^A------------------------------
2230 % \subsubsection{Checking Number of Decades/Devisions}
2231 % \begin{macro}{\lp@decerr}
2232 % With |\lp@decerr| an error message for a to small number of decades is given.
2233 % \begin{macrocode}
2234 \def\lp@decerr{%
2235 \PackageError{logpap}{number of decades for logaritmic axis to small}%
2236 {The number of decades for a logaritmic axis\MessageBreak
2237 has to be at least 0.2.\MessageBreak
2238 Please correct it before going on,\MessageBreak
2239 otherwise you might get more error messages.}}
2240 % \end{macrocode}
2241 % \end{macro}
2242 %
2243 % \begin{macro}{\lp@decerri}
2244 % With |\lp@decerri| an error message for a wrong number of decades is given.
2245 % \begin{macrocode}
2246 \def\lp@decerri{%
2247 \PackageError{logpap}{wrong number of decades for logaritmic axis}%
2248 {For the number of decades for a logaritmic axis\MessageBreak
2249 values like x.1 are not alowed.\MessageBreak
2250 You can only use x.0 (or only x) and x.2 to x.9.\MessageBreak
2251 Please correct it before going on,\MessageBreak
2252 otherwise you might get more error messages.}}
2253 % \end{macrocode}
2254 % \end{macro}
2255 %
2256 % \begin{macro}{\lp@checkdec}
2257 % In |\lp@checkdec| the number of decades is checked against a minimum value of
2258 % 0.2 and values in the form x.1 and an appropriate error messages is given if
2259 % necessary. The integer part has to be in |\@tempa| and the first digit after
2260 % the decimal point in |\@tempb| when calling |\lp@checkdec|.
2261 % \begin{macrocode}
2262 \def\lp@checkdec{\@tempcnta\@tempa
2263 \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
2264 \ifnum\@tempcnta<0\relax\lp@decerr\else
2265 \ifnum\@tempcntb=0\relax\ifnum\@tempcnta=0\relax\lp@decerr\fi\else
2266 \ifnum\@tempcntb<0\relax\lp@decerri\else
2267 \ifnum\@tempcntb=1\relax
2268 \ifnum\@tempcnta=0\relax\lp@decerr\else
2269 \lp@decerri\fi\fi\fi\fi\fi}
2270 % \end{macrocode}
2271 % \end{macro}
2272 %
2273 % \begin{macro}{\lp@diverr}
2274 % With |\lp@diverr| an error message for a to small number of divisions is
2275 % given.
2276 % \begin{macrocode}
2277 \def\lp@diverr{%
2278 \PackageError{logpap}{number of divisions for linear axis to small}%
2279 {The number of divisions for a linear axis\MessageBreak
2280 has to be at least 0.1.\MessageBreak
2281 Please correct it before going on,\MessageBreak
2282 otherwise you might get more error messages.}}
2283 % \end{macrocode}
2284 % \end{macro}
2285 %
2286 % \begin{macro}{\lp@checkdiv}
2287 % In |\lp@checkdiv| the number of divisions is checked against a minimum value
2288 % of 0.1 and an appropriate error message is given if necessary. The integer
2289 % part has to be in |\@tempa| and the first digit after the decimal point in
2290 % |\@tempb| when calling |\lp@checkdiv|.
2291 % \begin{macrocode}
2292 \def\lp@checkdiv{\@tempcnta\@tempa
2293 \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
2294 \ifnum\@tempcnta<0\relax\lp@diverr\else
2295 \ifnum\@tempcnta=0\relax
2296 \ifnum\@tempcntb<1\relax\lp@diverr\fi\fi\fi}
2297 % \end{macrocode}
2298 % \end{macro}
2299 %
2300 % ^^A---------------------------------------------
2301 % \subsection{Drawing the whole Graph Paper}
2302 % \begin{macro}{\lp@logpap}
2303 % The command |\lp@logpap| is invoked by the four main macros. It only checks
2304 % if there is a first optional argument.
2305 % \begin{macrocode}
2306 \def\lp@logpap(#1,#2)(#3,#4)#5#6{%
2307 \@ifnextchar[{\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}}%
2308 {\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[]}}
2309 % \end{macrocode}
2310 % \end{macro}
2311 %
2312 % \begin{macro}{\lp@@logpap}
2313 % The command |\lp@@logpap| checks if there is a second optional argument.
2314 % \begin{macrocode}
2315 \def\lp@@logpap#1#2#3#4#5#6[#7]{%
2316 \@ifnextchar[{\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7]}%
2317 {\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7][]}}
2318 % \end{macrocode}
2319 % \end{macro}
2320 %
2321 % \begin{macro}{\lp@@@logpap}
2322 % In |\lp@@@logpap| most of the work is done. The parameters are the dimension
2323 % of the graph paper in x- (|#1|) and y-direction (|#2|), the number of decades
2324 % or divisions in x- (|#3|) and y-direction (|#4|), the start value and factor
2325 % or increment for x- (|#5|) and y-axis labeling (|#6|) and the x- (|#7|) and
2326 % y-axis name (|#8|).
2327 %
2328 % First a lot of settings for the x-axis are made. Here the number of decades
2329 % or divisions is split (integer part in |\@tempa| and first digit after
2330 % decimal point in |\@tempb|, empty if 0 or none) and checked, the boolean
2331 % |\iflp@fulldecx| is set and the text showing the dimensions (|\lp@texttwo|)
2332 % is extended. Latter is done several times until the text is complete.
2333 % \begin{macrocode}
2334 \def\lp@@@logpap#1#2#3#4#5#6[#7][#8]{%
2335 \lp@getreal{#3}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
2336 \ifnum\@tempa=0\relax\lp@fulldecxfalse\else\lp@fulldecxtrue\fi
2337 \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
2338 % \end{macrocode}
2339 % Now the boolean |\lp@partdecxfalse| is set and |\lp@real| and |\lp@part|
2340 % are defined, but latter only if there is a partial decade or division.
2341 % \begin{macrocode}
2342 \ifx\@tempb\@empty
2343 \lp@partdecxfalse
2344 \let\lp@real\@tempa
2345 \edef\lp@texttwo{\lp@texttwo\iflp@logx\,dec\fi\ $\times$}%
2346 \else
2347 \lp@partdecxtrue
2348 \iflp@logx
2349 \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
2350 \edef\lp@part{\@tempb}%
2351 \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec\ $\times$}%
2352 \else
2353 \edef\lp@real{\@tempa.\@tempb}%
2354 \edef\lp@part{.\@tempb}%
2355 \edef\lp@texttwo{\lp@texttwo.\@tempb\ $\times$}%
2356 \fi
2357 \fi
2358 % \end{macrocode}
2359 % Then |\lp@dcntx| is set and |\lpgridx| is calculated with help of the
2360 % extensions to |\setlength| by the \textsf{calc} package (and made global,
2361 % so it can be used after the graph paper was drawn). All lists for the
2362 % x-axis are made and the necessary commands for testing the range of the
2363 % argument for labeling and getting the next label are assigned to
2364 % |\lp@testrangex| and |\lp@nextxlabel|.
2365 % \begin{macrocode}
2366 \lp@dcntx\@tempa
2367 \setlength\lpgridx{#1/\real{\lp@real}}\global\lpgridx\lpgridx
2368 \iflp@logx
2369 \lp@mkloglist\lpgridx{10}\lp@setlinesx
2370 \iflp@partdecx \lp@mkloglist\lpgridx\lp@part \lp@setpartlinesx\fi
2371 \let\lp@testrangex\lp@testrangelog
2372 \let\lp@nextxlabel\lp@nextloglabel
2373 \else
2374 \lp@mklinlist\lpgridx{1}\lp@setlinesx
2375 \iflp@partdecx \lp@mklinlist\lpgridx\lp@part \lp@setpartlinesx\fi
2376 \let\lp@testrangex\lp@testrangelin
2377 \let\lp@nextxlabel\lp@nextlinlabel
2378 \fi
2379 % \end{macrocode}
2380 % After this the same things are set up for y-axis on the same way.
2381 % \begin{macrocode}
2382 \lp@getreal{#4}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
2383 \ifnum\@tempa=0\relax\lp@fulldecyfalse\else\lp@fulldecytrue\fi
2384 \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
2385 \ifx\@tempb\@empty
2386 \lp@partdecyfalse
2387 \let\lp@real\@tempa
2388 \edef\lp@texttwo{\lp@texttwo\iflp@logy\,dec\fi}%
2389 \else
2390 \lp@partdecytrue
2391 \iflp@logy
2392 \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
2393 \edef\lp@part{\@tempb}%
2394 \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec}%
2395 \else
2396 \edef\lp@real{\@tempa.\@tempb}%
2397 \edef\lp@part{.\@tempb}%
2398 \edef\lp@texttwo{\lp@texttwo.\@tempb}%
2399 \fi
2400 \fi
2401 \lp@dcnty\@tempa
2402 \setlength\lpgridy{#2/\real{\lp@real}}\global\lpgridy\lpgridy
2403 \iflp@logy
2404 \lp@mkloglist\lpgridy{10}\lp@setlinesy
2405 \iflp@partdecy \lp@mkloglist\lpgridy\lp@part \lp@setpartlinesy\fi
2406 \let\lp@testrangey\lp@testrangelog
2407 \let\lp@nextylabel\lp@nextloglabel
2408 \else
2409 \lp@mklinlist\lpgridy{1}\lp@setlinesy
2410 \iflp@partdecy \lp@mklinlist\lpgridy\lp@part \lp@setpartlinesy\fi
2411 \let\lp@testrangey\lp@testrangelin
2412 \let\lp@nextylabel\lp@nextlinlabel
2413 \fi
2414 % \end{macrocode}
2415 % Now the lengths for thick and medium lines are calculated by adding the tick
2416 % length once, or twice if ticks on the upper and the right side of the graph
2417 % paper should appear.
2418 % \begin{macrocode}
2419 \lp@thicklinelenx#1\advance\lp@thicklinelenx\lp@tol
2420 \lp@thicklineleny#2\advance\lp@thicklineleny\lp@tol
2421 \lp@medlinelenx#1\advance\lp@medlinelenx\lp@mol
2422 \lp@medlineleny#2\advance\lp@medlineleny\lp@mol
2423 \iflp@ticksupright
2424 \advance\lp@thicklinelenx\lp@tol
2425 \advance\lp@thicklineleny\lp@tol
2426 \advance\lp@medlinelenx\lp@mol
2427 \advance\lp@medlineleny\lp@mol
2428 \fi
2429 % \end{macrocode}
2430 % Then everything for x-axis labeling is set up, the values are tested and
2431 % assigned to |\lp@sllx|, |\lp@sllpx|, |\lp@lfix| and |\lp@signx|.
2432 % \begin{macrocode}
2433 \lp@setuplabel#5,\@@end
2434 \lp@testrangex
2435 \let\lp@sllx\lp@sll\let\lp@sllpx\lp@sllp\let\lp@lfix\lp@lfi
2436 \let\lp@signx\lp@sign
2437 % \end{macrocode}
2438 % The same is done for y-axis labeling.
2439 % \begin{macrocode}
2440 \lp@setuplabel#6,\@@end
2441 \lp@testrangey
2442 \let\lp@slly\lp@sll\let\lp@sllpy\lp@sllp\let\lp@lfiy\lp@lfi
2443 \let\lp@signy\lp@sign
2444 % \end{macrocode}
2445 % After that |\unitlength| is disabled within a group (ending at the end of
2446 % |\lp@@@logpap|), so all commands of the \texttt{picture} environment and the
2447 % environment itself will work with dimens (and only with dimens). Then
2448 % |\lp@llpos| is calculated so that labels, which have to appear lower (see
2449 % option \texttt{tenlower}), are put one |\lp@lpos| under normal labels and
2450 % |\lp@lpos| is advanced by |\lp@tol|, so that normal labels appears one
2451 % (unadvanced) |\lp@lpos| under the ticks.
2452 % \begin{macrocode}
2453 \begingroup
2454 \let\unitlength\relax
2455 {\lp@font\settoheight\@tempdima{M}\advance\@tempdima\lp@tol
2456 \advance\@tempdima\lp@lpos\advance\@tempdima\lp@lpos
2457 \xdef\lp@llpos{\the\@tempdima}}%
2458 \@tempdima\lp@lpos\advance\@tempdima\lp@tol\edef\lp@lpos{\the\@tempdima}%
2459 \begin{picture}(#1,#2)(\z@,\z@)
2460 % \end{macrocode}
2461 % Within the \texttt{picture} environment first the label for the x-axis origin
2462 % is set. For a logarithmic axis the start value has to be multiplied by the
2463 % factor. If the exponent letter is ``u'' it is replaced with |\lp@mu|. And
2464 % if the start value is 0 (linear axis only) the sign and the exponent letter
2465 % are cleard.
2466 % \begin{macrocode}
2467 \lp@labelcolor
2468 \lp@tenfalse
2469 \@tempcnta\lp@sllx\iflp@logx\multiply\@tempcnta\lp@lfix\fi
2470 \def\@tempa{u}\ifx\lp@sllpx\@tempa\def\@tempa{\lp@mu}\else
2471 \def\@tempa{\lp@sllpx}\fi
2472 \begingroup
2473 \ifnum\@tempcnta=0\let\lp@signx\@empty\let\@tempa\@empty\fi
2474 \lp@xlabel{\z@}{\lp@signx\the\@tempcnta\@tempa}
2475 \endgroup
2476 % \end{macrocode}
2477 % The label for the y-axis origin is set on the same way.
2478 % \begin{macrocode}
2479 \@tempcnta\lp@slly\iflp@logy\multiply\@tempcnta\lp@lfiy\fi
2480 \def\@tempa{u}\ifx\lp@sllpy\@tempa\def\@tempa{\lp@mu}\else
2481 \def\@tempa{\lp@sllpy}\fi
2482 \begingroup
2483 \ifnum\@tempcnta=0\let\lp@signy\@empty\let\@tempa\@empty\fi
2484 \lp@ylabel{\z@}{\lp@signy\the\@tempcnta\@tempa}
2485 \endgroup
2486 % \end{macrocode}
2487 % Now the two text parts are set above the graph paper.
2488 % \begin{macrocode}
2489 \@tempdima#2\advance\@tempdima\lp@lpos
2490 \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
2491 \put(\z@,\@tempdima){\makebox(\z@,\z@)[bl]{\lp@font
2492 \iflp@text\lp@textone\fi\iflp@dimensions\lp@texttwo\fi}}
2493 % \end{macrocode}
2494 % And the axis names are set at the end of the y- and x-axis. The y-position
2495 % for the y-axis name (|\@tempdima|) is the same as for the two text parts.
2496 % \begin{macrocode}
2497 \put(-\lp@lpos,\@tempdima){\makebox(\z@,\z@)[br]{#8}}
2498 \@tempdima#1\advance\@tempdima\lp@lpos
2499 \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
2500 \put(\@tempdima,-\lp@lpos){\makebox(\z@,\z@)[tl]{#7}}
2501 % \end{macrocode}
2502 % Then the lines for the origin are drawn.
2503 % \begin{macrocode}
2504 \lp@linecolor
2505 \linethickness\lp@tkltkness
2506 \put(-\lp@tol,\z@){\line(1,0){\lp@thicklinelenx}}
2507 \put(\z@,-\lp@tol){\line(0,1){\lp@thicklineleny}}
2508 % \end{macrocode}
2509 % After that lines and labels for the x-axis will be done. Here first the
2510 % booleans |\iflp@twonine| and |\iflp@fsn| are set depending on
2511 % |\iflp@twoninex| and |\iflp@fsnx|.
2512 % \begin{macrocode}
2513 \iflp@twoninex\lp@twoninetrue\else\lp@twoninefalse\fi
2514 \iflp@fsnx\lp@fsntrue\else\lp@fsnfalse\fi
2515 % \end{macrocode}
2516 % Then lines and labels for a partial decade or division are done if there is
2517 % one.
2518 % \begin{macrocode}
2519 \iflp@partdecx
2520 \lp@dolinesx\lp@partthicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
2521 \lp@dolinesx\lp@partmedlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
2522 \lp@dolinesx\lp@partthinlinesx\lp@tnltkness\z@{#2}%
2523 \lp@labelcolor
2524 \lp@dolabelsx\lp@partthicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@partlllistx\lp@signx
2525 \lp@linecolor
2526 \fi
2527 % \end{macrocode}
2528 % If there is at least one full decade or division, they are done one by one.
2529 % \begin{macrocode}
2530 \iflp@fulldecx\advance\lp@dcntx\m@ne
2531 \loop
2532 \lp@dolinesx\lp@thicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
2533 \lp@dolinesx\lp@medlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
2534 \lp@dolinesx\lp@thinlinesx\lp@tnltkness\z@{#2}%
2535 \lp@labelcolor
2536 \lp@dolabelsx\lp@thicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@lllistx\lp@signx
2537 \lp@linecolor
2538 \advance\lp@dcntx\m@ne
2539 \ifnum\lp@dcntx>\m@ne\repeat
2540 \fi
2541 % \end{macrocode}
2542 % The lines and labels for y-axis are done on the same way as for the x-axis.
2543 % \begin{macrocode}
2544 \iflp@twoniney\lp@twoninetrue\else\lp@twoninefalse\fi
2545 \iflp@fsny\lp@fsntrue\else\lp@fsnfalse\fi
2546 \iflp@partdecy
2547 \lp@dolinesy\lp@partthicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
2548 \lp@dolinesy\lp@partmedlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
2549 \lp@dolinesy\lp@partthinlinesy\lp@tnltkness\z@{#1}%
2550 \lp@labelcolor
2551 \lp@dolabelsy\lp@partthicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@partlllisty\lp@signy
2552 \lp@linecolor
2553 \fi
2554 \iflp@fulldecy\advance\lp@dcnty\m@ne
2555 \loop
2556 \lp@dolinesy\lp@thicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
2557 \lp@dolinesy\lp@medlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
2558 \lp@dolinesy\lp@thinlinesy\lp@tnltkness\z@{#1}%
2559 \lp@labelcolor
2560 \lp@dolabelsy\lp@thicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@lllisty\lp@signy
2561 \lp@linecolor
2562 \advance\lp@dcnty\m@ne
2563 \ifnum\lp@dcnty>\m@ne\repeat
2564 \fi
2565 \end{picture}\endgroup}
2566 % \end{macrocode}
2567 % \end{macro}
2568 %
2569 % ^^A---------------------------------------------
2570 % \subsection{The main Macros}
2571 % The four main macros are very simple. Here only two booleans are set and
2572 % the first part of the text showing the dimensions is defined. They even
2573 % take no parameters. This is done by |\lp@logpap|, called at the end of
2574 % the main macros.
2575 %
2576 % \begin{macro}{\loglinpap}
2577 % The command |\loglinpap| draws graph paper with logarithmic x-axis and
2578 % linear y-axis.
2579 % \begin{macrocode}
2580 \def\loglinpap{\lp@logxtrue\lp@logyfalse\def\lp@texttwo{log--lin:}\lp@logpap}
2581 % \end{macrocode}
2582 % \end{macro}
2583 %
2584 % \begin{macro}{\loglogpap}
2585 % The command |\loglogpap| draws graph paper with logarithmic x- and y-axis.
2586 % \begin{macrocode}
2587 \def\loglogpap{\lp@logxtrue\lp@logytrue\def\lp@texttwo{log--log:}\lp@logpap}
2588 % \end{macrocode}
2589 % \end{macro}
2590 %
2591 % \begin{macro}{\linlogpap}
2592 % The command |\linlogpap| draws graph paper with linear x-axis and
2593 % logarithmic y-axis.
2594 % \begin{macrocode}
2595 \def\linlogpap{\lp@logxfalse\lp@logytrue\def\lp@texttwo{lin--log:}\lp@logpap}
2596 % \end{macrocode}
2597 % \end{macro}
2598 %
2599 % \begin{macro}{\linlinpap}
2600 % The command |\linlinpap| draws graph paper with linear x- and y-axis.
2601 % \begin{macrocode}
2602 \def\linlinpap{\lp@logxfalse\lp@logyfalse\def\lp@texttwo{lin--lin:}\lp@logpap}
2603 % \end{macrocode}
2604 % \end{macro}
2605 %
2606 % ^^A---------------------------------------------
2607 % \subsection{Config File}
2608 % The last thing to do is loading the config file if it exists. In this case
2609 % a message will be typed out.
2610 % \begin{macrocode}
2611 \InputIfFileExists{logpap.cfg}%
2612 {\typeout{Package logpap Info: Local config file logpap.cfg used}}{}
2613 % \end{macrocode}
2614 %
2615 % \newpage
2616 % \Finale\endinput
2617 %</package>
2618 % ^^A Now the source of the example
2619 %<*example>
2620 \documentclass[a4paper]{article}
2621 \usepackage[latin1]{inputenc}
2622 \usepackage{logpap}
2623
2624 \voffset-2cm
2625 \hoffset-0.5cm
2626 \textheight25cm
2627 \textwidth14cm
2628
2629 \parindent0pt
2630 \parskip1ex plus.3ex minus.2ex
2631 \pagestyle{empty}
2632 \unitlength1mm
2633
2634 \newcommand*{\lp}{\textsf{logpap}}
2635 \newcommand*{\bs}{\char '134 }
2636 \newcommand*{\lb}{\char '173 }
2637 \newcommand*{\rb}{\char '175 }
2638 \newcommand*{\param}[1]{\texttt{\textit{#1}}}
2639
2640 \begin{document}
2641 \centerline{\textbf{\LARGE Some Examples for the \lp\ package.\footnote{The
2642 source of this example file is part of \texttt{logpap.dtx}.}}}
2643
2644 \vspace{4mm}
2645 The \lp\ package provides four macros for drawing logarithmic-logarithmic,
2646 logarithmic-linear, linear-logarithmic and (because it was easy to implement)
2647 linear-linear graph paper with \LaTeX.
2648
2649 \vspace{2mm}
2650 \begin{picture}(140,50)
2651 \LPSet{nofsnx,notwoniney}
2652 \put( 0, 5){\linlogpap(60mm,12.5mm)(6,1){0,10}{1}[X][Y]}
2653 \put(75, 5){\linlinpap(60mm,12.5mm)(6,1){0,10}{0,10}[X][Y]}
2654 \put( 0,32.5){\loglogpap(60mm,12.5mm)(2,1){100m}{1}[X][Y]}
2655 \put(75,32.5){\loglinpap(60mm,12.5mm)(2,1){100m}{0,10}[X][Y]}
2656 \end{picture}
2657
2658 \vspace{2mm}
2659 Altough the \lp\ package only draws logarithmic graph paper, there are
2660 various things that can be changed. Figure \ref{fig:ov} will give an
2661 overwiev. Here the first graph paper part where made with the default
2662 settings and the command
2663 \verb|\put(0,91){\loglinpap(80mm,10mm)(1,1){1}| \verb|{0}[X-name][Y-name]}|.
2664 On the right side you can find the commands used to change the appearance.
2665
2666 Not all commands possible are shown here. Every option can be used with
2667 \verb|\LPSet{|\param{option1}\verb|,| \param{option2}\verb|,...}| within the
2668 document, every \param{option} has a counterpart \verb|no|\param{option} and
2669 for every \param{option}\verb|x| also an \param{option}\verb|y| exists. Also
2670 commands to set the three line widths, colors and the appearance of the $\mu$
2671 are not shown.
2672
2673 \begin{figure}[ht]
2674 \centering
2675 \begin{picture}(140,106)
2676 \put( 0,91){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
2677 \put(85,96){\makebox(0,0)[cl]{with default settings}}
2678
2679 \LPSet{nodimensions,noticksupright,tenlower}
2680 \put( 0,69){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
2681 \put(85,78){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
2682 \put(85,74){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
2683 \put(85,70){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
2684 \LPSet{dimensions,ticksupright,notenlower}
2685
2686 \LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
2687 \put( 0,47){\loglinpap(80mm,10mm)(1,1){1}{0}}
2688 \put(85,56){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
2689 \put(85,52){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
2690 \put(85,48){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
2691 \LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}
2692
2693 \DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
2694 \put( 0,25){\loglinpap(80mm,10mm)(1,1){1}{0}}
2695 \put(85,36){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
2696 \put(85,32){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
2697 \put(85,28){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
2698 \put(85,24){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
2699 \DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}
2700
2701 \DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
2702 \put( 0, 3){\loglinpap(80mm,10mm)(1,1){1}{0}}
2703 \put(85,12){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
2704 \put(85, 8){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
2705 \put(85, 4){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
2706 \DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
2707 \end{picture}
2708 \caption{Overview}\label{fig:ov}
2709 \end{figure}
2710 \end{document}
2711 %</example>