| 1 |
\documentclass{ltxdoc} |
| 2 |
\usepackage{diagnose} |
| 3 |
\title{Installation Diagnostics with\\\texttt{diagnose.sty} version 0.2} |
| 4 |
\author{Oliver Corff\\\texttt{[email protected]}} |
| 5 |
\date{April 10th, 2001} |
| 6 |
|
| 7 |
\begin{document} |
| 8 |
\maketitle |
| 9 |
\tableofcontents |
| 10 |
\section{Introduction} |
| 11 |
|
| 12 |
Large \LaTeXe\ packages with extensive functionality are ideally |
| 13 |
written with the support offered by the \LaTeXe\ installation in |
| 14 |
mind as it does not make sense to reinvent the wheel or copy code |
| 15 |
from other packages. If a package makes use of other packages in |
| 16 |
the system there should be a means to test for the presence of |
| 17 |
the required package, or a required token. |
| 18 |
|
| 19 |
Depending on the result of this test, several situations are |
| 20 |
possible. Either the calling package fails completely, or fails |
| 21 |
to provide the intended service in its full scope, or has to check |
| 22 |
for some alternative. In any case, an informative message should |
| 23 |
be written into the log file and perhaps also into the text document. |
| 24 |
|
| 25 |
\TeX\ and \LaTeXe\ provide basic functionality for testing the |
| 26 |
existence of files and tokens; this package goes a step further |
| 27 |
and provides mechanisms for informing the software and the user |
| 28 |
about a detected condition. |
| 29 |
|
| 30 |
Besides providing a simple mechanism for repeated references to |
| 31 |
the existence of a file or token, |
| 32 |
the other important application is for checking whether a |
| 33 |
complex application can be used immediately after installing or |
| 34 |
whether it requires additional software to be installed. For this |
| 35 |
purpose, \LaTeX\ packages can now be accompanied by a simple text |
| 36 |
document which, when compiled, checks the user's environment and |
| 37 |
makes suggestions about missing software, if necessary. An example |
| 38 |
of this idea is given in the file \texttt{mls-diag.tex}. |
| 39 |
|
| 40 |
\section{The \texttt{diagnose} Package} |
| 41 |
|
| 42 |
The \texttt{diagnose} package is included with the usual |
| 43 |
\begin{verbatim} |
| 44 |
\usepackage{diagnose} |
| 45 |
\end{verbatim} |
| 46 |
statement. There are no options at present. |
| 47 |
The four commands offered are: |
| 48 |
\begin{enumerate} |
| 49 |
\item \texttt{\char92 PackageDiagnostics} |
| 50 |
\item \texttt{\char92 TokenDiagnostics} |
| 51 |
\item \texttt{\char92 TextMessageYes} |
| 52 |
\item \texttt{\char92 TextMessageNo} |
| 53 |
\end{enumerate} |
| 54 |
|
| 55 |
\subsection{\texttt{\char92 PackageDiagnostics}} |
| 56 |
|
| 57 |
\begin{verbatim} |
| 58 |
\PackageDiagnostics{} % Tested package |
| 59 |
{} % Associated counter |
| 60 |
{} % message if file available |
| 61 |
{} % message if file not available |
| 62 |
\end{verbatim} |
| 63 |
|
| 64 |
This command verifies whether a file is available within the \TeX\ |
| 65 |
directory structure. It is based on the \LaTeXe\ command |
| 66 |
\texttt{\char92 IfFileExists\{\}} and offers the possibility to |
| 67 |
create a counter which is associated with the existence of the |
| 68 |
requested file. The counter can then be used throughout the software |
| 69 |
without additional calls of \texttt{\char92 IfFileExists\{\}}. |
| 70 |
Two message texts can be given; one will be printed if the file |
| 71 |
exists, the other will be printed if the file is absent. |
| 72 |
|
| 73 |
By default the message texts appear in the log file and the terminal |
| 74 |
output of the running caller program; additionally it is possible to |
| 75 |
have the messages appear in the output text of the document. |
| 76 |
|
| 77 |
\subsection{\texttt{\char92 TokenDiagnostics}} |
| 78 |
|
| 79 |
\begin{verbatim} |
| 80 |
\TokenDiagnostics{} % Tested token |
| 81 |
{} % Associated counter |
| 82 |
{} % message if token available |
| 83 |
{} % message if token not available |
| 84 |
\end{verbatim} |
| 85 |
|
| 86 |
This command verifies whether a token (a command sequence, etc.) |
| 87 |
is known to the system. Like \texttt{\char92 PackageDiagnostics} |
| 88 |
it accepts an associated counter and two message texts as arguments. |
| 89 |
|
| 90 |
\subsection{\texttt{\char92 TextMessageYes}} |
| 91 |
|
| 92 |
By default, messages generated by the two diagnostics commands |
| 93 |
appear only in terminal output and log files. If the messages shall |
| 94 |
also be displayed in the output text then the command |
| 95 |
\begin{verbatim} |
| 96 |
\TextMessageYes |
| 97 |
\end{verbatim} |
| 98 |
is to be used. It is not followed by any argument. By default, |
| 99 |
message texts do not appear in the output text, only in log files |
| 100 |
and terminal output. |
| 101 |
|
| 102 |
\subsection{\texttt{\char92 TextMessageNo}} |
| 103 |
|
| 104 |
If output of diagnostics messages to the main text had been enabled |
| 105 |
before, it can be disabled with the command |
| 106 |
\begin{verbatim} |
| 107 |
\TextMessageNo |
| 108 |
\end{verbatim} |
| 109 |
which happens to be the default of the diagnostics package. |
| 110 |
|
| 111 |
\section{Examples} |
| 112 |
|
| 113 |
Two examples are given here. First the usage of the package |
| 114 |
diagnostics command is shown, and, in a separate file, the |
| 115 |
reader is invited to compile the accompanying document |
| 116 |
\texttt{mls-diag.tex} which shows a real-life application of |
| 117 |
\texttt{diagnose.sty}. |
| 118 |
|
| 119 |
\begin{verbatim} |
| 120 |
\PackageDiagnostics{rotating.sty} % Tested package |
| 121 |
{RotatingAvailable} % Associated counter |
| 122 |
{Vertical text possible!} % message if file available |
| 123 |
{rotating.sty not found, no vertical text!} % message if not |
| 124 |
|
| 125 |
\ifnum\theRotatingAvailable=1 |
| 126 |
You can use vertical text in your documents. No further |
| 127 |
measure is required. |
| 128 |
\else |
| 129 |
Without the \texttt{rotating.sty} package vertical text |
| 130 |
cannot be typeset. If you need this option, then access |
| 131 |
CTAN and install \texttt{rotating.sty} on your system. |
| 132 |
Make sure you can process PostScript output. |
| 133 |
\fi |
| 134 |
\end{verbatim} |
| 135 |
|
| 136 |
The actual output of this command sequence will depend on the |
| 137 |
presence of \texttt{rotating.sty} on the system where this source |
| 138 |
file is compiled: |
| 139 |
\begin{quote} |
| 140 |
\PackageDiagnostics{rotating.sty} % Tested package |
| 141 |
{RotatingAvailable} % Associated counter |
| 142 |
{Vertical text possible!} % message if file available |
| 143 |
{rotating.sty not found, no vertical text!} % message if not |
| 144 |
|
| 145 |
\ifnum\theRotatingAvailable=1 |
| 146 |
You can use vertical text in your documents. No further |
| 147 |
measure is required. |
| 148 |
\else |
| 149 |
Without the \texttt{rotating.sty} package vertical text |
| 150 |
cannot be typeset. If you need this option, then access |
| 151 |
CTAN and install \texttt{rotating.sty} on your system. |
| 152 |
Make sure you can process PostScript output. |
| 153 |
\fi |
| 154 |
\end{quote} |
| 155 |
|
| 156 |
You can also see that the log file and the terminal output contain |
| 157 |
the appropriate message. |
| 158 |
|
| 159 |
\section{Legal Status} |
| 160 |
|
| 161 |
This software is placed under the GPL. Usual disclaimers apply. |
| 162 |
|
| 163 |
As this software tool is still under development, suggestions on how |
| 164 |
to improve the usability and versatility of this package are highly |
| 165 |
appreciated. |
| 166 |
\end{document} |