summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/logpap
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/logpap
Initial commit
Diffstat (limited to 'macros/latex/contrib/logpap')
-rw-r--r--macros/latex/contrib/logpap/README29
-rw-r--r--macros/latex/contrib/logpap/example.pdfbin0 -> 79577 bytes
-rw-r--r--macros/latex/contrib/logpap/logpap.dtx2711
-rw-r--r--macros/latex/contrib/logpap/logpap.ins67
4 files changed, 2807 insertions, 0 deletions
diff --git a/macros/latex/contrib/logpap/README b/macros/latex/contrib/logpap/README
new file mode 100644
index 0000000000..55ce644d4b
--- /dev/null
+++ b/macros/latex/contrib/logpap/README
@@ -0,0 +1,29 @@
+Copyright (c) 2004 Mike Kaufmann
+mike.kaufmann@ei.fh-giessen.de
+Licence: LPPL
+
+1. What is it?
+The logpap package provides four macros for drawing logarithmic-logarithmic,
+logarithmic-linear, linear-logarithmic and (because it was easy to implement)
+linear-linear graph paper with LaTeX.
+
+2. Example
+Look at the file example.pdf to get an overview.
+The source can be generated by answering the question "There is an example
+file in logpap.dtx. Generate it? [y/n]" with y when running lcd.ins thru TeX.
+
+3. Generating logpap.sty
+Simply run: tex logpap.ins
+
+4. Making the Documentation
+To get contents, cross references and index right, run TeX and makeindex
+as follows:
+
+latex logpap.dtx
+latex logpap.dtx
+makeindex -s gind.ist logpap.idx
+makeindex -o logpap.gls -s gglo.ist logpap.glo
+latex logpap.dtx
+
+5. Files
+00readme example.pdf logpap.dtx logpap.ins
diff --git a/macros/latex/contrib/logpap/example.pdf b/macros/latex/contrib/logpap/example.pdf
new file mode 100644
index 0000000000..63c1200db8
--- /dev/null
+++ b/macros/latex/contrib/logpap/example.pdf
Binary files differ
diff --git a/macros/latex/contrib/logpap/logpap.dtx b/macros/latex/contrib/logpap/logpap.dtx
new file mode 100644
index 0000000000..44e201e047
--- /dev/null
+++ b/macros/latex/contrib/logpap/logpap.dtx
@@ -0,0 +1,2711 @@
+% \iffalse meta-comment
+%
+% Package logpap
+% Copyright (c) 2004 Mike Kaufmann, all rights reserved
+%
+% This program is provided under the terms of the
+% LaTeX Project Public License distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt.
+%
+% Author: Mike Kaufmann
+% Mike.Kaufmann@ei.fh-giessen.de
+% \fi
+%% \CharacterTable
+%% {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
+%% 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
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%%
+% \CheckSum{1968}
+%
+% \iffalse meta-comment
+%
+%<*package>
+\def\fileversion{0.6}
+\def\filedate{2004/02/01}
+%</package>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{logpap}
+\setlength{\unitlength}{1mm}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+\begin{document}
+ \DocInput{logpap.dtx}
+\end{document}
+%</driver>
+%
+%<*package>
+% \fi
+%
+% \DoNotIndex{\,,\ }
+% \DoNotIndex{\@@end,\@break@tfor,\@empty,\@ifnextchar}
+% \DoNotIndex{\@ne,\@tempa,\@tempb,\@tempc,\@tempd,\@tempcnta,\@tempcntb}
+% \DoNotIndex{\@tempdima,\@tempdimb,\@tempdimc,\@tfor}
+% \DoNotIndex{\advance}
+% \DoNotIndex{\begin,\begingroup}
+% \DoNotIndex{\csname,\color,\CurrentOption}
+% \DoNotIndex{\DeclareOption,\def,\divide,\do}
+% \DoNotIndex{\edef,\else,\end,\endgroup,\endcsname,\ExecuteOption}
+% \DoNotIndex{\expandafter,\ExecuteOptions}
+% \DoNotIndex{\fi,\filedate,\fileversion}
+% \DoNotIndex{\global}
+% \DoNotIndex{\if,\ifcase,\ifcat,\ifdim,\ifnum,\ifx,\InputIfFileExists}
+% \DoNotIndex{\LaTeX,\let,\line,\linethickness,\loop}
+% \DoNotIndex{\m@ne,\makebox,\multiply,\MessageBreak}
+% \DoNotIndex{\NeedsTeXFormat,\newcommand,\newcount,\newdimen,\newif}
+% \DoNotIndex{\or}
+% \DoNotIndex{\p@,\PackageError,\PackageWarning,\PackageInfo}
+% \DoNotIndex{\PassOptionToPackage,\ProcessOptions,\ProvidesPackage,\put}
+% \DoNotIndex{\quad}
+% \DoNotIndex{\real,\relax,\renewcommand,\repeat,\RequirePackage}
+% \DoNotIndex{\setlength,\settoheight,\scriptsize,\space,\strut}
+% \DoNotIndex{\the,\textsf,\times,\typeout}
+% \DoNotIndex{\unitlength}
+% \DoNotIndex{\xdef,\z@}
+%
+% ^^A\changes{0.3}{2004/01/20}{initial release}
+%
+% ^^A \MakeShortVerb{\+}
+% ^^A \DeleteShortVerb{\|}
+%
+% \makeatletter
+% \let\PrintDescribeOpt\PrintDescribeEnv
+% \def\DescribeOpt{\leavevmode\@bsphack\begingroup\MakePrivateLetters
+% \Describe@Opt}
+% \def\Describe@Opt#1{\endgroup
+% \marginpar{\raggedleft\PrintDescribeOpt{#1}}%
+% \SpecialOptIndex{#1}\@esphack\ignorespaces}
+% \def\SpecialOptIndex#1{\@bsphack
+% \index{#1\actualchar{\protect\ttfamily#1}
+% (option)\encapchar usage}%
+% \index{options:\levelchar{\protect\ttfamily#1}\encapchar
+% usage}\@esphack}
+% \makeatother
+%
+% \newcommand*{\bs}{\char '134 }
+% \newcommand*{\lb}{\char '173 }
+% \newcommand*{\rb}{\char '175 }
+% \newcommand*{\param}[1]{\texttt{\textit{#1}}}
+% \newcommand*{\lp}{\textsf{logpap}}
+% \newcommand*{\newmac}{\vspace{2ex}\noindent}
+%
+% \title{The \lp\ Package\\Logarithmic Graph Paper with \LaTeX}
+% \author{Mike Kaufmann\\|Mike.Kaufmann@ei.fh-giessen.de|}
+% \date{\filedate (v\fileversion)}
+% ^^A--------------------------------------------------------------------------
+% \maketitle
+% \begin{abstract}
+% The \lp\ package provides four macros for drawing logarithmic-logarithmic,
+% logarithmic-linear, linear-logarithmic and (because it was easy to implement)
+% linear-linear graph paper with \LaTeX.
+% \end{abstract}
+%
+% \tableofcontents
+%
+% ^^A--------------------------------------------------------------------------
+% \section{Introduction}
+% \subsection{Why this Package}
+% Well, at least here in Germany logarithmic graph paper is expensive. And you
+% might not get graph paper with the number of decades you just need. With the
+% \lp\ package you can make your own graph paper now. And you can get your
+% graph paper even when shops are closed.\footnote{The first parts of this
+% package were made a weekend before I needed logarithmic graph paper for an
+% experiment report, because the experiment took place on Monday morning.}
+%
+% ^^A---------------------------------------------
+% \subsection{Packages used by the \lp\ Package}
+% The \lp\ package uses the following two packages
+% \begin{description}
+% \item[calc] used for some divisions by a real number
+% \item[color] used for drawing the graph paper in color
+% \end{description}
+%
+% ^^A---------------------------------------------
+% \subsection{Legal Stuff}
+% This program is provided under the terms of the
+% \LaTeX\ Project Public License distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt.
+%
+% ^^A--------------------------------------------------------------------------
+% \section{Overview}\label{sec:ov}
+% Altough the \lp\ package only draws logarithmic graph paper, there are
+% various things that can be changed. Figure \ref{fig:ov} will give an
+% overwiev. Here the first graph paper part where made with the default
+% settings and the command
+% |\put(0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}|.
+% On the right side you can find the commands used to change the appearance.
+%
+% Not all commands possible are shown here. Every option can be used with
+% |\LPSet{|\param{option1}|,|\param{option2}|,...}| within the document,
+% every \param{option} has a counterpart |no|\param{option} and for every
+% \param{option}|x| also an \param{option}|y| exists. Also commands to set
+% the three line widths, colors and the appearance of the $\mu$ are not shown.
+%
+% \begin{figure}[ht]
+% \centering
+% \begin{picture}(140,120)
+% \put( 0,105){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
+% \put(85,110){\makebox(0,0)[cl]{with default settings}}
+%
+% \LPSet{nodimensions,noticksupright,tenlower}
+% \put( 0, 80){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
+% \put(85, 89){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
+% \put(85, 85){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
+% \put(85, 81){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
+% \LPSet{dimensions,ticksupright,notenlower}
+%
+% \LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
+% \put( 0, 55){\loglinpap(80mm,10mm)(1,1){1}{0}}
+% \put(85, 64){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
+% \put(85, 60){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
+% \put(85, 56){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
+% \LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}
+%
+% \DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
+% \put( 0, 30){\loglinpap(80mm,10mm)(1,1){1}{0}}
+% \put(85, 41){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
+% \put(85, 37){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
+% \put(85, 33){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
+% \put(85, 29){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
+% \DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}
+%
+% \DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
+% \put( 0, 5){\loglinpap(80mm,10mm)(1,1){1}{0}}
+% \put(85, 14){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
+% \put(85, 10){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
+% \put(85, 6){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
+% \DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
+% \end{picture}
+% \caption{Overview}\label{fig:ov}
+% \end{figure}
+%
+% ^^A--------------------------------------------------------------------------
+% \newpage
+% \section{Using the Package}
+% \subsection{Drawing Logarithmic Graph Paper}\label{sec:dlgp}
+% \DescribeMacro\loglogpap
+% \DescribeMacro\loglinpap
+% \DescribeMacro\linlogpap
+% \DescribeMacro\linlinpap
+% There are four commands for drwaing graph paper. They can be used as a
+% single paragraph, in a \LaTeX\ \texttt{picture} environment or in a
+% \LaTeX\ \texttt{figure} environment. But due to the fact that the ticks,
+% the labeling, the text and the X- and Y-axis names are drawn outside of the
+% given area (see first parameter), it would be the best to use them within
+% a \texttt{picture} environment.
+% \begin{description}
+% \item[\texttt{\bs loglogpap}] draws double logarithmic graph paper
+% \item[\texttt{\bs loglinpap}] draws logarithmic-linear graph paper
+% (logarithmic X-axis)
+% \item[\texttt{\bs linlogpap}] draws linear-logarithmic graph paper
+% (logarithmic Y-axis)
+% \item[\texttt{\bs linlinpap}] draws double linear graph paper
+% \end{description}
+% These macros all have six parameters:
+% \begin{description}
+% \item[\texttt{(\emph{x-length},\emph{y-length})}]
+% are the dimensions of the graph paper in x- and y-direction. You can
+% use everything accepted as a length by \TeX, such as a number followed
+% by a unit accepted by \TeX\ (200mm, 500pt, \ldots) or a length register
+% like |\textheight| or |\textwidth|.
+% \item[\texttt{(\emph{x-decades/divisions},\emph{y-decades/divisions})}]
+% specifys the number decades for a logarithmic axis or the number of
+% divisions for a linear axis. You can use real numbers, but only the
+% first digit after the decimal point is used. For logarithmic axis a
+% value like 2.3 means that you will get two full decades (from 1 to 10)
+% and a partial decade from 1 to 3.
+%
+% For logarithmic axis the minimum is 0.2 and values like $x.1$ are
+% not alowed. For linear axis the minimum is 0.1. You'll get an
+% appropriate error message if you type wrong values.
+% \item[\texttt{\lb\emph{x-start},\emph{factor/increment}\rb}]
+% specifys the start value and a factor or increment for the x-axis
+% labeling.
+%
+% The general format for \param{x-start} is: an optional ``$+$'' or
+% ``$-$'', followed by 1 to 3 digits, optionally followed by one of the
+% letters y, z, a, f, p, n, u, m, k, M, G, T, P, E, Z or Y. The letters
+% are for the exponents $10^{-24}$, $10^{-21}$, \ldots, $10^{21}$ and
+% $10^{24}$.
+%
+% The \param{factor/increment} part is optional, it must be an integer
+% number. The default value is 1. For a logarithmic axis it is used as
+% factor, for a linear one as increment.
+%
+% For logarithmic axis you can use 1, $-1$, 10, $-10$, 100 or $-100$
+% optionally followed by one of the exponent letters as start value
+% (\param{x-start}) and values from 2 to 9 as factor
+% (\param{factor/increment}). The exponent letter is included in
+% calculating the next value for a full decade. If the value is
+% 1000 $\cdot$ \param{factor} it will be set to 1 $\cdot$ \param{factor}
+% and the next letter in order is appended (see first Example). Examples:
+% \begin{description}
+% \item[\texttt{\lb 10m,2\rb}] leads to ``20m'', ``200m'', ``2'',
+% ``20'', ``200'', ``2k'' and so on for the full decade and
+% ``4'', ``6'', \ldots\ ``18'' between them.
+% \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-1$k''
+% \ldots\ and ``$-2$'', ``$-3$'', \ldots\ ``$-9$'' between them.
+% \end{description}
+%
+% For linear axis you can use a positive or negative integer number
+% optionally followed by one of the exponent letters as start value
+% (\param{x-start}) and a positive or negative one as increment
+% (\param{factor/increment}). The start value range is from $-999$ to
+% 999\footnote{This restriction is caused by the parsing algorithem
+% used, which can only handle three digits in this version.}, for the
+% increment only 0 is not allowed. The exponent letter is not used when
+% calculating the next value, it is only appended to all values (see
+% first Example) and never changed (see third Example). Examples:
+% \begin{description}
+% \item[\texttt{\lb 10m,2\rb}] leads to ``10m'', ``12m'', ``14m'',
+% ``16m'', ``18m'' and so on.
+% \item[\texttt{\lb -100\rb}] leads to ``$-100$'', ``$-99$'' \ldots.
+% \item[\texttt{\lb 100,100\rb}] leads to ``100'', ``200'' \ldots
+% ``900'', ``1000''.
+% \end{description}
+%
+% If the format or the values are not correct, you'll get anappropriate
+% error message.
+% \item[\texttt{\lb\emph{y-start},\emph{factor/increment}\rb}]
+% specifys the start value and a factor or increment for the y-axis
+% labeling on the same way as for the x-axis.
+% \item[\texttt{[\emph{x-axis name}]}]
+% specifys a name for the x-axis, it can be an mathematical expression.
+% The name is set behind the right end and under the x-axis.
+% The parameter is optional.
+% \item[\texttt{[\emph{y-axis name}]}]
+% specifys a name for the y-axis, it can be an mathematical expression.
+% The name is set over the upper end and left from the y-axis.
+% The parameter is optional. If you want to have an y-axis name but no
+% x-axis name you must specify an empty x-axis name with \texttt{[]}.
+% \end{description}
+%
+% ^^A---------------------------------------------
+% \subsection{Package Options and Settings}\label{sec:opt}
+% The package has eight option pairs. This means that every option
+% \texttt{\emph{option}} has an counterpart \texttt{no\emph{option}}. The first
+% switches on something the second switches off the same thing.
+% The options are:
+% \begin{description}
+% \item[\texttt{[no]ticksupright}]
+% \DescribeOpt{ticksupright}
+% \DescribeOpt{noticksupright}
+% the drawing of ticks on the upper and the right side of the
+% graph paper will be switched on or off. Default is on.
+% \item[\texttt{[no]twoninex}]
+% \DescribeOpt{twoninex}
+% \DescribeOpt{notwoninex}
+% applies only to logarithmic x-axis. The axis labeling for the values
+% for 2 to 9 within a decade will be switched on or off.
+% Default is on.
+% \item[\texttt{[no]twoniney}]
+% \DescribeOpt{twoniney}
+% \DescribeOpt{notwoniney}
+% applies only to logarithmic y-axis. The axis labeling for the values
+% for 2 to 9 within a decade will be switched on or off.
+% Default is on.
+% \item[\texttt{[no]fsnx}]
+% \DescribeOpt{fsnx}
+% \DescribeOpt{nofsnx}
+% applies only to logarithmic x-axis. The axis labeling for the values
+% for 5, 7 and 9 within a decade will be switched on or off. Note that
+% if \texttt{notwoninex} is set, the values for 5, 7 and 9 will never
+% appear. Default is on.
+% \item[\texttt{[no]fsny}]
+% \DescribeOpt{fsny}
+% \DescribeOpt{nofsny}
+% applies only to logarithmic y-axis. The axis labeling for the values
+% for 5, 7 and 9 within a decade will be switched on or off. Note that
+% if \texttt{notwoniney} is set, the values for 5, 7 and 9 will never
+% appear. Default is on.
+% \item[\texttt{[no]tenlower}]
+% \DescribeOpt{tenlower}
+% \DescribeOpt{notenlower}
+% applies only to logarithmic x-axis.The axis labeling for the values for
+% 10 (at a decades border) will be set lower if on. Default is off.
+% \item[\texttt{[no]text}]
+% \DescribeOpt{text}
+% \DescribeOpt{notext}
+% the text ``made with \LaTeX\ and \lp'' will be set left over the
+% graph paper if on. Default is on. The text can be changed.
+% \item[\texttt{[no]dimensions}]
+% \DescribeOpt{dimensions}
+% \DescribeOpt{nodimensions}
+% the dimensions of the graph paper in decades and/or divisions will be
+% shown (after the text ``made with \LaTeX\ and \lp'') if on. Default
+% is on.
+% \end{description}
+% Options unknown by the \lp\ package will be passed to the color package. So
+% you can use all options of the color package too. But note: global option
+% (options passed to the document class) are not passed to the package.
+%
+% \newmac
+% \DescribeMacro\LPSet
+% Everything set with package options can allso be set with the |\LPSet|
+% command. So you can have more then one graph paper with different settings
+% in one document. It takes a comma seperated list of option as parameter.
+% Example:
+% \begin{verbatim}
+% \LPSet{noticksupright,notext,nodimensions}\end{verbatim}
+% ^^A\end{verbatim}
+% Unknown options passed to |\LPSet| are silently ignored.
+%
+% The new settings are then valid from the point you called the command until
+% the end of the current environment or, if not inside of an environment, until
+% the end of the document.
+%
+% ^^A---------------------------------------------
+% \subsection{Setup Commands}
+% The command for changing settings done by package options were allready
+% described in subsection \ref{sec:opt}. Here the rest of the setup commands
+% are following. These settings are also valid from the point you called a
+% command until the end of the current environment or, if not inside of an
+% environment, until the end of the document.
+%
+% \newmac
+% \DescribeMacro\DefineLPThickLineThickness
+% \DescribeMacro\DefineLPMedLineThickness
+% \DescribeMacro\DefineLPThinLineThickness
+% As seen in section \ref{sec:ov} there are three different line widths used.
+% They can be set with the commands
+%
+% \vspace{1ex}\noindent{\small
+% \texttt{\bs DefineLPThickLineThickness\lb\emph{thickness}\rb}\\
+% \texttt{\bs DefineLPMedLineThickness\lb\emph{thickness}\rb}\\
+% \texttt{\bs DefineLPThinLineThickness\lb\emph{thickness}\rb}}
+%
+% \vspace{1ex}\noindent
+% where \texttt{\emph{thickness}} can be everything accepted as a length by
+% \TeX. The default values are 0.8\,pt for thick lines, 0.5\,pt for medium
+% lines and 0.2\,pt for thin lines.
+%
+% Setting these values is a little bit critical, because they depend on the
+% printer resolution.
+%
+% If you set the thin line thickness to the minimum line thickness your printer
+% can draw, it is possible that your printer draws some thin lines with double
+% thickness. With a medium line thickness of twice the thin line thickness then
+% you might not be able to distinguish between thin and medium lines.
+%
+% With a thin line thickness value of 1.6 times the minimum line thickness of
+% your printer this (hopefully) will not happen, but it might be only once
+% this minimum. The medium line thickness then should be at least twice the
+% thin line thickness and the thick line thickness more than three times the
+% thin line thickness and more than 1.5 times the medium line thickness. Here
+% the fact that a printer pixel is larger than guessed due to the resolution
+% and some printers are capable of subpixel printing (printing some smaller
+% pixels) where not taken into account. The default values should fit for a
+% 600\,dpi printer, but anyway it would be a good idea to test them with your
+% printer.
+%
+% This problem was the reason for supporting a configuration file (see
+% subsection \ref{sec:conf}). There you can put these values for your printer
+% and so there is no need to put them in every document. And if you give your
+% source to anyone else he will automaticly use his own configuration file if
+% he has one.
+%
+% \newmac
+% \DescribeMacro\DefineLPMinLineDist
+% With \texttt{\bs DefineLPMinLineDist\lb\emph{minimum-line-distance}\rb} you
+% can set the minimum distance between the lines drawn. Note that due to
+% rounding error it might be necessary to give a value a little bit lesser
+% then the value you want. So the default value is not 1\,mm but 0.9999\,mm.
+%
+% Another thing to keep in mind is that the thick lines will allways be drawn.
+% If they are to close together you will get a warning message, and an ugly
+% result of course.
+%
+% \newmac
+% \DescribeMacro\DefineLPThickTickLen
+% With \texttt{\bs DefineLPThickTickLen\lb\emph{thick-tick-length}\rb} you can
+% set the length of the ticks for thick lines, the default value is 2\,mm.
+%
+% \newmac
+% \DescribeMacro\DefineLPMedTickLen
+% And with \texttt{\bs DefineLPMedTickLen\lb\emph{medium-tick-length}\rb} you
+% can set the length of the ticks for medium lines, the default value is 1\,mm.
+%
+% Note: there is no |\DefineLPThinTickLen| command, because thin lines will
+% never have ticks.
+%
+% \newmac
+% \DescribeMacro\DefineLPLabelDist
+% The command \texttt{\bs DefineLPLabelDist\lb\emph{label-distance}\rb}
+% sets the distance between the axis labeling and the ticks, the default
+% value is 1\,mm. The label distance for a full decades label with option
+% \texttt{tenlower} is calculated so that the label is set one
+% \texttt{\emph{label-distance}} under the normal labels. The value of
+% \texttt{\emph{label-distance}} is also used as distance between the text
+% above the graph paper and the ticks and the axis names and the ticks.
+%
+% \newmac
+% \DescribeMacro\DefineLPLabelFont
+% And the command \texttt{\bs DefineLPLabelFont\lb\emph{label-font}\rb}
+% sets the font used for axis labeling and the text above the graph paper.
+% Here you can use all font size commands and commands like |\sffamily|,
+% |\bfseries| and |\itshape| for the font you want. Note: the |\text..|
+% commands are not possible here. The default is |\scriptsize|.
+%
+% \newmac
+% \DescribeMacro\DefineLPLineColor
+% \DescribeMacro\DefineLPLabelColor
+% The two commands \texttt{\bs DefineLPLineColor\lb...\rb} and
+% \texttt{\bs DefineLPLabelColor\lb...\rb} sets the colors for
+% lines and labeling. Here you have to use a complete |\color|
+% command\footnote{Please refer to \texttt{grfguide} for the description
+% of the \texttt{\bs color} command.} (with the advantage to have all
+% capabilities of it). The defaults are |\color[cmyk]{1,0,0,0}| (cyan) for
+% line color and |\color[cmyk]{0,0,0,1}| (black) for labeling color.
+%
+% There are three reasons for the line color default:
+% \begin{enumerate}
+% \item The printer colors are (normaly) cyan, magenta, yellow and black, so
+% the |cmyk| color model where chosen.
+% \item Only one of these printer colors where chosen, so there is no
+% need of rastering (which might be worse for thin lines).
+% \item The color cyan where chosen, because with black you wouldn't see your
+% (handdrawn) graph, with yellow the lines are to bright and magenta
+% lines are (in my opinion) to heavy.
+% \end{enumerate}
+%
+% \newmac
+% \DescribeMacro\DefineLPmu
+% On the axis labeling there might be a letter appended for ``micro''
+% ($10^{-6}$). Due to the fact that not all fonts provide a upright
+% text-$\mu$, the default is just the letter ``u''. But with
+% \texttt{\bs DefineLPmu\lb\emph{mu}\rb} you can redefine it to the
+% letter you want (e.g.\ |$\mu$| or |\textmu| if provided).
+%
+% \newmac
+% \DescribeMacro\DefineLPText
+% With \texttt{\bs DefineLPText\lb\emph{new-text}\rb} you can change the text
+% displayed above the graph paper. It only changes the first part, not the
+% second where the dimensions are shown. The distance between the two text
+% parts has to be a part of the new text. The default text is
+% ``made with \LaTeX\ and \lp'' followed by a |\quad|.
+%
+% ^^A---------------------------------------------
+% \subsection{Length of Decades/Divisions}
+% \DescribeMacro\lpgridx
+% \DescribeMacro\lpgridy
+% After drawing the graph paper the length of a single decade or division on
+% the x-axis can be found in |\lpgridx|. And the length of a decade or division
+% on the y-axis can be found in |\lpgridy|. This might be usefull to put
+% something into or around the graph paper, but unfortunately it won't be easy
+% to do such a thing.
+%
+% ^^A---------------------------------------------
+% \subsection{Configuration File}\label{sec:conf}
+% At the end of the \lp\ package a config file with the name
+% \texttt{logpap.cfg} is loaded. It has to be somewhere where \TeX\ can find
+% it. An appropriate place should be the folder
+% \texttt{.../texmf/tex/latex/config/}.
+%
+% Allthough you can make any kind of settings in this file, it is strictly
+% recommended to use it only for setting the line widths. There should also
+% be a |\ProvidesFile| command as first line. Here an example
+% configuration file:
+%
+% \begin{verbatim}
+% \ProvidesFile{logpap.cfg}[2004/02/01 v0.6 configuration for a 600dpi printer]
+% \DefineLPThickLineThickness{0.8pt}
+% \DefineLPMedLineThickness{0.5pt}
+% \DefineLPThinLineThickness{0.2pt}\end{verbatim}
+% ^^A\end{verbatim}
+%
+% ^^A---------------------------------------------
+% \subsection{Warnings and Errors}
+% There are two warning messages and six error messages, which can occur.
+% Both warning messages can occur several times for one graph paper. And if
+% you ignore an error message (by not correcting the error), you might get
+% more error messages. For all error messages there is an appropriate help
+% text, just type |h| at the |?|-prompt to see it.
+%
+% \newmac
+% The first warning message is
+% \begin{verbatim}
+% Package logpap Warning: lines are to close together
+% (logpap) on input line ...\end{verbatim}
+% ^^A\end{verbatim}
+% Because thick lines are always drawn, it can happen that they are closer
+% than the minimum line distance.
+%
+% \newmac
+% The second warning message is
+% \begin{verbatim}
+% Package logpap Warning: log. axis value went to large
+% (logpap) (no more letters for exponent, used X)
+% (logpap) on input line ...\end{verbatim}
+% ^^A\end{verbatim}
+% If the value for a full decade of a logarithmic axis is $10^{27}$ or larger,
+% there are no more letters for the exponent. The package then uses an X.
+%
+% \newmac
+% The first error message is
+% \begin{verbatim}
+% ! Package logpap Error: number of decades for logaritmic axis to small.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the number of decades is less then 0.2.
+%
+% \newmac
+% The second error message is
+% \begin{verbatim}
+% ! Package logpap Error: wrong number of decades for logaritmic axis.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the number of decades is something like $x.1$, which doesn't
+% make sense.
+%
+% \newmac
+% The third error message is
+% \begin{verbatim}
+% ! Package logpap Error: number of divisions for linear axis to small.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the number of divisins is less then 0.1.
+%
+% \newmac
+% The fourth error message is
+% \begin{verbatim}
+% ! Package logpap Error: wrong format of start value.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the format of start value for logarithmic or linear axis is
+% not correct. The format is: an optional $+$ or $-$, followed by 1-3 digits,
+% optionaly followed by one of the letters ``yzafpnumkMGTPEZY''.
+%
+% \newmac
+% The fifth error message is
+% \begin{verbatim}
+% ! Package logpap Error: wrong increment for linear axis.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs only, when the increment for a linear axis is 0, which doesn't make
+% any sense.
+%
+% \newmac
+% The sixth error message is
+% \begin{verbatim}
+% ! Package logpap Error: wrong logarithmic start value.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the start value for a logarithmic axis is not $-100$,
+% $-10$, $-1$, 1, 10 or 100.
+%
+% \newmac
+% The seventh error message is
+% \begin{verbatim}
+% ! Package logpap Error: wrong factor for logarithmic axis.\end{verbatim}
+% ^^A\end{verbatim}
+% It occurs, when the factor for a logarithmic axis is not in the range from
+% 1 to 9.
+%
+% ^^A--------------------------------------------------------------------------
+% \StopEventually{\newpage\PrintIndex \PrintChanges}
+%
+% ^^A--------------------------------------------------------------------------
+% \newpage
+% \section{The Code}
+% \subsection{The Usual}
+% First the usual things.
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[2001/06/01]
+\ProvidesPackage{logpap}[\filedate\space
+ v\fileversion\space drawing logarithmic graph paper]
+% \end{macrocode}
+%
+% ^^A---------------------------------------------
+% \subsection{The Options and Settings}
+% Bevor declaring the options and settings, the booleans used by them are
+% defined.
+%
+% \begin{macro}{\iflp@ticksupright}
+% \begin{macro}{\lp@ticksuprighttrue}
+% \begin{macro}{\lp@ticksuprightfalse}
+% If the boolean |\iflp@ticksupright| is true ticks at the upper and the right
+% side of the graph paper will be drawn.
+% \begin{macrocode}
+\newif\iflp@ticksupright
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@text}
+% \begin{macro}{\lp@texttrue}
+% \begin{macro}{\lp@textfalse}
+% If the boolean |\iflp@text| is true the text (not the dimensions) above the
+% graph paper is shown.
+% \begin{macrocode}
+\newif\iflp@text
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@dimensions}
+% \begin{macro}{\lp@dimensionstrue}
+% \begin{macro}{\lp@dimensionsfalse}
+% If the boolean |\iflp@dimensions| is true the dimensions (not the text) above
+% the graph paper is shown.
+% \begin{macrocode}
+\newif\iflp@dimensions
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@twoninex}
+% \begin{macro}{\lp@twoninextrue}
+% \begin{macro}{\lp@twoninexfalse}
+% If the boolean |\iflp@twoninex| is false the labels for 2 to 9 within a
+% decade of the x-axis will not appear.
+% \begin{macrocode}
+\newif\iflp@twoninex
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@fsnx}
+% \begin{macro}{\lp@fsnxtrue}
+% \begin{macro}{\lp@fsnxfalse}
+% If the boolean |\iflp@fsnx| is false the labels for 5, 7 and 9 within a
+% decade of the x-axis will not appear.
+% \begin{macrocode}
+\newif\iflp@fsnx
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@twoniney}
+% \begin{macro}{\lp@twonineytrue}
+% \begin{macro}{\lp@twonineyfalse}
+% If the boolean |\iflp@twoniney| is false the labels for 2 to 9 within a
+% decade of the y-axis will not appear.
+% \begin{macrocode}
+\newif\iflp@twoniney
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@fsny}
+% \begin{macro}{\lp@fsnytrue}
+% \begin{macro}{\lp@fsnyfalse}
+% If the boolean |\iflp@fsny| is false the labels for 5, 7 and 9 within a
+% decade of the y-axis will not appear.
+% \begin{macrocode}
+\newif\iflp@fsny
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@tenlower}
+% \begin{macro}{\lp@tenlowertrue}
+% \begin{macro}{\lp@tenlowerfalse}
+% If the boolean |\iflp@tenlower| is true the labels for a full decade of
+% the x-axis will be set lower (under the other labels). The label for the
+% origin is not affected by |\iflp@tenlower|.
+% \begin{macrocode}
+\newif\iflp@tenlower
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@DeclareOS}
+% With |\lp@DeclareOS| an option and an internal setting command in the form
+% |\lp@@set|\param{option} is defined simultaneously.
+% \begin{macrocode}
+\newcommand*\lp@DeclareOS[2]{\DeclareOption{#1}{#2}
+ \expandafter\def\csname lp@@set#1\endcsname{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\LPSet}
+% The command |\LPSet| just passes the comma seperated list of option (|#1|)
+% to |\lp@set|.
+% \begin{macrocode}
+\newcommand*\LPSet[1]{\lp@set#1,\@@end}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@set}
+% In |\lp@set| the first option is executed, then it is called recursively
+% until the list is empty. Unknown options passed to |\LPSet| are silently
+% ignored.
+% \begin{macrocode}
+\def\lp@set#1,#2\@@end{\csname lp@@set#1\endcsname
+ \def\@tempa{#2}\ifx\@tempa\@empty\else\lp@set#2\@@end\fi}
+% \end{macrocode}
+% \end{macro}
+% Now all options and internal setting commands are declared.
+% \begin{macrocode}
+\lp@DeclareOS{ticksupright}{\lp@ticksuprighttrue}
+\lp@DeclareOS{noticksupright}{\lp@ticksuprightfalse}
+\lp@DeclareOS{twoninex}{\lp@twoninextrue}
+\lp@DeclareOS{notwoninex}{\lp@twoninexfalse}
+\lp@DeclareOS{twoniney}{\lp@twonineytrue}
+\lp@DeclareOS{notwoniney}{\lp@twonineyfalse}
+\lp@DeclareOS{fsnx}{\lp@fsnxtrue}
+\lp@DeclareOS{nofsnx}{\lp@fsnxfalse}
+\lp@DeclareOS{fsny}{\lp@fsnytrue}
+\lp@DeclareOS{nofsny}{\lp@fsnyfalse}
+\lp@DeclareOS{tenlower}{\lp@tenlowertrue}
+\lp@DeclareOS{notenlower}{\lp@tenlowerfalse}
+\lp@DeclareOS{text}{\lp@texttrue}
+\lp@DeclareOS{notext}{\lp@textfalse}
+\lp@DeclareOS{dimensions}{\lp@dimensionstrue}
+\lp@DeclareOS{nodimensions}{\lp@dimensionsfalse}
+% \end{macrocode}
+% Options unknown to the \lp\ package are passed to the color package.
+% \begin{macrocode}
+\DeclareOption*{\PassOptionToPackage{\CurrentOption}{color}}
+% \end{macrocode}
+% The booleans defaults are set and the options are processed.
+% \begin{macrocode}
+\ExecuteOptions{ticksupright,twoninex,twoniney,fsnx,fsny,notenlower,text,dimensions}
+\ProcessOptions\relax
+% \end{macrocode}
+% The calc package is needed to calculate the length of a divison or decade.
+% The color package is used to get colored lines for the graph paper.
+% These packages are loaded here.
+% \begin{macrocode}
+\RequirePackage{calc}
+\RequirePackage{color}
+% \end{macrocode}
+%
+% ^^A---------------------------------------------
+% \subsection{The logarithmic Values}
+% Because it wouldn't be easy to calculate a logarithem with \TeX\footnote{And
+% because I'm no mathematician, which means I don't know how to calculate a
+% logarithem numerical.} the logarithmic value for $x.y$ is stored in a macro
+% |\lp@log|\param{x.y}
+%
+% \begin{macro}{\deflp@logline}
+% Such a value is defined with
+% |\deflp@logline{|\param{value}|}{|\param{logarithem-of-value}|}|.
+% \begin{macrocode}
+\newcommand*{\deflp@logline}[2]{\expandafter\def\csname lp@log#1\endcsname{#2}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\getlp@logline}
+% With |\getlp@logline{|\param{value}|}| the logarithem of the value can be
+% requested (if defined before).
+% \begin{macrocode}
+\newcommand*{\getlp@logline}[1]{\csname lp@log#1\endcsname}
+% \end{macrocode}
+% \end{macro}
+% Now the logarithems of 1.0 to 10.0 in steps of 0.1 are defined.
+% \begin{macrocode}
+\deflp@logline{1.0}{0}
+\deflp@logline{1.1}{.041393}
+\deflp@logline{1.2}{.078181}
+\deflp@logline{1.3}{.113943}
+\deflp@logline{1.4}{.146128}
+\deflp@logline{1.5}{.176091}
+\deflp@logline{1.6}{.20412}
+\deflp@logline{1.7}{.230449}
+\deflp@logline{1.8}{.255273}
+\deflp@logline{1.9}{.278754}
+\deflp@logline{2.0}{.30103}
+\deflp@logline{2.1}{.322219}
+\deflp@logline{2.2}{.342423}
+\deflp@logline{2.3}{.361728}
+\deflp@logline{2.4}{.380211}
+\deflp@logline{2.5}{.39794}
+\deflp@logline{2.6}{.414973}
+\deflp@logline{2.7}{.431364}
+\deflp@logline{2.8}{.447158}
+\deflp@logline{2.9}{.462398}
+\deflp@logline{3.0}{.477121}
+\deflp@logline{3.1}{.491362}
+\deflp@logline{3.2}{.50515}
+\deflp@logline{3.3}{.518514}
+\deflp@logline{3.4}{.531479}
+\deflp@logline{3.5}{.544068}
+\deflp@logline{3.6}{.556303}
+\deflp@logline{3.7}{.568202}
+\deflp@logline{3.8}{.579784}
+\deflp@logline{3.9}{.591065}
+\deflp@logline{4.0}{.60206}
+\deflp@logline{4.1}{.612784}
+\deflp@logline{4.2}{.623249}
+\deflp@logline{4.3}{.633468}
+\deflp@logline{4.4}{.643453}
+\deflp@logline{4.5}{.653213}
+\deflp@logline{4.6}{.662758}
+\deflp@logline{4.7}{.672098}
+\deflp@logline{4.8}{.681241}
+\deflp@logline{4.9}{.690196}
+\deflp@logline{5.0}{.69897}
+\deflp@logline{5.1}{.70757}
+\deflp@logline{5.2}{.716003}
+\deflp@logline{5.3}{.724276}
+\deflp@logline{5.4}{.732394}
+\deflp@logline{5.5}{.740363}
+\deflp@logline{5.6}{.748188}
+\deflp@logline{5.7}{.755875}
+\deflp@logline{5.8}{.763428}
+\deflp@logline{5.9}{.770852}
+\deflp@logline{6.0}{.778151}
+\deflp@logline{6.1}{.78533}
+\deflp@logline{6.2}{.792392}
+\deflp@logline{6.3}{.799341}
+\deflp@logline{6.4}{.80618}
+\deflp@logline{6.5}{.812913}
+\deflp@logline{6.6}{.819544}
+\deflp@logline{6.7}{.826075}
+\deflp@logline{6.8}{.832509}
+\deflp@logline{6.9}{.838849}
+\deflp@logline{7.0}{.845098}
+\deflp@logline{7.1}{.851258}
+\deflp@logline{7.2}{.857332}
+\deflp@logline{7.3}{.863323}
+\deflp@logline{7.4}{.869232}
+\deflp@logline{7.5}{.875061}
+\deflp@logline{7.6}{.880814}
+\deflp@logline{7.7}{.886491}
+\deflp@logline{7.8}{.892095}
+\deflp@logline{7.9}{.897627}
+\deflp@logline{8.0}{.90309}
+\deflp@logline{8.1}{.908485}
+\deflp@logline{8.2}{.913814}
+\deflp@logline{8.3}{.919078}
+\deflp@logline{8.4}{.924279}
+\deflp@logline{8.5}{.929419}
+\deflp@logline{8.6}{.934498}
+\deflp@logline{8.7}{.939519}
+\deflp@logline{8.8}{.944483}
+\deflp@logline{8.9}{.94939}
+\deflp@logline{9.0}{.954243}
+\deflp@logline{9.1}{.959041}
+\deflp@logline{9.2}{.963788}
+\deflp@logline{9.3}{.968483}
+\deflp@logline{9.4}{.973128}
+\deflp@logline{9.5}{.977724}
+\deflp@logline{9.6}{.982271}
+\deflp@logline{9.7}{.986772}
+\deflp@logline{9.8}{.991226}
+\deflp@logline{9.9}{.995635}
+\deflp@logline{10.0}{1}
+% \end{macrocode}
+% I thought about making an extra package for the logarithmic values. Perhaps
+% it might be usefull for other packages. But, because I'm not able to write
+% a macro that calculates the logarithem, I decided not doing this.
+%
+% ^^A---------------------------------------------
+% \subsection{Registers and other Booleans needed}
+% \begin{macro}{\lp@dcntx}
+% In the counter |\lp@dcntx| the number of full decades or divisions of the
+% x-axis is stored and counted down when drawing lines.
+% \begin{macrocode}
+\newcount\lp@dcntx
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@dcnty}
+% In the counter |\lp@dcnty| the number of full decades or divisions of the
+% y-axis is stored and counted down when drawing lines.
+% \begin{macrocode}
+\newcount\lp@dcnty
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lpgridx}
+% The dimen |\lpgridx| holds the length of a full decade or division for the
+% x-axis.
+% \begin{macrocode}
+\newdimen\lpgridx
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lpgridy}
+% The dimen |\lpgridy| holds the length of a full decade or division for the
+% y-axis.
+% \begin{macrocode}
+\newdimen\lpgridy
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@thicklinelenx}
+% In the dimen |\lp@thicklinelenx| the length of a horizontal thick line is
+% calculated and stored.
+% \begin{macrocode}
+\newdimen\lp@thicklinelenx
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@thicklineleny}
+% In the dimen |\lp@thicklineleny| the length of a vertical thick line is
+% calculated and stored.
+% \begin{macrocode}
+\newdimen\lp@thicklineleny
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@medlinelenx}
+% In the dimen |\lp@medlinelenx| the length of a horizontal medium line is
+% calculated and stored.
+% \begin{macrocode}
+\newdimen\lp@medlinelenx
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@medlineleny}
+% In the dimen |\lp@medlineleny| the length of a vertical medium line is
+% calculated and stored.
+% \begin{macrocode}
+\newdimen\lp@medlineleny
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@osg}
+% The dimen |\lp@osg| is used while drawing lines. Here the offset from the
+% origin of the graph paper to the begin of the actual decade or division is
+% calculated and stored.
+% \begin{macrocode}
+\newdimen\lp@osg
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@osl}
+% The dimen |\lp@osl| is used while drawing lines. Here first the offset from
+% the beginning of the actual decade or division to the actual line is
+% calculated. And then |\lp@osg| is added to it to get the offset from the
+% origin of the graph paper to the actual line.
+% \begin{macrocode}
+\newdimen\lp@osl
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\iflp@partdecx}
+% \begin{macro}{\lp@partdecxtrue}
+% \begin{macro}{\lp@partdecxfalse}
+% The boolean |\iflp@partdecx| will be set if the last decade or division on
+% the x-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
+% of decades or divisions).
+% \begin{macrocode}
+\newif\iflp@partdecx
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@partdecy}
+% \begin{macro}{\lp@partdecytrue}
+% \begin{macro}{\lp@partdecyfalse}
+% The boolean |\iflp@partdecy| will be set if the last decade or division on
+% the y-axis is only a partial one ($x.y$ and not $x$ or $x.0$ as the number
+% of decades or divisions).
+% \begin{macrocode}
+\newif\iflp@partdecy
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@fulldecx}
+% \begin{macro}{\lp@fulldecxtrue}
+% \begin{macro}{\lp@fulldecxfalse}
+% The boolean |\iflp@fulldecx| will be set if there is at least one full
+% decade or division for the x-axis ($x.y$ or $x$ and not $0.y$ as the number
+% of decades or divisions).
+% \begin{macrocode}
+\newif\iflp@fulldecx
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@fulldecy}
+% \begin{macro}{\lp@fulldecytrue}
+% \begin{macro}{\lp@fulldecyfalse}
+% The boolean |\iflp@fulldecy| will be set if there is at least one full
+% decade or division for the y-axis ($x.y$ or $x$ and not $0.y$ as the number
+% of decades or divisions).
+% \begin{macrocode}
+\newif\iflp@fulldecy
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@twonine}
+% \begin{macro}{\lp@twoninetrue}
+% \begin{macro}{\lp@twoninefalse}
+% Because the same macro is used to get the next label for a logarithmic
+% x- and y-axis, the boolean |\iflp@twonine| is needed. It is set to the
+% meaning of |\iflp@twoninex| or |\iflp@twoniney| before labeling is done.
+% \begin{macrocode}
+\newif\iflp@twonine
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@fsn}
+% \begin{macro}{\lp@fsntrue}
+% \begin{macro}{\lp@fsnfalse}
+% Because the same macro is used to get the next label for a logarithmic
+% x- and y-axis, the boolean |\iflp@fsn| is needed. It is set to the
+% meaning of |\iflp@fsnx| or |\iflp@fsny| before labeling is done.
+% \begin{macrocode}
+\newif\iflp@fsn
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@ten}
+% \begin{macro}{\lp@tentrue}
+% \begin{macro}{\lp@tenfalse}
+% The boolean |\iflp@ten| is needed to distinguish between the labels within
+% decade and the labels of a full decade, to be able to set only the last
+% lower.
+% \begin{macrocode}
+\newif\iflp@ten
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@logx}
+% \begin{macro}{\lp@logxtrue}
+% \begin{macro}{\lp@logxfalse}
+% The boolean |\iflp@logx| is true if the x-axis is logarithmic. It is needed
+% to setup things on different ways for logarithmic and linear axis.
+% \begin{macrocode}
+\newif\iflp@logx
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@logy}
+% \begin{macro}{\lp@logytrue}
+% \begin{macro}{\lp@logyfalse}
+% The boolean |\iflp@logy| is true if the y-axis is logarithmic. It is needed
+% to setup things on different ways for logarithmic and linear axis.
+% \begin{macrocode}
+\newif\iflp@logy
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\iflp@preached}
+% \begin{macro}{\lp@preachedtrue}
+% \begin{macro}{\lp@preachedfalse}
+% The boolean |\iflp@preached| is used while parsing the start value for axis
+% labeling. It will be true if the parsed character is one of the letters for
+% the exponent. It is also used to get the next exponent letter when labeling
+% is done. There it will be true if the start exponent letter (not the next
+% one) is reached.
+% \begin{macrocode}
+\newif\iflp@preached
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Setup Commands}
+% Everything set with the |\DefineLP...| commands is stored in a macro. For
+% the first seven this where done to save dimen registers. For the last five
+% it seems to be the natural way.
+%
+% \begin{macro}{\DefineLPThickLineThickness}
+% \begin{macro}{\lp@tkltkness}
+% With |\DefineLPThickLineThickness| the thick line width is stored in
+% |\lp@tkltkness|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPThickLineThickness[1]{\renewcommand*\lp@tkltkness{#1}}
+\newcommand*\lp@tkltkness{0.8\p@}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPMedLineThickness}
+% \begin{macro}{\lp@mdltkness}
+% With |\DefineLPMedLineThickness| the medium line width is stored in
+% |\lp@mdltkness|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPMedLineThickness[1]{\renewcommand*\lp@mdltkness{#1}}
+\newcommand*\lp@mdltkness{0.5\p@}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPThinLineThickness}
+% \begin{macro}{\lp@tnltkness}
+% With |\DefineLPThinLineThickness| the thin line width is stored in
+% |\lp@tnltkness|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPThinLineThickness[1]{\renewcommand*\lp@tnltkness{#1}}
+\newcommand*\lp@tnltkness{0.2\p@}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPMinLineDist}
+% \begin{macro}{\lp@mindist}
+% With |\DefineLPMinLineDist| the minimum distance between two lines drawn
+% is stored in |\lp@mindist|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPMinLineDist[1]{\renewcommand*\lp@mindist{#1}}
+\newcommand*\lp@mindist{0.9999mm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPThickTickLen}
+% \begin{macro}{\lp@tol}
+% With |\DefineLPThickTickLen| the tick length of thick lines
+% is stored in |\lp@tol|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPThickTickLen[1]{\renewcommand*\lp@tol{#1}}
+\newcommand*\lp@tol{2mm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPMedTickLen}
+% \begin{macro}{\lp@mol}
+% With |\DefineLPMedTickLen| the tick length of medium lines
+% is stored in |\lp@mol|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPMedTickLen[1]{\renewcommand*\lp@mol{#1}}
+\newcommand*\lp@mol{1mm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPLabelDist}
+% \begin{macro}{\lp@lpos}
+% With |\DefineLPLabelDist| the distance betweens ticks and labeling
+% is stored in |\lp@lpos|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPLabelDist[1]{\renewcommand*\lp@lpos{#1}}
+\newcommand*\lp@lpos{1mm}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPLabelFont}
+% \begin{macro}{\lp@font}
+% With |\DefineLPLabelFont| the commands needed to choose the font for the
+% labeling and the text above the graph paper are stored in |\lp@font|, which
+% is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPLabelFont[1]{\renewcommand*\lp@font{#1}}
+\newcommand*\lp@font{\scriptsize}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPLineColor}
+% \begin{macro}{\lp@linecolor}
+% With |\DefineLPLineColor| the command for setting the line color
+% is stored in |\lp@linecolor|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPLineColor[1]{\renewcommand*\lp@linecolor{#1}}
+\newcommand*\lp@linecolor{\color[cmyk]{1,0,0,0}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPLabelColor}
+% \begin{macro}{\lp@labelcolor}
+% With |\DefineLPLabelColor| the command for setting the labels color
+% is stored in |\lp@labelcolor|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPLabelColor[1]{\renewcommand*\lp@labelcolor{#1}}
+\newcommand*\lp@labelcolor{\color[cmyk]{0,0,0,1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPmu}
+% \begin{macro}{\lp@mu}
+% With |\DefineLPmu| the exponent letter for ``micro'' ($10^{-6}$) is stored in
+% |\lp@mu|, which is initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPmu[1]{\renewcommand*\lp@mu{#1}}
+\newcommand*\lp@mu{u}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\DefineLPText}
+% \begin{macro}{\lp@textone}
+% With |\DefineLPText| the first part of the text above the graph paper and
+% the distance to the second part is stored in |\lp@textone|, which is
+% initialized in the next line.
+% \begin{macrocode}
+\newcommand*\DefineLPText[1]{\renewcommand*\lp@textone{#1}}
+\newcommand*\lp@textone{made with \LaTeX\ and \textsf{logpap}\quad}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Making Lists}
+% Before describing the next commands, the mechanism how lines are drawn has
+% to be explained:
+%
+% First the length of a division or decade for an axis is calculated.
+% Then a comma separated list is built for every line width. Such a list
+% contains normalized\footnote{The Values are all in the range from 0 to 1.
+% To get the absolute value it has to be multiplied with the length of a
+% division or decade.} offsets from beginning of a decade or division to the
+% line to draw. The list for thick lines will always contain offsets for all
+% possible lines. The lists for medium and thin lines may contain all offsets
+% for a part from $x$ to $(x+1)$, the offsets for $x.2$, $x.4$, $x.6$ and $x.8$
+% (no medium line), only the offsets for the medium lines ($x.5$) or no offsets
+% at all.\footnote{Here $x$ is 0 for linear axis and 1 to 9 for logarithmic
+% axis.} Therefor the distances between $x.9$ to $(x+1).0$, $x.8$ to $(x+1).0$
+% and $x.5$ to $(x+1).0$ are calculated and compared to the given minimum line
+% distance. The distance between $x$ to $(x+1)$ is only calculated and
+% compared to get a warning message if necessary. At last every list is passed
+% to a macro, which works it up recursively. This is done once for every decade
+% or division (the lists contain the offsets for one decade or division only).
+%
+% For a partial division only the offsets for $0.1$ to $0.y$ are appended to
+% the list, where $y$ is the first digit after the decimal point of the
+% \texttt{\emph{decades/divisions}} argument to the linear axis.
+% For a partial decade only the offsets for $1.1$ to $x.0$ are appended to the
+% list, where $x$ is the first digit after the decimal point of the
+% \texttt{\emph{decades/divisions}} argument to the logarithmic axis.
+%
+% \begin{macro}{\lp@thicklines}
+% \begin{macro}{\lp@medlines}
+% \begin{macro}{\lp@thinlines}
+% In |\lp@thicklines|, |\lp@medlines| and |\lp@thinlines| the comma separated
+% lists of normalized offsets form a decades or divisions beginning to the line
+% to draw for thick, medium and thin lines are stored.
+%
+% \begin{macro}{\lp@lllist}
+% In |\lp@lllist| the values form 2 to (maximal) 10 for logarithmic axis
+% labeling are stored, but in the same order as the offsets for the thick
+% lines in |\lp@thicklines|, because latter is used for labeling too.
+%
+% \begin{macro}{\lp@clearlists}
+% With |\lp@clearlists| all theses lists are cleared.
+% \begin{macrocode}
+\def\lp@clearlists{%
+ \def\lp@thicklines{,}\def\lp@medlines{,}\def\lp@thinlines{,}%
+ \def\lp@lllist{,}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Making Lists for logarithmic Axis}
+% \begin{macro}{\lp@mkthickloglist}
+% \begin{macro}{\lp@thicklines}
+% \begin{macro}{\lp@lllist}
+% With |\lp@mkthickloglist| the lists in |\lp@thicklines| and |\lp@lllist|
+% are built. The parameter is 10 to build lists for a full decade and the
+% first digit after the decimal point of the \texttt{\emph{decades/divisions}}
+% argument to the logarithmic axis for a partial decade.
+% \begin{macrocode}
+\def\lp@mkthickloglist#1{%
+ \@tempcnta\@ne\loop
+ \advance\@tempcnta\@ne
+ \edef\lp@thicklines{\getlp@logline{\the\@tempcnta.0},\lp@thicklines}%
+ \edef\lp@lllist{\the\@tempcnta,\lp@lllist}%
+ \ifnum\@tempcnta<#1\repeat}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkmedloglist}
+% \begin{macro}{\lp@medlines}
+% In |\lp@mkmedloglist| one offset value is appended to the list in
+% |\lp@medlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
+% of course |\lp@mkmedloglist| will be called only with values like $x.5$.
+% \begin{macrocode}
+\def\lp@mkmedloglist#1{%
+ \edef\lp@medlines{\getlp@logline{#1},\lp@medlines}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinloglist}
+% \begin{macro}{\lp@thinlines}
+% In |\lp@mkthinloglist| one offset value is appended to the list in
+% |\lp@thinlines|. Parameter |#1| can be a decimal value from 1.0 to 10.0, but
+% of course |\lp@mkthinloglist| will be called only with values from $x.1$ to
+% $x.4$ and from $x.6$ to $x.9$.
+% \begin{macrocode}
+\def\lp@mkthinloglist#1{%
+ \edef\lp@thinlines{\getlp@logline{#1},\lp@thinlines}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinloglisttwo}
+% The command |\lp@mkthinloglisttwo| appends the offset values for
+% $x.2$, $x.4$, $x.6$ and $x.8$ to |\lp@thinlines|. Here $x$ is from 1 to 9
+% and passed as parameter |#1|.
+% \begin{macrocode}
+\def\lp@mkthinloglisttwo#1{%
+ \lp@mkthinloglist{#1.2}\lp@mkthinloglist{#1.4}%
+ \lp@mkthinloglist{#1.6}\lp@mkthinloglist{#1.8}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinloglistone}
+% The command |\lp@mkthinloglistone| appends the offset values for
+% $x.1$ to $x.4$ and $x.6$ to $x.9$ to |\lp@thinlines|. Here $x$ is from
+% 1 to 9 and passed as parameter |#1|.
+% \begin{macrocode}
+\def\lp@mkthinloglistone#1{\lp@mkthinloglisttwo{#1}%
+ \lp@mkthinloglist{#1.1}\lp@mkthinloglist{#1.3}%
+ \lp@mkthinloglist{#1.7}\lp@mkthinloglist{#1.9}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@getdist}
+% In |\lp@getdist| the absolute distance between two lines is calculated.
+% With parameter |#1| the length of a decade is passed, it has to be one
+% of the dimens |\lpgridx| or |\lpgridy|. The parameters |#2| and |#3| are the
+% decimal values for the two lines (in the range from 1.0 to 10.0). Note that
+% |#2| must be greater then |#3|. After calling |\lp@getdist| the dimen
+% |\@tempdima| will contain the absolute distance.
+% \begin{macrocode}
+\def\lp@getdist#1#2#3{%
+ \expandafter\@tempdima\getlp@logline{#2}#1%
+ \expandafter\@tempdimb\getlp@logline{#3}#1%
+ \advance\@tempdima-\@tempdimb}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkloglistpart}
+% The macro |\lp@mkloglistpart| extends the lists for medium and thin lines
+% with the line offsets for the part between $x$ and $(x+1)$, where $x$ is
+% from 1 to 9. The decision which offsets are appended (as described earlier)
+% is made here. Parameter |#1| is the length of a decade, passed with one
+% of the dimens |\lpgridx| or |\lpgridy|. Parameters |#2| is $(x+1)$ and
+% parameter |#3| is $x$.
+% \begin{macrocode}
+\def\lp@mkloglistpart#1#2#3{%
+ \lp@getdist{#1}{#2.0}{#3.9}\ifdim\@tempdima<\lp@mindist
+ \lp@getdist{#1}{#2.0}{#3.8}\ifdim\@tempdima<\lp@mindist
+ \lp@getdist{#1}{#2.0}{#3.5}\ifdim\@tempdima<\lp@mindist
+ \lp@getdist{#1}{#2.0}{#3.0}\ifdim\@tempdima<\lp@mindist
+ \PackageWarning{logpap}{%
+ lines are to close together\MessageBreak}%
+ \fi
+ \else
+ \lp@mkmedloglist{#3.5}%
+ \fi
+ \else
+ \lp@mkthinloglisttwo{#3}%
+ \fi
+ \else
+ \lp@mkmedloglist{#3.5}\lp@mkthinloglistone{#3}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkloglist}
+% With |\lp@mkloglist| all lists for full or partial decade are built.
+% Again parameter |#1| is the length of a decade (|\lpgridx| or |\lpgridy|).
+% Parameter |#2| is 10 for a full decade and the first digit after the
+% decimal point of the \texttt{\emph{decades/divisions}} argument to the
+% logarithmic axis for a partial decade.
+% \begin{macrocode}
+\def\lp@mkloglist#1#2{\lp@clearlists\lp@mkthickloglist{#2}%
+ \@tempcnta#2\@tempcntb\@tempcnta\advance\@tempcntb\m@ne
+ \loop
+ \lp@mkloglistpart{#1}{\the\@tempcnta}{\the\@tempcntb}%
+ \advance\@tempcnta\m@ne\advance\@tempcntb\m@ne
+ \ifnum\@tempcnta>\@ne\repeat}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Making Lists for linear Axis}
+% \begin{macro}{\lp@mkthicklinlist}
+% \begin{macro}{\lp@thicklines}
+% With |\lp@mkthicklinlist| the list for thick lines is built. Because it
+% will contain only one line at maximum, here no |\edef| is needed. Parameter
+% |#1| is 1 for a full division and $.y$ for a partial division, where $y$
+% is the first digit after the decimal point of the
+% \texttt{\emph{decades/divisions}} argument to the linear axis.
+% The decision if the offset has to be appended is made here.
+% \begin{macrocode}
+\def\lp@mkthicklinlist#1{%
+ \@tempdima#1\p@\relax\ifdim\@tempdima>.99\p@\def\lp@thicklines{1,}\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkmedlinlist}
+% \begin{macro}{\lp@medlines}
+% With |\lp@mkmedlinlist| the list for medium lines is built. It also
+% will contain only one line at maximum, so no |\edef| is needed here too.
+% Parameter |#1| is 1 for a full division and $.y$ for a partial division,
+% where $y$ is the first digit after the decimal point of the
+% \texttt{\emph{decades/divisions}} argument to the linear axis.
+% One part of the decision if the offset has to be appended is made here.
+% \begin{macrocode}
+\def\lp@mkmedlinlist#1{%
+ \@tempdima#1\p@\relax\ifdim\@tempdima>.49\p@\def\lp@medlines{.5,}\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinlinlist}
+% \begin{macro}{\lp@thinlines}
+% With |\lp@mkthinlinlist| one line offset is appended to the list for thin
+% lines. Parameter |#1| is this offset, only the values .1 to .4 and .6 to .9
+% are used.
+% \begin{macrocode}
+\def\lp@mkthinlinlist#1{%
+ \edef\lp@thinlines{#1,\lp@thinlines}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinlinlisttwo}
+% In |\lp@mkthinlinlisttwo| the offsets (for) .2, .4, .6 and .8 are appended
+% if necessary. The decision is made by parameter |#1|, which is 1 for a full
+% division and $.y$ for a partial division, where $y$ is the first digit after
+% the decimal point of the \texttt{\emph{decades/divisions}} argument to the
+% linear axis. One part of the decision, which offsets has to be appended is
+% made here.
+% \begin{macrocode}
+\def\lp@mkthinlinlisttwo#1{%
+ \@tempdima#1\p@\relax
+ \ifdim\@tempdima>.19\p@\lp@mkthinlinlist{.2}%
+ \ifdim\@tempdima>.39\p@\lp@mkthinlinlist{.4}%
+ \ifdim\@tempdima>.59\p@\lp@mkthinlinlist{.6}%
+ \ifdim\@tempdima>.79\p@\lp@mkthinlinlist{.8}%
+ \fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@mkthinlinlistone}
+% In |\lp@mkthinlinlisttwo| the offsets (for) .1 to .4 and .6 to .9 are
+% appended if necessary. The decision is made by parameter |#1|, which is 1 for
+% a full division and $.y$ for a partial division, where $y$ is the first digit
+% after the decimal point of the \texttt{\emph{decades/divisions}} argument to
+% the linear axis. One part of the decision, which offsets has to be appended
+% is made here.
+% \begin{macrocode}
+\def\lp@mkthinlinlistone#1{\lp@mkthinlinlisttwo{#1}%
+ \@tempdima#1\p@\relax
+ \ifdim\@tempdima>.09\p@\lp@mkthinlinlist{.1}%
+ \ifdim\@tempdima>.29\p@\lp@mkthinlinlist{.3}%
+ \ifdim\@tempdima>.69\p@\lp@mkthinlinlist{.7}%
+ \ifdim\@tempdima>.89\p@\lp@mkthinlinlist{.9}%
+ \fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@getlindist}
+% In |\lp@getlindist| the absolute distance between two lines is calculated.
+% Parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|). The
+% parameters |#2| and |#3| are the two line offsets, here |#2| has to be
+% greater then |#3|. After calling |\lp@getlindist| the dimen |\@tempdima|
+% will contain the absolute distance.
+% \begin{macrocode}
+\def\lp@getlindist#1#2#3{%
+ \@tempdima#2#1\@tempdimb#3#1%
+ \advance\@tempdima-\@tempdimb}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@mklinlist}
+% With |\lp@mklinlist| all lists for full or partial division are built.
+% Again parameter |#1| is the length of a division (|\lpgridx| or |\lpgridy|).
+% Parameter |#2| is 1 for a full division and $.y$ for a partial division,
+% where $y$ is the first digit after the decimal point of the
+% \texttt{\emph{decades/divisions}} argument to the linear axis.
+% The first part of the decision, which offsets has to be appended is
+% made here.
+% \begin{macrocode}
+\def\lp@mklinlist#1#2{\lp@clearlists\lp@mkthicklinlist{#2}%
+ \lp@getlindist{#1}{1.0}{0.9}\ifdim\@tempdima<\lp@mindist
+ \lp@getlindist{#1}{1.0}{0.8}\ifdim\@tempdima<\lp@mindist
+ \lp@getlindist{#1}{1.0}{0.5}\ifdim\@tempdima<\lp@mindist
+ \lp@getlindist{#1}{1.0}{0.0}\ifdim\@tempdima<\lp@mindist
+ \PackageWarning{logpap}{%
+ lines are to close together\MessageBreak}%
+ \fi
+ \else
+ \lp@mkmedlinlist{#2}%
+ \fi
+ \else
+ \lp@mkthinlinlisttwo{#2}%
+ \fi
+ \else
+ \lp@mkmedlinlist{#2}\lp@mkthinlinlistone{#2}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Drawing Lines}
+% \begin{macro}{\lp@dolinesx}
+% The command |\lp@dolinesx| draws all lines from one list of line offsets
+% (which contains the offsets for one decade or division). The offset from
+% the origin of the graph paper to the start of the decade or division to
+% draw is calculated and stored in |\lp@osg|. Parameter |#1| is the macro,
+% where the list is stored. Parameter |#2| is the thickness of the lines,
+% |#3| is the start positions of the lines in y-direction and |#4| is the
+% line length. The real work is done by |\lp@dolinex|, which is called with
+% the expanded list.
+% \begin{macrocode}
+\def\lp@dolinesx#1#2#3#4{\linethickness#2%
+ \lp@osg\lp@dcntx\lpgridx
+ \expandafter\lp@dolinex#1,\@@end{#3}{#4}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolinex}
+% If the list is not empty, |\lp@dolinex| first calculates the offset form
+% the origin of the graph paper to the line to draw in |\lp@osl|. Then the
+% line is drawn. Note: the command |\put| works with a dimen, because
+% |\unitlength| was disabled (with |\let\unitlength\relax|) before starting
+% the \texttt{picture} environment. At last |\lp@dolinex| calls itself
+% recursively, until the list is empty. Parameter |#1| is the first element of
+% the list and parameter |#2| its rest. Parameter |#3| is the start positions
+% of the lines in y-direction and |#4| is the line length.
+% \begin{macrocode}
+\def\lp@dolinex#1,#2,\@@end#3#4{%
+ \def\@tempc{#1}\ifx\@tempc\@empty\else
+ \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
+ \put(\lp@osl,#3){\line(0,1){#4}}%
+ \def\@tempc{#2}\ifx\@tempc\@empty\else
+ \lp@dolinex#2,\@@end{#3}{#4}\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolinesy}
+% The command |\lp@dolinesy| works the same way as |\lp@dolinesx|. It has the
+% same parameters, except that |#3| is the start position in x-direction.
+% \begin{macrocode}
+\def\lp@dolinesy#1#2#3#4{\linethickness#2%
+ \lp@osg\lp@dcnty\lpgridy
+ \expandafter\lp@doliney#1,\@@end{#3}{#4}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@doliney}
+% And |\lp@doliney| works the same way as |\lp@dolinex|. It has also the same
+% parameters, except that here |#3| is the start position in x-direction too.
+% \begin{macrocode}
+\def\lp@doliney#1,#2,\@@end#3#4{%
+ \def\@tempc{#1}\ifx\@tempc\@empty\else
+ \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
+ \put(#3,\lp@osl){\line(1,0){#4}}%
+ \def\@tempc{#2}\ifx\@tempc\@empty\else
+ \lp@doliney#2,\@@end{#3}{#4}\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Labeling}
+% \subsubsection{Setup for Labels}
+% During setup the \texttt{\emph{x/y-start},\emph{factor/increment}} argument
+% is tested and split into four macros. These macros and their contents
+% after setup (if everything is correct) are shown in table \ref{tab:sfi}.
+% \begin{table}[ht]
+% \begin{tabular}{lp{10cm}}\hline\\
+% \texttt{\bs lp@sign} & If \texttt{\emph{x/y-start}} is negativ, it contains
+% a ``$-$'', else it is empty.\\[.8ex]
+% \texttt{\bs lp@sll} & It contains the absolute \texttt{\emph{x/y-start}}
+% value (1 to 3 digits), the value itself is not tested
+% here (but it will be done later).\\[.8ex]
+% \texttt{\bs lp@sllp} & It contains the exponent letter if appended, else it
+% is empty.\\[.8ex]
+% \texttt{\bs lp@lfi} & It contains the \texttt{\emph{factor/increment}}
+% value, which is not tested here (but a range test
+% will be done later). If no
+% \texttt{\emph{factor/increment}} is given,
+% it is 1.\\[2.5ex]\hline
+% \end{tabular}
+% \caption{Macros for \texttt{\emph{x/y-start},\emph{factor/increment}}
+% after Setup}\label{tab:sfi}
+% \end{table}
+%
+% \begin{macro}{\lp@setuplabel}
+% \begin{macro}{\lp@lfi}
+% For setup the command |\lp@setuplabel| has to be called with the
+% \texttt{\emph{x/y-start}, \emph{factor/increment}} argument and a trailing
+% comma appended to it, to make it work without a
+% \texttt{\emph{factor/increment}} part. The \texttt{\emph{x/y-start}} part
+% is processed with |\lp@getsign@ndparse|. If no
+% \texttt{\emph{factor/increment}} part is given, |\lp@lfi| is set to 1
+% (the default), else this part is processed with |\lp@setup@lfi|.
+% \begin{macrocode}
+\def\lp@setuplabel#1,#2\@@end{%
+ \lp@getsign@ndparse#1\@@end
+ \def\@tempa{#2}\ifx\@tempa\@empty\def\lp@lfi{1}\else
+ \def\@tempb{,}\ifx\@tempa\@tempb\def\lp@lfi{1}\else
+ \lp@setup@lfi#2\@@end\fi\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@setup@lfi}
+% \begin{macro}{\lp@lfi}
+% The command |\lp@setup@lfi| discards the trailing comma from
+% \texttt{\emph{factor/increment},} and stores the factor or increment to
+% |\lp@lfi|.
+% \begin{macrocode}
+\def\lp@setup@lfi#1,\@@end{\def\lp@lfi{#1}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@getsign@ndparse}
+% \begin{macro}{\lp@sign}
+% In |\lp@getsign@ndparse| a leading ``$+$'' or ``$-$'' is discarded from
+% \texttt{\emph{x/y-start}}. If it was a ``$-$'', it is stored in |\lp@sign|,
+% otherwise |\lp@sign| will be empty. The rest (digits and exponent letter)
+% is passed to |\lp@parsesll| together with four ``x'', so that there are
+% at least five characters.
+% \begin{macrocode}
+\def\lp@getsign@ndparse#1#2\@@end{%
+ \if#1-\relax
+ \def\lp@sign{#1}\lp@parsesll#2xxxx\@@end
+ \else\if#1+\relax
+ \def\lp@sign{}\lp@parsesll#2xxxx\@@end
+ \else
+ \def\lp@sign{}\lp@parsesll#1#2xxxx\@@end
+ \fi\fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@parsesll}
+% \begin{macro}{\lp@sll}
+% \begin{macro}{\lp@sllp}
+% In |\lp@parsesll| the first four parameters takes the first four characters
+% passed from |\lp@getsign@ndparse| and parameter |#5| takes the rest (1 to 4
+% times ``x''). The first character has to be a digit, if not an error message
+% (|\lp@formaterr|) will occur. The next two characters can be a digit,
+% one of the exponent letters or an ``x''. If not, the same error message
+% will occur. And the fourth character can be an exponent letter or an ``x''.
+% Again the error message will occur, if it is not. When an exponent letters or
+% an ``x'' is detected, no further characters are tested. The digits are stored
+% in |\lp@sll|. The exponent letter is stored in |\lp@sllp|, if there isn't
+% one, |\lp@sllp| will be empty.
+% \begin{macrocode}
+\def\lp@parsesll#1#2#3#4#5\@@end{%
+ \if\lp@isdigit#1\relax
+ \if\lp@isdigit#2\relax
+ \if\lp@isdigit#3\relax
+ \lp@testletter#4\iflp@preached
+ \def\lp@sll{#1#2#3}\def\lp@sllp{#4}%
+ \else\if#4x\relax
+ \def\lp@sll{#1#2#3}\def\lp@sllp{}%
+ \else
+ \lp@formaterr
+ \fi\fi
+ \else\lp@testletter#3\iflp@preached
+ \def\lp@sll{#1#2}\def\lp@sllp{#3}%
+ \else\if#3x\relax
+ \def\lp@sll{#1#2}\def\lp@sllp{}%
+ \else
+ \lp@formaterr
+ \fi\fi\fi
+ \else\lp@testletter#2\iflp@preached
+ \def\lp@sll{#1}\def\lp@sllp{#2}%
+ \else\if#2x\relax
+ \def\lp@sll{#1}\def\lp@sllp{}%
+ \else
+ \lp@formaterr
+ \fi\fi\fi
+ \else
+ \lp@formaterr
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@formaterr}
+% The command |\lp@formaterr| gives an error message for a wrong
+% \texttt{\emph{x/y-start}} argument. It is used only in |\lp@parsesll|.
+% \begin{macrocode}
+\def\lp@formaterr{%
+ \PackageError{logpap}{wrong format of start value}%
+ {The format of the start value is:\MessageBreak
+ optional + or -, followed by 1-3 digits, optionaly\MessageBreak
+ followed by one of the letters [yzafpnumkMGTPEZY].\MessageBreak
+ Please correct it before going on,\MessageBreak
+ otherwise you might get more error messages.}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@isdigit}
+% With |\lp@isdigit| parameter |#1| is tested, whether it is a digit or
+% not.\footnote{This macro was kept from the UK-\TeX FAQ,
+% chapter ``Macro programming'', section ``Is the argument a number?''.}
+% It has to be invoked as follows: |\if\lp@isdigit|\meta{character}
+% \meta{stuff for character is a digit} |\else|
+% \meta{stuff for character is not a digit} |\fi|. The |\if| is needed to make
+% it work in nested if-strctures, therefor |\lp@isdigit| begins with |TT\fi|
+% to end this |\if|. The |\else| and |\fi| then belongs to the (uncomplete)
+% |\ifcat|. The comparison is done by the |\ifnum|. If |#1| is a digit the
+% second value will be 10 or greater, so the |\ifnum| expands to ``|_|'' and
+% the |\ifcat| will be true. In the other case|\ifnum| expands to ``|A|'' and
+% the |\ifcat| will be false. The macro would also work for positive numbers.
+% \begin{macrocode}
+\def\lp@isdigit#1{TT\fi\ifcat_\ifnum9<1#1 _\else A\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@testletter}
+% In |\lp@testletter| parameter |#1|, which has to be one character,
+% is compared to all possible exponent letter. The boolean |\iflp@preached|
+% is set to true if |#1| is one of the letters, else it is set to false.
+% \begin{macrocode}
+\def\lp@testletter#1{%
+ \def\@tempb{#1}\lp@preachedfalse
+ \@tfor\@tempc:=yzafpnumkMGTPEZY\do{%
+ \if\@tempc\@tempb\relax\relax\lp@preachedtrue\@break@tfor\fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Range Test for Label Values}
+% The next two macros (|\lp@testrangelin| and |\lp@testrangelog|) are not
+% invoked directly. Their meaning is assigned to |\lp@testrangex| and
+% |\lp@testrangey| by |\lp@@@logpap| instead, so the right test for an axis
+% takes place.
+%
+% \begin{macro}{\lp@testrangelin}
+% In |\lp@testrangelin| the start value for a linear axis is not tested,
+% because due to the tests in |\lp@parsesll| it is in the range from
+% $-999$ to 999 and there is no other limitation. The increment is only
+% tested against 0, because this doesn't make any sense.
+% \begin{macrocode}
+\def\lp@testrangelin{\@tempcnta\lp@lfi\relax
+ \ifnum\@tempcnta=0\relax
+ \PackageError{logpap}{wrong increment for linear axis}%
+ {The increment value is 0, which doesn't make any sense.\MessageBreak
+ Please correct it before going on.}%
+ \fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@testrangelog}
+% In |\lp@testrangelog| first the start value is tested whether it is 1, 10
+% or 100. If not, an error message will occur. A test against the possible
+% negative values is not necessary, because |\lp@sll| only contains the
+% absolute value (the sign is in |\lp@sign|). The test against 0 is not realy
+% necessary, but I could resist ;-) At last the factor is tested whether
+% it is in the range from 1 to 9.
+% \begin{macrocode}
+\def\lp@testrangelog{\@tempcnta\lp@sll\relax
+ \ifnum\@tempcnta=1\else\ifnum\@tempcnta=10\else\ifnum\@tempcnta=100\else
+ \ifnum\@tempcnta=0\relax
+ \PackageError{logpap}{wrong logarithmic start value}%
+ {0 as start value for a logarithmic axis?\MessageBreak
+ This is a typo, isn't it?\MessageBreak
+ If not, you should learn more mathematics\MessageBreak
+ before using this package ;-)\MessageBreak
+ Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
+ Please correct it before going on.}%
+ \else
+ \PackageError{logpap}{wrong logarithmic start value}%
+ {Only -100, -10, -1, 1, 10 and 100 are allowed.\MessageBreak
+ Please correct it before going on.}%
+ \fi
+ \fi\fi\fi
+ \@tempcnta\lp@lfi\relax
+ \ifnum\@tempcnta<1\lp@logfacerr\else\ifnum\@tempcnta>9\lp@logfacerr\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@logfacerr}
+% The command |\lp@logfacerr| just gives out an error message for a wrong
+% factor for logarithmic axis labeling.
+% \begin{macrocode}
+\def\lp@logfacerr{\PackageError{logpap}{wrong factor for logarithmic axis}%
+ {The factor has to be in the range from 1 to 9.\MessageBreak
+ Please correct it before going on.}}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Getting next Label}
+% The two macros |\lp@nextlinlabel| and |\lp@nextloglabel| are not invoked
+% directly, but assigned to |\lp@nextxlabel| and |\lp@nextylabel| by
+% |\lp@@@logpap|.
+%
+% \begin{macro}{\lp@nextlinlabel}
+% \begin{macro}{\lp@label}
+% In |\lp@nextlinlabel| first the labels value is calculated. Therefore the
+% increment (|#3|) is multiplied with the number of the division (|#4|) and
+% to the result the increment is added, because the label is at the end of
+% the actual division. To get the final value the signed (|#6|) start value
+% (|#1|) has to be added. After that if the exponent letter (|#2|) is ``u''
+% it is replaced with |\lp@mu|. The complete label is stored in |\lp@label|,
+% but with the exponent letter discarded if the value is 0. Note: parameter
+% |#5| is not used here, but it is necessary to be parameter compatible with
+% |\lp@nextloglabel|.
+% \begin{macrocode}
+\def\lp@nextlinlabel#1#2#3#4#5#6{\@tempcnta#3\multiply\@tempcnta#4\relax
+ \advance\@tempcnta#3\advance\@tempcnta#6#1\relax
+ \def\@tempa{#2}\def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
+ \edef\lp@label{\the\@tempcnta\ifnum\@tempcnta=0\else\@tempa\fi}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@nextloglabel}
+% The parameters for |\lp@nextloglabel| are the absolut start value (|#1|),
+% the start exponent letter (|#2|), the factor (|#3|), the decades count
+% (beginning with 0, |#4|), a number from 2 to 10 (|#5|) and the sign (|#6|).
+%
+% First the number is used to distinguish between a label within a decade
+% (values from 2 to 9) and a label for a full decade (10). The latter label
+% consists of the sign, the factor multiplied with one of the values 1, 10 or
+% 100 and the trailing exponent letter.
+% \begin{macrocode}
+\def\lp@nextloglabel#1#2#3#4#5#6{%
+ \@tempcnta#5\relax\ifnum\@tempcnta=10
+ \lp@tentrue
+% \end{macrocode}
+% The values 1, 10 and 100 can also be expressed as $10^a$, where the exponent
+% $a$ (in |\@tempcnta|) is 0, 1 or 2. To get this exponent the decades count
+% (|#4|) has to be advanced by one if the start value (|#1|) is 1, by two if
+% the start value is 10 or by three if the start value is 100.
+% \begin{macrocode}
+ \@tempcnta#4\relax\@tempcntb#1\relax
+ \advance\@tempcnta\@ne
+ \ifnum\@tempcntb>1\advance\@tempcnta\@ne
+ \ifnum\@tempcntb>10\advance\@tempcnta\@ne\fi\fi
+% \end{macrocode}
+% After a modulo 3 (next four lines) $a$ is in the right range and |\lp@label|
+% can be defined as the value needed within a case structure.
+% \begin{macrocode}
+ \@tempcntb\@tempcnta
+ \divide\@tempcntb 3\relax
+ \multiply\@tempcntb 3\relax
+ \advance\@tempcnta-\@tempcntb
+ \ifcase\@tempcnta
+ \def\lp@label{1}\or
+ \def\lp@label{10}\or
+ \def\lp@label{100}\fi
+% \end{macrocode}
+% From the modulo operation the vaule $a-(a\;\mbox{mod}\;3)$ remains in
+% |\@tempcntb|. After dividing it by 3 it contains the number of exponent
+% letters to step further. This is done in |\lp@getpot| after that |\@tempa|
+% will contain the needed letter, or an ``X'' if there are no more letters.
+% In the latter case a warning is given.
+% \begin{macrocode}
+ \divide\@tempcntb 3\relax
+ \lp@getpot{#2}\@tempcntb
+ \def\@tempb{X}\ifx\@tempa\@tempb
+ \PackageWarning{logpap}{%
+ log. axis value went to large\MessageBreak
+ (no more letters for exponent, used X)\MessageBreak}%
+ \fi
+% \end{macrocode}
+% \begin{macro}{\lp@label}
+% If the exponent letter is ``u'', it is replaced by |\lp@mu|. Then the value
+% (1, 10 or 100) is multiplied with the factor (|#3|) and the signed (|#6|)
+% label is built in |\lp@label|.
+% \begin{macrocode}
+ \def\@tempb{u}\ifx\@tempa\@tempb\def\@tempa{\lp@mu}\fi
+ \@tempcnta\lp@label\multiply\@tempcnta#3\relax
+ \edef\lp@label{#6\the\@tempcnta\@tempa}%
+ \else
+% \end{macrocode}
+% This method building the complte label is independent of the order drawing
+% the decades.
+%
+% \begin{macro}{\lp@label}
+% If a label for within a decade is needed, the number (|#5|) is multiplied
+% with the factor (|#3|) and then the signed (|#6|) label is built in
+% |\lp@label|. But if the option |notwonine| where given, |\lp@label| will be
+% empty and if the option |nofsn| where given, the already built |\lp@label|
+% for 5, 7 and 9 will be cleared.
+% \begin{macrocode}
+ \lp@tenfalse
+ \iflp@twonine
+ \multiply\@tempcnta#3\relax
+ \edef\lp@label{#6\the\@tempcnta}%
+ \iflp@fsn\else
+ \divide\@tempcnta#3\relax
+ \ifnum\@tempcnta=9\def\lp@label{}\fi
+ \ifnum\@tempcnta=7\def\lp@label{}\fi
+ \ifnum\@tempcnta=5\def\lp@label{}\fi
+ \fi
+ \else
+ \def\lp@label{}%
+ \fi
+ \fi}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@getpot}
+% In |\lp@getpot| the exponent letter needed for a full decades label is
+% ascertained. It takes the letter to start with (|#1|) and the number of
+% of letters to step further (|#2|) as parameters. The macro |\@tempa| will
+% contain the ascertained letter after operation. It is predefined as ``X'',
+% which will be the result, if there are not enough letters.
+%
+% Within the |\@tfor| loop the boolean |\iflp@preached| is set to true in the
+% pass the start letter is reached. From the same pass on the number of letters
+% to step further is counted down once a pass until it is $-1$. Then |\@tempa|
+% is set to the actual letter. Note: the |{}| in the token list (between |:=|
+% and |\do|) stands for the nonexisting letter for $10^0$. The |\@tfor| loop
+% will always run completely, because (for whatever reasons) |\@break@tfor|
+% doesn't work within the |\ifnum|.
+% \begin{macrocode}
+\def\lp@getpot#1#2{%
+ \def\@tempb{#1}\def\@tempa{X}\@tempcnta#2\relax\lp@preachedfalse
+ \@tfor\@tempc:=yzafpnum{}kMGTPEZY\do{%
+ \if\@tempc\@tempb\relax\relax\lp@preachedtrue\fi
+ \iflp@preached\advance\@tempcnta\m@ne
+ \ifnum\@tempcnta=\m@ne\edef\@tempa{\@tempc}\fi
+ \fi}}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Drawing Labels}
+% \begin{macro}{\lp@xlabel}
+% With |\lp@xlabel| one label for the x-axis is drawn. Parameter |#1| is the
+% offset from the origin of the graph paper to the thick line, where the label
+% has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
+% is already advanced by |\lp@tol|, when calling |\lp@xlabel|. Note (2): the
+% command |\put| works with a dimen, because |\unitlength| was disabled before
+% starting the \texttt{picture} environment.
+% \begin{macrocode}
+\def\lp@xlabel#1#2{\let\@tempb\lp@lpos
+ \iflp@tenlower\iflp@ten\let\@tempb\lp@llpos\fi\fi
+ \put(#1,-\@tempb){\makebox(\z@,\z@)[tc]{\lp@font #2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@ylabel}
+% With |\lp@ylabel| one label for the y-axis is drawn. Parameter |#1| is the
+% offset from the origin of the graph paper to the thick line, where the label
+% has to appear at. Parameter |#2| is the label. Note: the value in |\lp@lpos|
+% is already advanced by |\lp@tol|, when calling |\lp@ylabel|. Note (2): here
+% also |\put| works with a dimen, because of the disabled |\unitlength|.
+% \begin{macrocode}
+\def\lp@ylabel#1#2{\put(-\lp@lpos,#1){\makebox(\z@,\z@)[cr]{\lp@font #2}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@nextlllist}
+% \begin{macro}{\lp@llno}
+% \begin{macro}{\lp@lllist}
+% In |\lp@nextlllist| the first element of the list in |\lp@lllist| is
+% discarded from it and stored in |\lp@llno|. The macro has to be called
+% with the expanded |\lp@lllist|.
+% \begin{macrocode}
+\def\lp@nextlllist#1,#2\@@end{%
+ \def\lp@llno{#1}\def\lp@lllist{#2}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolabelsx}
+% \begin{macro}{\lp@lllist}
+% With |\lp@dolabelsx| the labels for one decade or division are drawn. Here
+% first the offset from the origin of the graph paper to the beginning of the
+% actual decade or division is calculated and stored in |\lp@osg|. Then the
+% list containing the values for logarithmic axis labels (|#5|) is assigned to
+% |\lp@lllist|.\footnote{The name \texttt{\bs lp@lllist} can be used here,
+% because after building the list in \texttt{\bs lp@lllist} it is assigned to
+% one of the names \texttt{\bs lp@lllistx}, \texttt{\bs lp@lllisty},
+% \texttt{\bs lp@partlllistx} or \texttt{\bs lp@partlllisty}.} At last
+% |\lp@dolabelx| is called with the expanded list of offsets from the beginning
+% of a decade or division to the thick lines, where the labels has to appear
+% at, and the other papameters. These parameters are the start value (|#2|),
+% the start exponent letter (|#3|), the factor or increment (|#4|) and the
+% start values sign (|#6|).
+% \begin{macrocode}
+\def\lp@dolabelsx#1#2#3#4#5#6{\lp@osg\lp@dcntx\lpgridx
+ \let\lp@lllist#5\relax
+ \expandafter\lp@dolabelx#1,\@@end{#2}{#3}{#4}{#6}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolabelx}
+% If the list is not empty, |\lp@dolabelx| first calculates the offset form
+% the origin of the graph paper to the line, where the label has to appear at,
+% in |\lp@osl|. Then the next element of |\lp@lllist| is stored in |\lp@llno|,
+% the next label is built and it is drawn. At last |\lp@dolabelx| calls itself
+% recursively, until the list is empty. Parameter |#1| is the first element of
+% the list of offsets and parameter |#2| its rest. Parameter |#3| is the start
+% value, |#4| the start exponent letter, |#5| the factor or increment and |#6|
+% the start values sign.
+% \begin{macrocode}
+\def\lp@dolabelx#1,#2,\@@end#3#4#5#6{%
+ \def\@tempc{#1}\ifx\@tempc\@empty\else
+ \lp@osl#1\lpgridx \advance\lp@osl\lp@osg
+ \expandafter\lp@nextlllist\lp@lllist\@@end
+ \lp@nextxlabel{#3}{#4}{#5}\lp@dcntx\lp@llno{#6}%
+ \lp@xlabel\lp@osl\lp@label
+ \def\@tempc{#2}\ifx\@tempc\@empty\else
+ \lp@dolabelx#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolabelsy}
+% \begin{macro}{\lp@lllist}
+% The command |\lp@dolabelsy| works the same way and has the same parameters
+% as |\lp@dolabelsx|, but of course for the y-axis.
+% \begin{macrocode}
+\def\lp@dolabelsy#1#2#3#4#5#6{\lp@osg\lp@dcnty\lpgridy
+ \let\lp@lllist#5\relax
+ \expandafter\lp@dolabely#1,\@@end{#2}{#3}{#4}{#6}}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@dolabely}
+% The command |\lp@dolabely| works the same way and has the same parameters
+% as |\lp@dolabelx|, but of course for the y-axis.
+% \begin{macrocode}
+\def\lp@dolabely#1,#2,\@@end#3#4#5#6{%
+ \def\@tempc{#1}\ifx\@tempc\@empty\else
+ \lp@osl#1\lpgridy \advance\lp@osl\lp@osg
+ \expandafter\lp@nextlllist\lp@lllist\@@end
+ \lp@nextylabel{#3}{#4}{#5}\lp@dcnty\lp@llno{#6}%
+ \lp@ylabel\lp@osl\lp@label
+ \def\@tempc{#2}\ifx\@tempc\@empty\else
+ \lp@dolabely#2,\@@end{#3}{#4}{#5}{#6}\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Some Macros for Initialization}
+% \subsubsection{Setting Lists}
+% \begin{macro}{\lp@setlinesx}
+% \begin{macro}{\lp@thicklinesx}
+% \begin{macro}{\lp@medlinesx}
+% \begin{macro}{\lp@thinlinesx}
+% \begin{macro}{\lp@lllistx}
+% In |\lp@setlinesx| only the already built lists for a full decade or
+% divisions are assigned the macros special to the x-axis.
+% \begin{macrocode}
+\def\lp@setlinesx{\let\lp@thicklinesx\lp@thicklines
+ \let\lp@medlinesx\lp@medlines \let\lp@thinlinesx\lp@thinlines
+ \let\lp@lllistx\lp@lllist}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@setlinesy}
+% \begin{macro}{\lp@thicklinesy}
+% \begin{macro}{\lp@medlinesy}
+% \begin{macro}{\lp@thinlinesy}
+% \begin{macro}{\lp@lllisty}
+% In |\lp@setlinesy| only the already built lists for a full decade or
+% divisions are assigned the macros special to the y-axis.
+% \begin{macrocode}
+\def\lp@setlinesy{\let\lp@thicklinesy\lp@thicklines
+ \let\lp@medlinesy\lp@medlines \let\lp@thinlinesy\lp@thinlines
+ \let\lp@lllisty\lp@lllist}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@setpartlinesx}
+% \begin{macro}{\lp@partthicklinesx}
+% \begin{macro}{\lp@partmedlinesx}
+% \begin{macro}{\lp@partthinlinesx}
+% \begin{macro}{\lp@partlllistx}
+% In |\lp@setpartlinesx| only the already built lists for a partial decade or
+% divisions are assigned the macros special to the x-axis.
+% \begin{macrocode}
+\def\lp@setpartlinesx{\let\lp@partthicklinesx\lp@thicklines
+ \let\lp@partmedlinesx\lp@medlines \let\lp@partthinlinesx\lp@thinlines
+ \let\lp@partlllistx\lp@lllist}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\lp@setpartlinesy}
+% \begin{macro}{\lp@partthicklinesy}
+% \begin{macro}{\lp@partmedlinesy}
+% \begin{macro}{\lp@partthinlinesy}
+% \begin{macro}{\lp@partlllisty}
+% In |\lp@setpartlinesy| only the already built lists for a partial decade or
+% divisions are assigned the macros special to the y-axis.
+% \begin{macrocode}
+\def\lp@setpartlinesy{\let\lp@partthicklinesy\lp@thicklines
+ \let\lp@partmedlinesy\lp@medlines \let\lp@partthinlinesy\lp@thinlines
+ \let\lp@partlllisty\lp@lllist}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Parsing Number of Decades/Divisions}
+% \begin{macro}{\lp@ipart}
+% The macro |\lp@ipart| expands to the integer part of a real number, which
+% is passed to it.
+% \begin{macrocode}
+\def\lp@ipart#1.#2\@@end{#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@rpart}
+% The macro |\lp@rpart| expands to the part after the decimal point of
+% a real number, which is passed to it.
+% \begin{macrocode}
+\def\lp@rpart#1.#2\@@end{#2}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@firstdigit}
+% The macro |\lp@firstdigit| expands to the first digit of a (integer) number,
+% which is passed to it.
+% \begin{macrocode}
+\def\lp@firstdigit#1#2\@@end{#1}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@getreal}
+% In |\lp@getreal| the number of decades or division as passed to the
+% \texttt{\emph{decades/divisions}} argument of an axis (parameter |#1|)
+% is split. The integer part is stored in |\@tempa|, if there is no integer
+% part |\@tempa| will be 0. The first digit after the decimal point is stored
+% in |\@tempb| if it is not equal 0, else |\@tempb| will be empty. This works
+% for $x$, $x.$, $x.0$, $x.y$, $x.0z$, $x.yz$, $0.y$, $0.yz$, $.y$ and $.yz$
+% (here $x$ and $y$ are single digits and $z$ is the rest).
+% \begin{macrocode}
+\def\lp@getreal#1{%
+ \edef\@tempa{\lp@ipart#1.\@@end}%
+ \ifx\@tempa\@empty\def\@tempa{0}\fi
+ \edef\@tempc{\lp@rpart#1.\@@end}%
+ \ifx\@tempc\@empty\let\@tempb\@empty\else
+ \if\@tempc.\let\@tempb\@empty\else
+ \edef\@tempd{\expandafter\lp@firstdigit\@tempc\@@end}%
+ \if\@tempd0\let\@tempb\@empty\else
+ \let\@tempb\@tempd\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A------------------------------
+% \subsubsection{Checking Number of Decades/Devisions}
+% \begin{macro}{\lp@decerr}
+% With |\lp@decerr| an error message for a to small number of decades is given.
+% \begin{macrocode}
+\def\lp@decerr{%
+ \PackageError{logpap}{number of decades for logaritmic axis to small}%
+ {The number of decades for a logaritmic axis\MessageBreak
+ has to be at least 0.2.\MessageBreak
+ Please correct it before going on,\MessageBreak
+ otherwise you might get more error messages.}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@decerri}
+% With |\lp@decerri| an error message for a wrong number of decades is given.
+% \begin{macrocode}
+\def\lp@decerri{%
+ \PackageError{logpap}{wrong number of decades for logaritmic axis}%
+ {For the number of decades for a logaritmic axis\MessageBreak
+ values like x.1 are not alowed.\MessageBreak
+ You can only use x.0 (or only x) and x.2 to x.9.\MessageBreak
+ Please correct it before going on,\MessageBreak
+ otherwise you might get more error messages.}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@checkdec}
+% In |\lp@checkdec| the number of decades is checked against a minimum value of
+% 0.2 and values in the form x.1 and an appropriate error messages is given if
+% necessary. The integer part has to be in |\@tempa| and the first digit after
+% the decimal point in |\@tempb| when calling |\lp@checkdec|.
+% \begin{macrocode}
+\def\lp@checkdec{\@tempcnta\@tempa
+ \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
+ \ifnum\@tempcnta<0\relax\lp@decerr\else
+ \ifnum\@tempcntb=0\relax\ifnum\@tempcnta=0\relax\lp@decerr\fi\else
+ \ifnum\@tempcntb<0\relax\lp@decerri\else
+ \ifnum\@tempcntb=1\relax
+ \ifnum\@tempcnta=0\relax\lp@decerr\else
+ \lp@decerri\fi\fi\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@diverr}
+% With |\lp@diverr| an error message for a to small number of divisions is
+% given.
+% \begin{macrocode}
+\def\lp@diverr{%
+ \PackageError{logpap}{number of divisions for linear axis to small}%
+ {The number of divisions for a linear axis\MessageBreak
+ has to be at least 0.1.\MessageBreak
+ Please correct it before going on,\MessageBreak
+ otherwise you might get more error messages.}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@checkdiv}
+% In |\lp@checkdiv| the number of divisions is checked against a minimum value
+% of 0.1 and an appropriate error message is given if necessary. The integer
+% part has to be in |\@tempa| and the first digit after the decimal point in
+% |\@tempb| when calling |\lp@checkdiv|.
+% \begin{macrocode}
+\def\lp@checkdiv{\@tempcnta\@tempa
+ \ifx\@tempb\@empty\@tempcntb0\relax\else\@tempcntb\@tempb\relax\fi
+ \ifnum\@tempcnta<0\relax\lp@diverr\else
+ \ifnum\@tempcnta=0\relax
+ \ifnum\@tempcntb<1\relax\lp@diverr\fi\fi\fi}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Drawing the whole Graph Paper}
+% \begin{macro}{\lp@logpap}
+% The command |\lp@logpap| is invoked by the four main macros. It only checks
+% if there is a first optional argument.
+% \begin{macrocode}
+\def\lp@logpap(#1,#2)(#3,#4)#5#6{%
+ \@ifnextchar[{\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}}%
+ {\lp@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@@logpap}
+% The command |\lp@@logpap| checks if there is a second optional argument.
+% \begin{macrocode}
+\def\lp@@logpap#1#2#3#4#5#6[#7]{%
+ \@ifnextchar[{\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7]}%
+ {\lp@@@logpap{#1}{#2}{#3}{#4}{#5}{#6}[#7][]}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\lp@@@logpap}
+% In |\lp@@@logpap| most of the work is done. The parameters are the dimension
+% of the graph paper in x- (|#1|) and y-direction (|#2|), the number of decades
+% or divisions in x- (|#3|) and y-direction (|#4|), the start value and factor
+% or increment for x- (|#5|) and y-axis labeling (|#6|) and the x- (|#7|) and
+% y-axis name (|#8|).
+%
+% First a lot of settings for the x-axis are made. Here the number of decades
+% or divisions is split (integer part in |\@tempa| and first digit after
+% decimal point in |\@tempb|, empty if 0 or none) and checked, the boolean
+% |\iflp@fulldecx| is set and the text showing the dimensions (|\lp@texttwo|)
+% is extended. Latter is done several times until the text is complete.
+% \begin{macrocode}
+\def\lp@@@logpap#1#2#3#4#5#6[#7][#8]{%
+ \lp@getreal{#3}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
+ \ifnum\@tempa=0\relax\lp@fulldecxfalse\else\lp@fulldecxtrue\fi
+ \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
+% \end{macrocode}
+% Now the boolean |\lp@partdecxfalse| is set and |\lp@real| and |\lp@part|
+% are defined, but latter only if there is a partial decade or division.
+% \begin{macrocode}
+ \ifx\@tempb\@empty
+ \lp@partdecxfalse
+ \let\lp@real\@tempa
+ \edef\lp@texttwo{\lp@texttwo\iflp@logx\,dec\fi\ $\times$}%
+ \else
+ \lp@partdecxtrue
+ \iflp@logx
+ \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
+ \edef\lp@part{\@tempb}%
+ \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec\ $\times$}%
+ \else
+ \edef\lp@real{\@tempa.\@tempb}%
+ \edef\lp@part{.\@tempb}%
+ \edef\lp@texttwo{\lp@texttwo.\@tempb\ $\times$}%
+ \fi
+ \fi
+% \end{macrocode}
+% Then |\lp@dcntx| is set and |\lpgridx| is calculated with help of the
+% extensions to |\setlength| by the \textsf{calc} package (and made global,
+% so it can be used after the graph paper was drawn). All lists for the
+% x-axis are made and the necessary commands for testing the range of the
+% argument for labeling and getting the next label are assigned to
+% |\lp@testrangex| and |\lp@nextxlabel|.
+% \begin{macrocode}
+ \lp@dcntx\@tempa
+ \setlength\lpgridx{#1/\real{\lp@real}}\global\lpgridx\lpgridx
+ \iflp@logx
+ \lp@mkloglist\lpgridx{10}\lp@setlinesx
+ \iflp@partdecx \lp@mkloglist\lpgridx\lp@part \lp@setpartlinesx\fi
+ \let\lp@testrangex\lp@testrangelog
+ \let\lp@nextxlabel\lp@nextloglabel
+ \else
+ \lp@mklinlist\lpgridx{1}\lp@setlinesx
+ \iflp@partdecx \lp@mklinlist\lpgridx\lp@part \lp@setpartlinesx\fi
+ \let\lp@testrangex\lp@testrangelin
+ \let\lp@nextxlabel\lp@nextlinlabel
+ \fi
+% \end{macrocode}
+% After this the same things are set up for y-axis on the same way.
+% \begin{macrocode}
+ \lp@getreal{#4}\iflp@logx\lp@checkdec\else\lp@checkdiv\fi
+ \ifnum\@tempa=0\relax\lp@fulldecyfalse\else\lp@fulldecytrue\fi
+ \edef\lp@texttwo{\lp@texttwo\ \@tempa}%
+ \ifx\@tempb\@empty
+ \lp@partdecyfalse
+ \let\lp@real\@tempa
+ \edef\lp@texttwo{\lp@texttwo\iflp@logy\,dec\fi}%
+ \else
+ \lp@partdecytrue
+ \iflp@logy
+ \edef\lp@real{\@tempa\getlp@logline{\@tempb.0}}%
+ \edef\lp@part{\@tempb}%
+ \edef\lp@texttwo{\lp@texttwo.\@tempb\,dec}%
+ \else
+ \edef\lp@real{\@tempa.\@tempb}%
+ \edef\lp@part{.\@tempb}%
+ \edef\lp@texttwo{\lp@texttwo.\@tempb}%
+ \fi
+ \fi
+ \lp@dcnty\@tempa
+ \setlength\lpgridy{#2/\real{\lp@real}}\global\lpgridy\lpgridy
+ \iflp@logy
+ \lp@mkloglist\lpgridy{10}\lp@setlinesy
+ \iflp@partdecy \lp@mkloglist\lpgridy\lp@part \lp@setpartlinesy\fi
+ \let\lp@testrangey\lp@testrangelog
+ \let\lp@nextylabel\lp@nextloglabel
+ \else
+ \lp@mklinlist\lpgridy{1}\lp@setlinesy
+ \iflp@partdecy \lp@mklinlist\lpgridy\lp@part \lp@setpartlinesy\fi
+ \let\lp@testrangey\lp@testrangelin
+ \let\lp@nextylabel\lp@nextlinlabel
+ \fi
+% \end{macrocode}
+% Now the lengths for thick and medium lines are calculated by adding the tick
+% length once, or twice if ticks on the upper and the right side of the graph
+% paper should appear.
+% \begin{macrocode}
+ \lp@thicklinelenx#1\advance\lp@thicklinelenx\lp@tol
+ \lp@thicklineleny#2\advance\lp@thicklineleny\lp@tol
+ \lp@medlinelenx#1\advance\lp@medlinelenx\lp@mol
+ \lp@medlineleny#2\advance\lp@medlineleny\lp@mol
+ \iflp@ticksupright
+ \advance\lp@thicklinelenx\lp@tol
+ \advance\lp@thicklineleny\lp@tol
+ \advance\lp@medlinelenx\lp@mol
+ \advance\lp@medlineleny\lp@mol
+ \fi
+% \end{macrocode}
+% Then everything for x-axis labeling is set up, the values are tested and
+% assigned to |\lp@sllx|, |\lp@sllpx|, |\lp@lfix| and |\lp@signx|.
+% \begin{macrocode}
+ \lp@setuplabel#5,\@@end
+ \lp@testrangex
+ \let\lp@sllx\lp@sll\let\lp@sllpx\lp@sllp\let\lp@lfix\lp@lfi
+ \let\lp@signx\lp@sign
+% \end{macrocode}
+% The same is done for y-axis labeling.
+% \begin{macrocode}
+ \lp@setuplabel#6,\@@end
+ \lp@testrangey
+ \let\lp@slly\lp@sll\let\lp@sllpy\lp@sllp\let\lp@lfiy\lp@lfi
+ \let\lp@signy\lp@sign
+% \end{macrocode}
+% After that |\unitlength| is disabled within a group (ending at the end of
+% |\lp@@@logpap|), so all commands of the \texttt{picture} environment and the
+% environment itself will work with dimens (and only with dimens). Then
+% |\lp@llpos| is calculated so that labels, which have to appear lower (see
+% option \texttt{tenlower}), are put one |\lp@lpos| under normal labels and
+% |\lp@lpos| is advanced by |\lp@tol|, so that normal labels appears one
+% (unadvanced) |\lp@lpos| under the ticks.
+% \begin{macrocode}
+ \begingroup
+ \let\unitlength\relax
+ {\lp@font\settoheight\@tempdima{M}\advance\@tempdima\lp@tol
+ \advance\@tempdima\lp@lpos\advance\@tempdima\lp@lpos
+ \xdef\lp@llpos{\the\@tempdima}}%
+ \@tempdima\lp@lpos\advance\@tempdima\lp@tol\edef\lp@lpos{\the\@tempdima}%
+ \begin{picture}(#1,#2)(\z@,\z@)
+% \end{macrocode}
+% Within the \texttt{picture} environment first the label for the x-axis origin
+% is set. For a logarithmic axis the start value has to be multiplied by the
+% factor. If the exponent letter is ``u'' it is replaced with |\lp@mu|. And
+% if the start value is 0 (linear axis only) the sign and the exponent letter
+% are cleard.
+% \begin{macrocode}
+ \lp@labelcolor
+ \lp@tenfalse
+ \@tempcnta\lp@sllx\iflp@logx\multiply\@tempcnta\lp@lfix\fi
+ \def\@tempa{u}\ifx\lp@sllpx\@tempa\def\@tempa{\lp@mu}\else
+ \def\@tempa{\lp@sllpx}\fi
+ \begingroup
+ \ifnum\@tempcnta=0\let\lp@signx\@empty\let\@tempa\@empty\fi
+ \lp@xlabel{\z@}{\lp@signx\the\@tempcnta\@tempa}
+ \endgroup
+% \end{macrocode}
+% The label for the y-axis origin is set on the same way.
+% \begin{macrocode}
+ \@tempcnta\lp@slly\iflp@logy\multiply\@tempcnta\lp@lfiy\fi
+ \def\@tempa{u}\ifx\lp@sllpy\@tempa\def\@tempa{\lp@mu}\else
+ \def\@tempa{\lp@sllpy}\fi
+ \begingroup
+ \ifnum\@tempcnta=0\let\lp@signy\@empty\let\@tempa\@empty\fi
+ \lp@ylabel{\z@}{\lp@signy\the\@tempcnta\@tempa}
+ \endgroup
+% \end{macrocode}
+% Now the two text parts are set above the graph paper.
+% \begin{macrocode}
+ \@tempdima#2\advance\@tempdima\lp@lpos
+ \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
+ \put(\z@,\@tempdima){\makebox(\z@,\z@)[bl]{\lp@font
+ \iflp@text\lp@textone\fi\iflp@dimensions\lp@texttwo\fi}}
+% \end{macrocode}
+% And the axis names are set at the end of the y- and x-axis. The y-position
+% for the y-axis name (|\@tempdima|) is the same as for the two text parts.
+% \begin{macrocode}
+ \put(-\lp@lpos,\@tempdima){\makebox(\z@,\z@)[br]{#8}}
+ \@tempdima#1\advance\@tempdima\lp@lpos
+ \iflp@ticksupright\else\advance\@tempdima-\lp@tol\fi
+ \put(\@tempdima,-\lp@lpos){\makebox(\z@,\z@)[tl]{#7}}
+% \end{macrocode}
+% Then the lines for the origin are drawn.
+% \begin{macrocode}
+ \lp@linecolor
+ \linethickness\lp@tkltkness
+ \put(-\lp@tol,\z@){\line(1,0){\lp@thicklinelenx}}
+ \put(\z@,-\lp@tol){\line(0,1){\lp@thicklineleny}}
+% \end{macrocode}
+% After that lines and labels for the x-axis will be done. Here first the
+% booleans |\iflp@twonine| and |\iflp@fsn| are set depending on
+% |\iflp@twoninex| and |\iflp@fsnx|.
+% \begin{macrocode}
+ \iflp@twoninex\lp@twoninetrue\else\lp@twoninefalse\fi
+ \iflp@fsnx\lp@fsntrue\else\lp@fsnfalse\fi
+% \end{macrocode}
+% Then lines and labels for a partial decade or division are done if there is
+% one.
+% \begin{macrocode}
+ \iflp@partdecx
+ \lp@dolinesx\lp@partthicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
+ \lp@dolinesx\lp@partmedlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
+ \lp@dolinesx\lp@partthinlinesx\lp@tnltkness\z@{#2}%
+ \lp@labelcolor
+ \lp@dolabelsx\lp@partthicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@partlllistx\lp@signx
+ \lp@linecolor
+ \fi
+% \end{macrocode}
+% If there is at least one full decade or division, they are done one by one.
+% \begin{macrocode}
+ \iflp@fulldecx\advance\lp@dcntx\m@ne
+ \loop
+ \lp@dolinesx\lp@thicklinesx\lp@tkltkness{-\lp@tol}\lp@thicklineleny
+ \lp@dolinesx\lp@medlinesx\lp@mdltkness{-\lp@mol}\lp@medlineleny
+ \lp@dolinesx\lp@thinlinesx\lp@tnltkness\z@{#2}%
+ \lp@labelcolor
+ \lp@dolabelsx\lp@thicklinesx\lp@sllx\lp@sllpx\lp@lfix\lp@lllistx\lp@signx
+ \lp@linecolor
+ \advance\lp@dcntx\m@ne
+ \ifnum\lp@dcntx>\m@ne\repeat
+ \fi
+% \end{macrocode}
+% The lines and labels for y-axis are done on the same way as for the x-axis.
+% \begin{macrocode}
+ \iflp@twoniney\lp@twoninetrue\else\lp@twoninefalse\fi
+ \iflp@fsny\lp@fsntrue\else\lp@fsnfalse\fi
+ \iflp@partdecy
+ \lp@dolinesy\lp@partthicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
+ \lp@dolinesy\lp@partmedlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
+ \lp@dolinesy\lp@partthinlinesy\lp@tnltkness\z@{#1}%
+ \lp@labelcolor
+ \lp@dolabelsy\lp@partthicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@partlllisty\lp@signy
+ \lp@linecolor
+ \fi
+ \iflp@fulldecy\advance\lp@dcnty\m@ne
+ \loop
+ \lp@dolinesy\lp@thicklinesy\lp@tkltkness{-\lp@tol}\lp@thicklinelenx
+ \lp@dolinesy\lp@medlinesy\lp@mdltkness{-\lp@mol}\lp@medlinelenx
+ \lp@dolinesy\lp@thinlinesy\lp@tnltkness\z@{#1}%
+ \lp@labelcolor
+ \lp@dolabelsy\lp@thicklinesy\lp@slly\lp@sllpy\lp@lfiy\lp@lllisty\lp@signy
+ \lp@linecolor
+ \advance\lp@dcnty\m@ne
+ \ifnum\lp@dcnty>\m@ne\repeat
+ \fi
+ \end{picture}\endgroup}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{The main Macros}
+% The four main macros are very simple. Here only two booleans are set and
+% the first part of the text showing the dimensions is defined. They even
+% take no parameters. This is done by |\lp@logpap|, called at the end of
+% the main macros.
+%
+% \begin{macro}{\loglinpap}
+% The command |\loglinpap| draws graph paper with logarithmic x-axis and
+% linear y-axis.
+% \begin{macrocode}
+\def\loglinpap{\lp@logxtrue\lp@logyfalse\def\lp@texttwo{log--lin:}\lp@logpap}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\loglogpap}
+% The command |\loglogpap| draws graph paper with logarithmic x- and y-axis.
+% \begin{macrocode}
+\def\loglogpap{\lp@logxtrue\lp@logytrue\def\lp@texttwo{log--log:}\lp@logpap}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\linlogpap}
+% The command |\linlogpap| draws graph paper with linear x-axis and
+% logarithmic y-axis.
+% \begin{macrocode}
+\def\linlogpap{\lp@logxfalse\lp@logytrue\def\lp@texttwo{lin--log:}\lp@logpap}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\linlinpap}
+% The command |\linlinpap| draws graph paper with linear x- and y-axis.
+% \begin{macrocode}
+\def\linlinpap{\lp@logxfalse\lp@logyfalse\def\lp@texttwo{lin--lin:}\lp@logpap}
+% \end{macrocode}
+% \end{macro}
+%
+% ^^A---------------------------------------------
+% \subsection{Config File}
+% The last thing to do is loading the config file if it exists. In this case
+% a message will be typed out.
+% \begin{macrocode}
+\InputIfFileExists{logpap.cfg}%
+ {\typeout{Package logpap Info: Local config file logpap.cfg used}}{}
+% \end{macrocode}
+%
+% \newpage
+% \Finale\endinput
+%</package>
+% ^^A Now the source of the example
+%<*example>
+\documentclass[a4paper]{article}
+\usepackage[latin1]{inputenc}
+\usepackage{logpap}
+
+\voffset-2cm
+\hoffset-0.5cm
+\textheight25cm
+\textwidth14cm
+
+\parindent0pt
+\parskip1ex plus.3ex minus.2ex
+\pagestyle{empty}
+\unitlength1mm
+
+\newcommand*{\lp}{\textsf{logpap}}
+\newcommand*{\bs}{\char '134 }
+\newcommand*{\lb}{\char '173 }
+\newcommand*{\rb}{\char '175 }
+\newcommand*{\param}[1]{\texttt{\textit{#1}}}
+
+\begin{document}
+\centerline{\textbf{\LARGE Some Examples for the \lp\ package.\footnote{The
+source of this example file is part of \texttt{logpap.dtx}.}}}
+
+\vspace{4mm}
+The \lp\ package provides four macros for drawing logarithmic-logarithmic,
+logarithmic-linear, linear-logarithmic and (because it was easy to implement)
+linear-linear graph paper with \LaTeX.
+
+\vspace{2mm}
+\begin{picture}(140,50)
+\LPSet{nofsnx,notwoniney}
+\put( 0, 5){\linlogpap(60mm,12.5mm)(6,1){0,10}{1}[X][Y]}
+\put(75, 5){\linlinpap(60mm,12.5mm)(6,1){0,10}{0,10}[X][Y]}
+\put( 0,32.5){\loglogpap(60mm,12.5mm)(2,1){100m}{1}[X][Y]}
+\put(75,32.5){\loglinpap(60mm,12.5mm)(2,1){100m}{0,10}[X][Y]}
+\end{picture}
+
+\vspace{2mm}
+Altough the \lp\ package only draws logarithmic graph paper, there are
+various things that can be changed. Figure \ref{fig:ov} will give an
+overwiev. Here the first graph paper part where made with the default
+settings and the command
+\verb|\put(0,91){\loglinpap(80mm,10mm)(1,1){1}| \verb|{0}[X-name][Y-name]}|.
+On the right side you can find the commands used to change the appearance.
+
+Not all commands possible are shown here. Every option can be used with
+\verb|\LPSet{|\param{option1}\verb|,| \param{option2}\verb|,...}| within the
+document, every \param{option} has a counterpart \verb|no|\param{option} and
+for every \param{option}\verb|x| also an \param{option}\verb|y| exists. Also
+commands to set the three line widths, colors and the appearance of the $\mu$
+are not shown.
+
+\begin{figure}[ht]
+\centering
+\begin{picture}(140,106)
+\put( 0,91){\loglinpap(80mm,10mm)(1,1){1}{0}[X-name][Y-name]}
+\put(85,96){\makebox(0,0)[cl]{with default settings}}
+
+\LPSet{nodimensions,noticksupright,tenlower}
+\put( 0,69){\loglinpap(80mm,10mm)(1,1){1}{0}[optional][optional]}
+\put(85,78){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb nodimensions,}}}
+\put(85,74){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ noticksupright,}}}
+\put(85,70){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ tenlower\rb}}}
+\LPSet{dimensions,ticksupright,notenlower}
+
+\LPSet{notext,nofsnx}\DefineLPMinLineDist{1.9999mm}
+\put( 0,47){\loglinpap(80mm,10mm)(1,1){1}{0}}
+\put(85,56){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notext,}}}
+\put(85,52){\makebox(0,0)[cl]{\texttt{\ \ \ \ \ \ \ nofsnx\rb}}}
+\put(85,48){\makebox(0,0)[cl]{\texttt{\bs DefineLPMinLineDist\lb 1.9999mm\rb}}}
+\LPSet{text,fsnx}\DefineLPMinLineDist{0.9999mm}
+
+\DefineLPText{new text\quad}\DefineLPLabelFont{\sffamily\tiny}\LPSet{notwoninex}
+\put( 0,25){\loglinpap(80mm,10mm)(1,1){1}{0}}
+\put(85,36){\makebox(0,0)[cl]{\texttt{\bs DefineLPText\lb new text\bs quad\rb}}}
+\put(85,32){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelFont}}}
+\put(85,28){\makebox(0,0)[cl]{\texttt{\ \ \ \ \lb\bs sffamily\bs tiny\rb}}}
+\put(85,24){\makebox(0,0)[cl]{\texttt{\bs LPSet\lb notwoninex\rb}}}
+\DefineLPText{made with \LaTeX\ and \textsf{logpap}\quad}\DefineLPLabelFont{\scriptsize}\LPSet{twoninex}
+
+\DefineLPThickTickLen{1mm}\DefineLPMedTickLen{0.5mm}\DefineLPLabelDist{0.5mm}
+\put( 0, 3){\loglinpap(80mm,10mm)(1,1){1}{0}}
+\put(85,12){\makebox(0,0)[cl]{\texttt{\bs DefineLPThickTickLen\lb 1mm\rb}}}
+\put(85, 8){\makebox(0,0)[cl]{\texttt{\bs DefineLPMedTickLen\lb 0.5mm\rb}}}
+\put(85, 4){\makebox(0,0)[cl]{\texttt{\bs DefineLPLabelDist\lb 0.5mm\rb}}}
+\DefineLPThickTickLen{2mm}\DefineLPMedTickLen{1mm}\DefineLPLabelDist{1mm}
+\end{picture}
+\caption{Overview}\label{fig:ov}
+\end{figure}
+\end{document}
+%</example>
diff --git a/macros/latex/contrib/logpap/logpap.ins b/macros/latex/contrib/logpap/logpap.ins
new file mode 100644
index 0000000000..de64af5a90
--- /dev/null
+++ b/macros/latex/contrib/logpap/logpap.ins
@@ -0,0 +1,67 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright (c) 2004 Mike Kaufmann, all rights reserved
+%%
+%% This program is provided under the terms of the
+%% LaTeX Project Public License distributed from CTAN
+%% archives in directory macros/latex/base/lppl.txt.
+%%
+%% Author: Mike Kaufmann
+%% Mike.Kaufmann@ei.fh-giessen.de
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+
+\input docstrip.tex
+
+% some macros for conditional generation of example files
+\newif\ifaskforexample
+\newif\ifgenerateexample
+\generateexampletrue
+\askforexampletrue
+% \generateexample \askforexample then
+% true false generate example
+% true true ask and generate only if answer is y/yes
+% false don' care do not generate
+\def\generateExample#1{%
+ \ifgenerateexample
+ \ifaskforexample
+ \Ask\answer{^^JThere is an example file in \jobname.dtx.^^JGenerate it? [y/n]}
+ \ifx\answer\y \generate{#1}\else
+ \ifx\answer\yes \generate{#1}\fi\fi
+ \else\generate{#1}\fi\fi}
+
+\preamble
+
+Copyright (c) 2004 Mike Kaufmann, all rights reserved
+
+This program is provided under the terms of the
+LaTeX Project Public License distributed from CTAN
+archives in directory macros/latex/base/lppl.txt.
+
+Author: Mike Kaufmann
+ Mike.Kaufmann@ei.fh-giessen.de
+
+\endpreamble
+
+\generate{\file{logpap.sty}{\from{logpap.dtx}{package}}}
+\generateExample{\file{example.tex}{\from{logpap.dtx}{example}}}
+
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space logpap.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the files ending with}
+\Msg{* `.dtx' through LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{***********************************************************}
+
+
+\endbatchfile