Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 % !TeX spellcheck = en-US
3 %
4 % File: doctools.sty
5 % Version: 2014/06/27 v0.1
6 % Author: Matthias Pospiech
7 % Email: <[email protected]>
8 %
9 % Copyright (C) 2012 by Matthias Pospiech ([email protected])
10 % ---------------------------------------------------------------------------
11 % This work may be distributed and/or modified under the
12 % conditions of the LaTeX Project Public License, either version 1.3
13 % of this license or (at your option) any later version.
14 % The latest version of this license is in
15 % http://www.latex-project.org/lppl.txt
16 % and version 1.3 or later is part of all distributions of LaTeX
17 % version 2005/12/01 or later.
18 %
19 % This work has the LPPL maintenance status `maintained'.
20 %
21 % The Current Maintainer of this work is Matthias Pospiech.
22 %
23 % This work consists of the files doctools.dtx and doctools.ins
24 % and the derived filebase doctools.sty.
25 %
26 % \fi
27 % \iffalse
28 %<*driver>
29 \ProvidesFile{doctools.dtx}
30 %</driver>
31 %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
32 %<package>\ProvidesPackage{doctools}
33 %<*package>
34 [2014/06/27 v0.1 commands and packages for documenting LaTeX Code]
35 %</package>
36 %
37 %<*driver>
38 \documentclass{ltxdoc}
39 \usepackage{hypdoc}
40 \RequirePackage[%
41 loadHyperref=true,%
42 createIndexEntries=false,%
43 applyLayout=true%
44 ]{doctools} %
45 \usepackage{lmodern}
46 %
47 %%% Configures doc.sty and its (outdated) index generation, which does
48 % not work together with any modern package and has no hyperref support
49 % and thus no links. Furthermore it conflicts with the index macros
50 % of doctools.
51 %
52 \EnableCrossrefs % (default) Every new macro name used within a macrocode or
53 % macrocode∗ environment will produce an index entry.
54 % \DisableCrossrefs % turn off this feature
55 %
56 % If an index is created is determined by the use of the following
57 % declarations in the driver file preamble; if neither is used, no index is
58 % produced.
59 \PageIndex % all index entries refer to their page number
60 % \CodelineIndex % index entries produced by \DescribeMacro and \DescribeEnv
61 % refer to page number but those produced by the macro
62 % environment refer to the code lines,
63 % which will be numbered automatically.
64 % \CodelineNumbered % no index is created, but the code lines are numbered
65
66 \RecordChanges
67 \listfiles
68 %
69 \begin{document}
70 \DocInput{doctools.dtx}
71 \PrintChanges
72 \PrintIndex
73 \end{document}
74 %</driver>
75 % \fi
76 %
77 %
78 % \CharacterTable
79 % {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
80 % 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
81 % Digits \0\1\2\3\4\5\6\7\8\9
82 % Exclamation \! Double quote \" Hash (number) \#
83 % Dollar \$ Percent \% Ampersand \&
84 % Acute accent \' Left paren \( Right paren \)
85 % Asterisk \* Plus \+ Comma \,
86 % Minus \- Point \. Solidus \/
87 % Colon \: Semicolon \; Less than \<
88 % Equals \= Greater than \> Question mark \?
89 % Commercial at \@ Left bracket \[ Backslash \\
90 % Right bracket \] Circumflex \^ Underscore \_
91 % Grave accent \` Left brace \{ Vertical bar \|
92 % Right brace \} Tilde \~}
93 %
94 % \CheckSum{0}
95 %
96 % \changes{v0.1}{2012/12/01}{initial version (converted to dtx file)}
97 %
98 % \DoNotIndex{\newcommand,\newenvironment,\@bsphack,\@empty,\@esphack,\addtocounter,\arraystretch,\bs,\color,\colorlet,\else,\end,\expandafter,\fi,\hyperref,\ifcsdef,\ifstrempty,\ifx,\index,\label,\langle,\let,\linewidth,\lstinputlisting,\makeatletter,\makeatother,\NeedsTeXFormat,\newcounter,\noindent,\normalfont,\option,\par,\parindent,\parskip,\phantomsection,\PrintDescribeEnv,\PrintDescribeMacro,\PrintEnvName,\PrintMacroName,\ProcessKeyvalOptions,\providecommand,\ProvidesPackage,\rangle,\refstepcounter,\renewcommand,\RequirePackage,\setcounter,\setlength,\slshape,\small,\string,\strut,\textbackslash,\textsc,\texttt,\ttfamily,\urlstyle,\usepackage,\xspace}
99 %
100 % \providecommand*{\url}{\texttt}
101 % \GetFileInfo{doctools.dtx}
102 % \title{The \textsf{doctools} package}
103 % \author{Matthias Pospiech \\ \url{[email protected]}}
104 % \date{0.1~from 2014/06/27}
105 %
106 % \maketitle
107 % \tableofcontents
108 % ^^A ===================================================================
109 % \section{Documentation}
110 % This package is a collections of tools for the documentation of \latex code
111 % either in a normal document or within a dtx file.
112 % \StopEventually{}
113 %
114 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115 % \subsection{Options}
116 % This package has three options
117 % \begin{Optionlist}
118 % \option{applyLayout} & true/false (default: false) \\
119 % \option{loadHyperref} & true/false (default: false) \\
120 % \option{createIndexEntries} & true/false (default: true) \\
121 % \end{Optionlist}
122 %
123 % The option \option{applyLayout} should only be used in dtx files for which
124 % the layout of this package shall be applied. For normal documents setting
125 % this option to true could disturb the layout.
126 %
127 % The selection of the other two options (\option{loadHyperref},
128 % \option{createIndexEntries}) should follow the following principles, which
129 % are mostly related to the fact that doc.sty does not support package
130 % \package{hyperref} (prohibits display of index entries) and requires
131 % the package \package{hypdoc} instead.
132 %
133 % Package \package{doctools} is typically loaded before most other packages
134 % and in the case of a dtx file possible the only package which
135 % is necessary to load.
136 %
137 % \subsubsection{Selection of options inside a dtx file}
138 % In a dtx file index entries are created by the package \package{doc.sty}
139 % which have a format the requires the use of the format file
140 % \texttt{gind.ist} for makeindex:
141 %
142 % \iffalse
143 %<*example>
144 % \fi
145 \begin{lstlisting}[]
146 makeindex.exe -s gind.ist filename.idx
147 \end{lstlisting}
148 % \iffalse
149 %</example>
150 % \fi
151 %
152 % The index entries by \package{doc.sty} are created if \cs{PageIndex} or
153 % \cs{CodelineIndex} are defined except if \cs{CodelineNumbered} is defined.
154 % With the last definition no index is created, but the code lines are still
155 % numbered. In this case \package{hyperref} has no
156 % influence on the index creation since the index is never created:
157 %
158 % \iffalse
159 %<*example>
160 % \fi
161 \begin{lstlisting}[style=lstDocStyleBase]
162 \CodelineNumbered
163 \usepackage[
164 loadHyperref=true,%
165 createIndexEntries=false% (has no influence)
166 ]{doctools} %
167 \end{lstlisting}
168 % \iffalse
169 %</example>
170 % \fi
171 %
172 % If in contrast the index entries of \package{doc.sty} are activated using \cs{PageIndex} or \cs{CodelineIndex}, then \package{hyperref} should not be loaded because it prohibits the display of the index entries created by \package{doc.sty}. Furthermore the index entries of \package{doctools} should be disabled because they use a different format and would be displayed wrong.
173 %
174 % \iffalse
175 %<*example>
176 % \fi
177 \begin{lstlisting}[style=lstDocStyleBase]
178 \PageIndex
179 \usepackage[
180 loadHyperref=false,% (would prohibit doc.sty index entries)
181 createIndexEntries=false% (would be displayed wrong)
182 ]{doctools} %
183 \usepackage{hypdoc}
184 \end{lstlisting}
185 % \iffalse
186 %</example>
187 % \fi
188 % If the index entries of \package{doc.sty} are supposed to be displayed with hyperlinks the package \package{hypdoc} must be loaded instead\footnote{This issue is explained very well in this thread: \url{http://tex.stackexchange.com/questions/87670/disable-index-creation-in-dtx-file}}. If the option \option{loadHyperref} is used all styles are applied although \package{hyperref} is not loaded, because it is already loaded by the package \package{hypdoc}. Take care of the loading order: \package{hypdoc} must be loaded before \package{doctools}.
189 %
190 % \iffalse
191 %<*example>
192 % \fi
193 \begin{lstlisting}[style=lstDocStyleBase]
194 \PageIndex
195 \usepackage{hypdoc} % load before doctools !
196 \usepackage[
197 loadHyperref=true,% apply hyperref styles
198 createIndexEntries=false% (would be displayed wrong)
199 ]{doctools} %
200 \end{lstlisting}
201 % \iffalse
202 %</example>
203 % \fi
204 %
205 % However, if only the index entries of \package{doctools.sty} are supposed to be displayed in the index, this can be realized by loading \package{hyperref}. In this case the format file for \texttt{makeindex} must not be specified.
206 %
207 % \iffalse
208 %<*example>
209 % \fi
210 \begin{lstlisting}[style=lstDocStyleBase]
211 \PageIndex % creates index, but entries are not displayed
212 \usepackage[
213 loadHyperref=true,% (prohibit doc.sty index entries)
214 createIndexEntries=true%
215 ]{doctools} %
216 \end{lstlisting}
217 % \iffalse
218 %</example>
219 % \fi
220 %
221 % \subsubsection{Selection of options in a normal \latex file}
222 % In a normal \latex file that does not load \package{doc.sty} the package options may be selected according to the needs of the user. If both index entries shall be created and \package{hyperref} can be safely loaded one could load the package with these options:
223 %
224 % \iffalse
225 %<*example>
226 % \fi
227 \begin{lstlisting}[style=lstDocStyleBase]
228 \usepackage[
229 loadHyperref=true,%
230 createIndexEntries=true%
231 ]{doctools} %
232 \end{lstlisting}
233 % \iffalse
234 %</example>
235 % \fi
236 %
237 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
238 % \subsection{Commands provided by doc.sty and ltxdoc}
239 % For the complete reference refer to \url{doc.pdf} and \url{ltxdoc.pdf}. Here % only the most relevant commands for the code in the documentation part are
240 % described.
241 %
242 % \DescribeMacro{\DescribeMacro} \marg{macro} \AfterLastParam
243 % Prints out the macro name in the margin and
244 % adds the command to the index. It primary usage is to indicate the part of
245 % the documentation where the usage of this macro is described.
246 %
247 % \DescribeMacro{\DescribeEnv} \marg{environment} \AfterLastParam
248 % Is used analogues to \cs{DescribeMacro}.
249 %
250 % \DescribeMacro{\marg} \marg{argument} \AfterLastParam
251 % Mandatory argument, printed as \marg{argument}
252 %
253 % \DescribeMacro{\oarg} \marg{argument} \AfterLastParam
254 % Optional argument, printed as \oarg{argument}
255 %
256 % \DescribeMacro{\meta} Both \cs{marg} and \cs{oarg} use \cs{meta}
257 % to print out the argument as \meta{argument}.
258 %
259 % If \package{ltxdoc} is not used both \cs{marg} and \cs{oarg} are instead
260 % defined by \package{doctools}.
261 %
262 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
263 % \subsection{Commands provided by doctools.sty}
264 %
265 % \DescribeMacro{\bs} Shortcut for \cs{textbackslash}.
266 %
267 % \DescribeMacro{\command} \marg{cmd} \AfterLastParam
268 % Prints out the argument \cs{command}\arg{foo} as \cs{foo}.
269 %
270 % \DescribeMacro{\cs} \marg{cmd} \AfterLastParam
271 % Shortcut for \cs{command}. Also defined by \ltxclass{ltxdoc}.
272 %
273 % \DescribeMacro{\arg} \marg{cmd} \AfterLastParam
274 % Prints out an argument in curled brackets without the use of
275 % angle brackets as in \cs{marg} or \cs{oarg}.
276 % Thus prints \cs{arg}\arg{foo} as \arg{foo}.
277 %
278 % \DescribeMacro{\environment} \marg{environment} \AfterLastParam
279 % Prints out an environment name as \environment{environment}.
280 %
281 % \DescribeMacro{\env} \marg{environment} \AfterLastParam
282 % Shortcut for \cs{environment}
283 %
284 % \DescribeMacro{\package} \marg{package} \AfterLastParam
285 % Prints out a package name as \package{package}.
286 %
287 % \DescribeMacro{\ltxclass} \marg{LaTeX documentclass} \AfterLastParam
288 % Prints out a class name as \ltxclass{class}.
289 %
290 % \DescribeMacro{\option} \marg{option} \AfterLastParam
291 % Prints out an option as \option{option}.
292 %
293 % \DescribeMacro{\parameter} \marg{parameter} \AfterLastParam
294 % Prints out an option as \parameter{parameter}.
295 %
296 % \DescribeMacro{\person} \marg{person} \AfterLastParam
297 % Print out name of a person, for example for the acknowledge
298 % of their help during the development of some code.
299 % \Example{\normalfont This package was written by
300 % \person{Matthias Pospiech}.}
301 %
302 % \DescribeMacro{\AfterLastParam}
303 % Used in conjuction with \cs{DescribeMacro} and the printout of arguments
304 % using \cs{marg} or \cs{oarg}. \cs{AfterLastParam} is inserted at the end
305 % to begin a new line.
306 % \Example{\cs{DescribeMacro}\arg{foo}\cs{marg}\arg{argument}
307 % \cs{AfterLastParam}}
308 %
309 % \DescribeMacro{\Default}
310 % \cs{Default} is used to print out the default value of a command.
311 %
312 % \DescribeMacro{\Example}
313 % \cs{Example} is used to print out an example for the usage of a command. % See documentation of \cs{AfterLastParam} for an example.
314 %
315 % \DescribeMacro{\latex} New lower case command for printing out \latex.
316 %
317 % \DescribeEnv{Optionlist} Table to print out all possible options
318 % of a command. See the following code for an example.
319 %
320 % \iffalse
321 %<*example>
322 % \fi
323 \begin{latexcode}
324 \begin{Optionlist}
325 top & placement is on top \\
326 bottom & placement is at the bottom\\
327 \end{Optionlist}
328 \end{latexcode}
329 % \iffalse
330 %</example>
331 % \fi
332 % Output:
333 % \begin{Optionlist}
334 % top & placement is on top \\
335 % bottom & placement is at the bottom\\
336 % \end{Optionlist}
337 %
338 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
339 % \subsection{Printing of \latex code}
340 %
341 % This package provides two \package{listings} styles for the printing of
342 % \latex code: \textsl{lstDemoStyleLaTeXCode} and
343 % \textsl{lstDocStyleLaTeXCode}. The first is meant for printing of code
344 % examples, the latter only to be used inside a dtx file for the documentation
345 % of the package code.
346 %
347 % For convenience these style are provided with the following environments.
348 %
349 % \DescribeEnv{latexcode} Listings environment for code examples. The output of this style is shown in the example below. The lines are not numbered, so that the code can be directly copied from the PDF document.
350 %
351 % \iffalse
352 %<*example>
353 % \fi
354 \begin{lstlisting}[style=lstDemoStyleLaTeXCode]
355 \begin{latexcode}
356 % comment
357 Example Code \ldots
358 \end{latexcode}
359 \end{lstlisting}
360 % \iffalse
361 %</example>
362 % \fi
363 %
364 % In the case of a dtx file this must be wrapped in special dtx code as shown % in the following code.
365 %
366 % \iffalse
367 %<*example>
368 % \fi
369 \begin{lstlisting}[style=lstDemoStyleLaTeXCode]
370 % \iffalse
371 %<*example>
372 % \fi
373 \begin{latexcode}
374 Example Code \ldots
375 \end{latexcode}
376 % \iffalse
377 %</example>
378 % \fi
379 \end{lstlisting}
380 % \iffalse
381 %</example>
382 % \fi
383 %
384 % \DescribeEnv{macrocode} is in contrast an environment for the code in a dtx file, which is used for the creation of a latex package or class. In a dtx file therefore the special comment and indentation of the environment must be taken care of. The following example is displayed with this style.
385 % \iffalse
386 %<*example>
387 % \fi
388 \begin{lstlisting}[style=lstDocStyleLaTeXCode]
389 % \begin{macrocode}
390 % definition of foobar
391 \newcommand{\foobar}{foo-bar}
392 % \end{macrocode}
393 \end{lstlisting}
394 % \iffalse
395 %</example>
396 % \fi
397 %
398 % \DescribeMacro{\printCodeFromFile}
399 % \oarg{first line} \marg{last line} \marg{file name} \AfterLastParam
400 % This command is very helpful to display parts of a file sequentially.
401 % If the first line is not given the last line value is incremented by one
402 % and used as the first line.
403 % \Example{\cs{printCodeFromFile}[3]\arg{6}\arg{LaTeXTemplate.tex}}
404 %
405 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406 % \subsection{Label Link system for files and their usage}
407 % The system explained in this section allows to adds a hyperlink to sections
408 % where a file is discussed and adds the usage page to the index. The code
409 % is very close to the label/ref system as shown in the following example:
410 %
411 % \iffalse
412 %<*example>
413 % \fi
414 \begin{latexcode}
415 \section{about links in pdf}
416 The code is in \file{preamble/hyperref.tex}
417 \dots
418 \section{preamble/hyperref.tex}
419 \labelfile{preamble/hyperref.tex}
420 \end{latexcode}
421 % \iffalse
422 %</example>
423 % \fi
424 %
425 % \DescribeMacro{\labelfile} \marg{filepath/filename.tex} \AfterLastParam
426 % Creates a label that is used by \cs{file} for linking to the
427 % occurrence of \cs{labelfile}.
428 % Furthermore an index entry is created with a new sub-index for every path.
429 % In the case of \cs{labelfile}\arg{preamble/hyperref.tex} this would look
430 % like:
431 % \iffalse
432 %<*example>
433 % \fi
434 \begin{lstlisting}
435 Files
436 preamble
437 hyperref.tex
438 \end{lstlisting}
439 % \iffalse
440 %</example>
441 % \fi
442 %
443 % \DescribeMacro{\file} \marg{filepath/filename.tex} \AfterLastParam
444 % Prints out the filename in typewriter font and links to the usage if an
445 % equivalent \cs{labelfile} is given.
446 %
447 % ^^A =====================================================================
448 % \section{Implementation}
449 %
450 % \iffalse
451 %<*doctools.sty>
452 % \fi
453 %
454 % \begin{macrocode}
455 \NeedsTeXFormat{LaTeX2e}
456 \ProvidesPackage{doctools}[2012/12/01 v0.1 commands and packages for documenting LaTeX Code]
457 % \end{macrocode}
458 %
459 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
460 % \subsection{Define keys}
461 %
462 % \begin{macrocode}
463 %%% === Define Keys ===================================
464 \RequirePackage{kvoptions-patch}
465 \RequirePackage{kvoptions} % options
466 \RequirePackage{pdftexcmds} % string comparison
467 \SetupKeyvalOptions{family=doctools,prefix=doctools@}
468 % \end{macrocode}
469 % Define default option for style key: \emph{stacked}
470 % \begin{macrocode}
471 \DeclareBoolOption[false]{loadHyperref}
472 \DeclareBoolOption[true]{createIndexEntries}
473 \DeclareBoolOption[false]{applyLayout}
474 \ProcessKeyvalOptions{doctools}
475 % \end{macrocode}
476 %
477 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
478 % \subsection{Preamble}
479 % \subsubsection{Packages}
480 % Most package are loaded at the beginning of the document to avoid clashes
481 % with other packages and make a correct loading order possible. Since the
482 % packages are only available at the end of the preamble, all commands
483 % defined by this package are also only available at the end of the preamble.
484 % \begin{macrocode}
485 %%% ---- Packages ----
486 %%% Programming
487 \usepackage{etoolbox}
488 \usepackage{xstring}
489 \usepackage{kvsetkeys}
490 %%% Font packages
491 \ifdoctools@applyLayout
492 \usepackage{cmap}
493 \usepackage[T1]{fontenc} % T1 Schrift Encoding
494 %\usepackage{lmodern} % Font not loaded, because this can lead
495 % % to incompatibilities with other math fonts
496 \usepackage{textcomp}
497 \fi % end \ifdoctools@applyLayout
498 %%% listings (must be loaded before \AtBeginDocument)
499 \@ifpackageloaded{listings}{}{\RequirePackage{listings}}
500 %%% load all further packages and all commands
501 %%% at the beginning of the document and thus
502 %%% after all other packages
503 \PassOptionsToPackage{table}{xcolor}
504 \AtBeginDocument{%
505 %%
506 %%% Additional packages
507 \usepackage{xspace}
508 \@ifpackageloaded{xcolor}{}
509 {\usepackage{xcolor}}
510 %%% listings
511 \colorlet{doc@stringcolor}{green!40!black!100}
512 \colorlet{doc@commentcolor}{green!50!black!100}
513 \colorlet{doc@numbercolor}{white!50!black!100}
514 \definecolor{doc@keywordcolor}{rgb}{0,0.35,1.0}
515 \colorlet{doc@demo@backcolor}{white}
516 \definecolor{doc@rulecolor}{rgb}{0.5,0.5,0.5}
517 %
518 \lstdefinestyle{lstStyleDefault}{
519 %%% appearance
520 ,basicstyle=\small\ttfamily % Standardschrift
521 %%% Space and placement
522 ,floatplacement=tbp % is used as float place specifier
523 ,aboveskip=\medskipamount % define the space above and
524 ,belowskip=\medskipamount % below displayed listings.
525 ,lineskip=0pt % specifies additional space between lines in listings.
526 ,boxpos=c % c,b,t
527 %%% The printed range
528 ,showlines=false % prints empty lines at the end of listings
529 %%% characters
530 ,extendedchars=true % allows or prohibits extended characters
531 % in listings, that means (national)
532 % characters of codes 128-255.
533 ,upquote=true % determines printing of quotes
534 ,tabsize=2, % chars of tab
535 ,showtabs=false % do not show tabs
536 ,showspaces=false % do not show spaces
537 ,showstringspaces=false % do not show blank spaces in string
538 %%% Line numbers
539 ,numbers=none % left, right, none
540 %%% Captions
541 ,numberbychapter=true %
542 ,captionpos=b % t,b
543 ,abovecaptionskip=\smallskipamount % the vertical space respectively above
544 ,belowcaptionskip=\smallskipamount % or below each caption
545 %%% Margins and line shape
546 ,linewidth=\linewidth % defines the base line width for listings.
547 ,xleftmargin=0pt % extra margins
548 ,xrightmargin=0pt %
549 ,resetmargins=false % indention from list environments like enumerate
550 % or itemize is reset, i.e. not used.
551 ,breaklines=true % line breaking of long lines.
552 ,breakatwhitespace=false % allows line breaks only at white space.
553 ,breakindent=0pt % is the indention of the second, third, ...
554 % line of broken lines.
555 ,breakautoindent=true % apply intendation
556 ,columns=flexible %
557 ,keepspaces=true %
558 }
559
560 \lstset{style=lstStyleDefault}
561
562 \lstdefinestyle{lstDocStyleBase}{
563 %%% base style
564 ,style=lstStyleDefault
565 %%% appearance
566 ,commentstyle=\slshape
567 %%% Line numbers
568 ,numbers=left % left, right, none
569 ,stepnumber=1 % seperation between numbers
570 ,numberfirstline=false % number first line always
571 ,numberstyle=\tiny\color{doc@numbercolor} % style of numbers
572 ,numbersep=5pt % distance to text
573 ,numberblanklines=true %
574 %%% language
575 ,language = [LaTeX]TeX
576 %%% commands
577 % LaTeX programming
578 ,moretexcs={setlength,usepackage,newcommand,renewcommand,providecommand,RequirePackage,SelectInputMappings,ifpdftex,ifpdfoutput,AtBeginEnvironment,ProvidesPackage},
579 % other commands
580 ,moretexcs={maketitle,text,includegraphics,chapter,section,subsection,
581 subsubsection,paragraph,textmu,enquote,blockquote,ding,mathds,ifcsdef,Bra,Ket,Braket,subcaption,lettrine,mdfsetup,captionof,listoffigures,listoftables,tableofcontents,appendix}
582 % tables
583 ,moretexcs={newcolumntype,rowfont,taburowcolors,rowcolor,rowcolors,bottomrule,
584 toprule,midrule,}
585 % hyperref
586 ,moretexcs={hypersetup}
587 % glossaries
588 ,moretexcs={gls,printglossary,glsadd,newglossaryentry,newacronym}
589 % Koma
590 ,moretexcs={mainmatter,frontmatter,geometry,KOMAoptions,setkomafont,addtokomafont}
591 % SI, unit
592 ,moretexcs={si,SI,sisetup,unit,unitfrac,micro}
593 % biblatex package
594 ,moretexcs={newblock,ExecuteBibliographyOptions,addbibresource}
595 % math packages
596 ,moretexcs={operatorname,frac,sfrac,dfrac,DeclareMathOperator,mathcal,underset}
597 % demo package
598 ,moretexcs={democodefile,package,cs,command,env,DemoError,PrintDemo}
599 % tablestyles
600 ,moretexcs={theadstart,tbody,tsubheadstart,tsubhead,tend}
601 % code section package
602 ,moretexcs={DefineCodeSection,SetCodeSection,BeginCodeSection,
603 EndCodeSection}
604 % template tools package
605 ,moretexcs={IfDefined,IfUndefined,IfElseDefined,IfElseUndefined,IfMultDefined,IfNotDraft,IfNotDraftElse,IfDraft,IfPackageLoaded,IfElsePackageLoaded,IfPackageNotLoaded,IfPackagesLoaded,IfPackagesNotLoaded,ExecuteAfterPackage,ExecuteBeforePackage,IfTikzLibraryLoaded,IfColumntypeDefined,IfColumntypesDefined,IfColorDefined,IfColorsDefined,IfMathVersionDefined,SetTemplateDefinition,UseDefinition,IfFileExists,iflanguage}
606 % tablestyles
607 ,moretexcs={setuptablefontsize,tablefontsize,setuptablestyle,tablestyle, setuptablecolor,tablecolor,disablealternatecolors, tablealtcolored,tbegin,tbody,tend,thead, theadstart,tsubheadstart,tsubhead,theadrow,tsubheadrow,resettablestyle,theadend,tsubheadend,tableitemize,PreserveBackslash}
608 % todonotes
609 ,moretexcs={todo,missingfigure}
610 % listings
611 ,moretexcs={lstloadlanguages,lstdefinestyle,lstset}
612 % index
613 ,moretexcs={indexsetup}
614 % glossaries
615 ,moretexcs={newglossarystyle,glossarystyle,deftranslation,newglossary}
616 % tikz
617 ,moretexcs={usetikzlibrary}
618 % color
619 ,moretexcs={definecolor,colorlet}
620 % caption
621 ,moretexcs={captionsetup,DeclareCaptionStyle}
622 % floatrow
623 ,moretexcs={floatsetup}
624 % doc.sty
625 ,moretexcs={EnableCrossrefs,DisableCrossrefs,PageIndex,CodelineIndex,CodelineNumbered}
626 % refereces
627 ,moretexcs={cref,Cref,vref,eqnref,figref,tabref,secref,chapref}
628 }
629
630 \lstdefinestyle{lstDemoStyleLaTeXCode}{ %
631 %%% base style
632 ,style=lstDocStyleBase
633 %%% Line numbers
634 ,numbers=none % left, right, none
635 %%% colors
636 ,stringstyle=\color{doc@stringcolor}
637 ,keywordstyle=\color{doc@keywordcolor}
638 ,commentstyle=\color{doc@commentcolor}
639 ,backgroundcolor=\color{doc@demo@backcolor}
640 ,rulecolor=\color{doc@rulecolor}
641 %%% frame
642 ,frame=single % none, leftline, topline, bottomline, lines
643 % single, shadowbox
644 ,framesep=3pt
645 ,rulesep=2pt % control the space between frame and listing
646 % and between double rules.
647 ,framerule=0.4pt % controls the width of the rules.
648 }
649
650 \colorlet{doc@code@backcolor}{gray!5}
651 \colorlet{doc@code@keywordcolor}{black}
652 \colorlet{doc@code@commentcolor}{black!60}
653
654 \lstdefinestyle{lstDocStyleLaTeXCode}{%
655 %%% base style
656 ,style=lstDocStyleBase
657 %%% colors
658 ,stringstyle=\color{doc@stringcolor}
659 ,keywordstyle=\color{doc@code@keywordcolor} %
660 ,commentstyle=\color{doc@code@commentcolor}
661 ,backgroundcolor=\color{doc@code@backcolor}
662 ,rulecolor=\color{doc@rulecolor}
663 %%% frame
664 ,frame=none % none, leftline, topline, bottomline, lines
665 % single, shadowbox
666 ,framesep=3pt
667 ,rulesep=2pt % control the space between frame and listing
668 % and between double rules.
669 ,framerule=0.4pt % controls the width of the rules.
670 %%% numbers
671 ,firstnumber=last
672 }
673
674 \lstloadlanguages{[LaTeX]TeX}
675 %%% hyperref
676 \ifdoctools@loadHyperref
677 \makeatletter
678 \@ifpackageloaded{hyperref}{}
679 % load hyperref only if package
680 % hypdoc is not loaded, which
681 % loads hyperref itself
682 {\usepackage[
683 ,backref=page%
684 ,pagebackref=false%
685 ,hyperindex=true%
686 ,hyperfootnotes=false%
687 ,bookmarks=true%
688 ,pdfpagelabels=true%
689 ]{hyperref}}
690 \makeatother
691 %
692 \usepackage[]{bookmark}
693 %
694 \definecolor{pdfanchorcolor}{named}{black}
695 \definecolor{pdfmenucolor}{named}{red}
696 \definecolor{pdfruncolor}{named}{cyan}
697 \definecolor{pdfurlcolor}{rgb}{0,0,0.6}
698 \definecolor{pdffilecolor}{rgb}{0.7,0,0}
699 \definecolor{pdflinkcolor}{rgb}{0,0,0.6}
700 \definecolor{pdfcitecolor}{rgb}{0,0,0.6}
701 %
702 \hypersetup{
703 ,draft=false, % all hypertext options are turned off
704 ,final=true % all hypertext options are turned on
705 ,debug=false % extra diagnostic messages are printed in the log file
706 ,hypertexnames=true % use guessable names for links
707 ,naturalnames=false % use LATEX-computed names for links
708 ,setpagesize=true % sets page size by special driver commands
709 ,raiselinks=true % forces commands to reflect the real height of the link
710 ,breaklinks=true % Allows link text to break across lines
711 ,pageanchor=true % Determines whether every page is given an implicit
712 ,plainpages=false % Forces page anchors to be named by the arabic
713 ,linktocpage=true % make page number, not text, be link on TOC, LOF and LOT
714 ,colorlinks=true % Colors the text of links and anchors.
715 ,linkcolor =pdflinkcolor % Color for normal internal links.
716 ,anchorcolor=pdfanchorcolor % Color for anchor text.
717 ,citecolor =pdfcitecolor % Color for bibliographical citations in text.
718 ,filecolor =pdffilecolor % Color for URLs which open local files.
719 ,menucolor =pdfmenucolor % Color for Acrobat menu items.
720 ,runcolor =pdfruncolor % Color for run links (launch annotations).
721 ,urlcolor =pdfurlcolor % color magenta Color for linked URLs.
722 ,bookmarksopen=true % If Acrobat bookmarks are requested, show them
723 ,bookmarksopenlevel=2 % level (\maxdimen) to which bookmarks are open
724 ,bookmarksnumbered=true %
725 ,bookmarkstype=toc %
726 ,pdfpagemode=UseOutlines %
727 ,pdfstartpage=1 % Determines on which page the PDF file is opened.
728 ,pdfstartview=FitH % Set the startup page view
729 ,pdfremotestartview=Fit % Set the startup page view of remote PDF files
730 ,pdfcenterwindow=false %
731 ,pdffitwindow=false % resize document window to fit document size
732 ,pdfnewwindow=false % make links that open another PDF file
733 ,pdfdisplaydoctitle=true % display document title instead of file name
734 } % end: hypersetup
735 %
736 \fi % end \ifdoctools@loadHyperref
737 % \end{macrocode}
738 %
739 % \subsubsection{color setup}
740 %
741 % \begin{macrocode}
742 %%% color setup
743 % table colors
744 \ifcsdef{colorlet}{%
745 \colorlet{tablebodycolor}{white!100}
746 \colorlet{tablerowcolor}{gray!10}
747 \colorlet{tableheadcolor}{gray!25}
748 }{}
749 % \end{macrocode}
750 %
751 % \subsubsection{Document layout / variables}
752 %
753 % \begin{macrocode}
754 %%% Set document layout / variables
755 \ifdoctools@applyLayout%
756 \setlength{\parindent}{0pt}
757 \setlength{\parskip}{0.5\baselineskip}
758 \setcounter{secnumdepth}{2}
759 \setcounter{tocdepth}{2}
760 \fi % end \ifdoctools@applyLayout%
761 % \end{macrocode}
762 %
763 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
764 % \subsection{Internal Variables}
765 %
766 % \begin{macrocode}
767 %%% ---- Internal Variables ----
768 %% Font for Index Headings
769 \newcommand{\doctools@indexHeadFont}[1]{\textsc{#1}}
770 % \end{macrocode}
771 %
772 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
773 % \subsection{Commands}
774 %
775 % \begin{macro}{\bs}
776 % Shortcut for \cs{textbackslash}.
777 % \begin{macrocode}
778 %%% ---- Commands ----
779 %% \bs
780 \newcommand{\bs}{\textbackslash}
781 % \end{macrocode}
782 % \end{macro}
783 %
784 % \begin{macro}{\command}
785 % Prints the argument with backslash in typewriter font.
786 % This is meant to be used for \LaTeX{} commands.
787 % Additionally the command is added to the index.
788 % \begin{macrocode}
789 %% \command
790 \newcommand{\command}[1]{%
791 \texttt{\textbackslash{}#1}\relax%
792 \ifdoctools@createIndexEntries%
793 \index{\doctools@indexHeadFont{Command}!\textbackslash{}#1}%
794 \fi%
795 }%
796 % \end{macrocode}
797 % \end{macro}
798 %
799 % \begin{macro}{\cs}
800 % Shortcut for \cs{command}
801 % \begin{macrocode}
802 %% \cs (shortcut for \command)
803 %% \cs might be defined by ltxdoc, therefore it needs to be deleted
804 %% before it can be redefined.
805 \ifcsdef{cs}{\csundef{cs}}{}%
806 \let\cs\command%
807 % \end{macrocode}
808 % \end{macro}
809 %
810 % \begin{macro}{\environment}
811 % Formats an environment in typewriter font and adds it to the index.
812 % \begin{macrocode}
813 %% \environment
814 \ifcsdef{environment}{\csundef{environment}}{}
815 \newcommand{\environment}[1]{%
816 \texttt{#1}%
817 \ifdoctools@createIndexEntries
818 \index{\doctools@indexHeadFont{Environment}!#1}%
819 \fi
820 }%
821 % \end{macrocode}
822 % \end{macro}
823 %
824 % \begin{macro}{\env}
825 % Shortcut for \cs{environment}
826 % \begin{macrocode}
827 %% \env
828 \newcommand{\env}[1]{\environment{#1}}
829 % \end{macrocode}
830 % \end{macro}
831 %
832 % \begin{macro}{\package}
833 % Formats an package in typewriter font and adds it to the index.
834 % \begin{macrocode}
835 %% \package
836 \newcommand{\package}[1]{%
837 \texttt{#1}%
838 \ifdoctools@createIndexEntries
839 \index{\doctools@indexHeadFont{Package}!#1}%
840 \fi
841 }%
842 % \end{macrocode}
843 % \end{macro}
844 %
845 % \begin{macro}{\ltxclass}
846 % Formats a \latex class in typewriter font and adds it to the index.
847 % \begin{macrocode}
848 %% \ltxclass
849 \newcommand{\ltxclass}[1]{%
850 \texttt{#1}%
851 \ifdoctools@createIndexEntries
852 \index{\doctools@indexHeadFont{Class}!#1}%
853 \fi
854 }%
855 % \end{macrocode}
856 % \end{macro}
857 %
858 % \begin{macro}{\marg}
859 % Formats a mandatory argument of a command. If \cs{meta} is defined this is reused.
860 % \begin{macrocode}
861 %% \marg
862 \ifcsdef{marg}{}{% if not defined
863 \ifcsdef{meta}%
864 {\newcommand\marg[1]{\texttt{\{}\meta{#1}\texttt{\}}}}%
865 {\newcommand\marg[1]{%
866 \texttt{\{}%
867 $\langle${\normalfont\slshape#1}$\rangle$%
868 \texttt{\}}}}%
869 }%
870 % \end{macrocode}
871 % \end{macro}
872 %
873 % \begin{macro}{\oarg}
874 % Formats a optional argument of a command. If \cs{meta} is defined this is reused.
875 % \begin{macrocode}
876 %% \oarg
877 \ifcsdef{oarg}{}{% if not defined
878 \ifcsdef{meta}%
879 {\newcommand\oarg[1]{\texttt{[}\meta{#1}\texttt{]}}}%
880 {\newcommand\oarg[1]{%
881 \texttt{[}%
882 $\langle${\normalfont\slshape#1}$\rangle$%
883 \texttt{]}}}%
884 }%
885 % \end{macrocode}
886 % \end{macro}
887 %
888 % \begin{macro}{\arg}
889 % Formats an argument of a command without extra angle brackets
890 % in curled brackets in monospaced font.
891 % \begin{macrocode}
892 %% \arg
893 \ifcsdef{arg}{%
894 \csundef{arg}%
895 \newcommand\arg[1]{\{\texttt{#1}\}}%
896 }{}%
897 % \end{macrocode}
898 % \end{macro}
899 %
900 % \begin{macro}{\option}
901 % Formats an option in typewriter font and adds it to the index.
902 % \begin{macrocode}
903 %% \option
904 \newcommand{\option}[1]{%
905 \texttt{#1}%
906 \ifdoctools@createIndexEntries%
907 \index{option!#1}%
908 \fi
909 }%
910 % \end{macrocode}
911 % \end{macro}
912 %
913 % \begin{macro}{\parameter}
914 % Formats a parameter in typewriter font.
915 % \begin{macrocode}
916 %% \parameter
917 \newcommand{\parameter}[1]{%
918 \texttt{#1}%
919 }%
920 % \end{macrocode}
921 % \end{macro}
922 %
923 % \begin{macro}{\person}
924 % Print out name of a person, for example for the acknowledge
925 % of their help during the development of some code.
926 % \begin{macrocode}
927 %% \person
928 \newcommand{\person}[1]{\textsc{#1}}
929 % \end{macrocode}
930 % \end{macro}
931 %
932 % \begin{macro}{\AfterLastParam}
933 % Used in conjuction with \cs{DescribeMacro} and the printout of arguments
934 % using \cs{marg} or \cs{oarg}. \cs{AfterLastParam} is inserted at the end
935 % to begin a new line.
936 % \begin{macrocode}
937 %% \AfterLastParam
938 \newcommand{\AfterLastParam}{\par\noindent}
939 % \end{macrocode}
940 % \end{macro}
941 %
942 % \begin{macro}{\Default}
943 % \cs{Default} is used to print out the default value of a command.
944 % \begin{macrocode}
945 %% \Default
946 \newcommand{\Default}[1]{\par Default: \texttt{#1} \par}
947 % \end{macrocode}
948 % \end{macro}
949 %
950 % \begin{macro}{\Example}
951 % \cs{Example} is used to print out an example for the usage of a command.
952 % \begin{macrocode}
953 %% \Example
954 \newcommand{\Example}[1]{\par Example: \texttt{#1} \par}
955 % \end{macrocode}
956 % \end{macro}
957 %
958 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
959 % \subsection{Option list}
960 %
961 % \begin{macro}{Optionlist}
962 % Environment
963 % \begin{macrocode}
964 \newenvironment{Optionlist}{%
965 \begin{flushleft}%
966 \vspace{-2\parskip}
967 %% Style changes
968 \small\renewcommand{\arraystretch}{1.4}%
969 %% table
970 \begin{tabular} {>{\ttfamily}l<{\normalfont}p{0.7\textwidth}}%
971 }{% end of environment
972 \end{tabular}%
973 \end{flushleft}%
974 }%
975 % \end{macrocode}
976 % \end{macro}
977 %
978 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
979 % \subsection{\LaTeX{} engine names}
980 %
981 % \begin{macro}{\latex}
982 % New lower case command for printing out \LaTeX{}
983 % \begin{macrocode}
984 %%% ---- engine names ----
985 %% \latex
986 % ensure that space is added after \latex
987 \newcommand{\latex}{\LaTeX\xspace}
988 % \end{macrocode}
989 % \end{macro}
990 %
991 %
992 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
993 % \subsection{doc.sty modifications}
994 % The following commands from doc.sty are changed by
995 % introducing colors to the commands
996 % \begin{macrocode}
997 %%% ---- doc.sty modifications ----
998 % define color for Macro and Environment names
999 \colorlet{doctools@ColorCodeNames}{blue!50!black}
1000 %%% Overwrite font for \meta
1001 \def\meta@font@select{\normalfont\slshape} % original: \itshape
1002 %
1003 \ifcsdef{PrintMacroName}
1004 {\def\PrintMacroName#1{\strut \MacroFont %
1005 \color{doctools@ColorCodeNames}\string #1\ }}{}
1006 %
1007 \newcounter{MacroName} % hyperref uses \theH<counter>
1008 \providecommand*{\theHMacroName}{\theMacroName}
1009 %
1010 %% create label
1011 % \renewcommand*{\theHMacroName}{#1}%
1012 % \ifcsdef{phantomsection}{\phantomsection}{}%
1013 % \@bsphack%
1014 % \refstepcounter{MacroName}%
1015 % \label{doc:desc:#1}%
1016 \ifcsdef{PrintDescribeMacro}
1017 {\def\PrintDescribeMacro#1{%
1018 \strut \MacroFont %
1019 \color{doctools@ColorCodeNames} \string #1\ }}{}
1020 \ifcsdef{PrintDescribeEnv}
1021 {\def\PrintDescribeEnv#1{\strut \MacroFont %
1022 \color{doctools@ColorCodeNames} #1\ }}{}
1023 \ifcsdef{PrintEnvName}
1024 {\def\PrintEnvName#1{\strut \MacroFont %
1025 \color{doctools@ColorCodeNames} #1\ }}{}
1026 %
1027 %%% disable the index preamble if index entries are generated by this package
1028 \ifdoctools@createIndexEntries
1029 \ifcsdef{index@prologue}
1030 {\def\index@prologue{\section*{Index}\markboth{Index}{Index}}}
1031 {}
1032 \fi
1033 %
1034 % \end{macrocode}
1035 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1036 % \subsection{Listings environments}
1037 %
1038 % \begin{macrocode}
1039 %%% ---- listings environments for LaTeX code
1040 %%% Overwriting the environment macrocode for printing the code in a dtx file.
1041 \ifcsdef{macrocode}{\csundef{macrocode}}{}
1042 \lstnewenvironment{macrocode}{\lstset{style=lstDocStyleLaTeXCode}}{}
1043 % \end{macrocode}
1044 %
1045 % \begin{macrocode}
1046 %%% environment code examples.
1047 \lstnewenvironment{latexcode}{\lstset{style=lstDemoStyleLaTeXCode}}{}
1048 % \end{macrocode}
1049 %
1050 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1051 % \subsection{Print LaTeX code from external file using listings}
1052 %
1053 % \begin{macrocode}
1054 % -------------------------------------------------
1055 % \printCodeFromFile
1056 % -------------------------------------------------
1057 \newcounter{lstFirstLine}
1058 \newcounter{lstLastLine}
1059 \setcounter{lstLastLine}{0}
1060 \setcounter{lstFirstLine}{0}
1061 %
1062 \newcommand{\printCodeFromFile}[3][]{%
1063 \ifstrempty{#1}{}{%
1064 \setcounter{lstFirstLine}{#1}%
1065 }%
1066 \setcounter{lstLastLine}{#2}%
1067 %
1068 \lstinputlisting[%
1069 firstnumber=\thelstFirstLine,%
1070 firstline=\thelstFirstLine,%
1071 lastline=\thelstLastLine,%
1072 nolol=true,
1073 style=lstDemoStyleLaTeXCode]%
1074 {#3}%
1075 %
1076 %% set counter to lastLine + 1
1077 \setcounter{lstFirstLine}{\thelstLastLine}
1078 \addtocounter{lstFirstLine}{1}
1079 }
1080 % \end{macrocode}
1081 %
1082 % ^^A ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1083 % \subsection{References and links to files}
1084 %
1085 % \begin{macrocode}
1086 % -------------------------------------------------
1087 % \file and \labelfile
1088 % -------------------------------------------------
1089 % Code copied from http://tex.stackexchange.com/
1090 % questions/65639/how-to-create-my-on-ref-label-system/
1091 % with later modifications.
1092 % Thanks to Heiko Oberdiek for providing this answer !
1093 % -------------------------------------------------
1094 %% Command for printing the filename
1095 \ifcsdef{urlstyle}{}{\usepackage{url}}
1096 \DeclareUrlCommand{\PrintFileName}{\urlstyle{tt}}
1097 %%
1098 \newcounter{file}
1099 %% hyperref uses \theH<counter>
1100 \providecommand*{\theHfile}{\thefile}
1101 %% code from tex.stackexchange with the
1102 %% the help from Heiko Oberdiek.
1103 \newcommand*{\labelfile}[1]{%
1104 %% convert all "/" to "/," (comma list) and save in \IndexFileA
1105 \StrSubstitute{#1}{/}{/,}[\IndexFileA]%
1106 %% define \IndexFileB as empty (used for the output string)
1107 \let\IndexFileB\@empty
1108 %% parse and convert \IndexFileA using \@AddFileEntry
1109 \expandafter
1110 \comma@parse@normalized\expandafter{\IndexFileA}\@AddFileEntry
1111 %% create label and print to index
1112 \@bsphack
1113 \renewcommand*{\theHfile}{#1}%
1114 \refstepcounter{file}%
1115 \ifcsdef{phantomsection}{\phantomsection}{}
1116 \label{file:#1}%
1117 \ifdoctools@createIndexEntries
1118 \index{\textsc{Files}!\IndexFileB}%
1119 \fi
1120 \@esphack
1121 }
1122 %% add entries of comma list to the index.
1123 \newcommand*{\@AddFileEntry}[1]{%
1124 \ifx\IndexFileB\@empty
1125 %% add first entry to index with lexEntry@{printEntry}
1126 \def\IndexFileB{#1@#1}%
1127 \else
1128 \expandafter\def\expandafter\IndexFileB\expandafter{%
1129 %% add following entries to index with
1130 %% previousEntries!lexEntry@{printEntry}
1131 \IndexFileB!%
1132 #1@#1%
1133 }%
1134 \fi
1135 }
1136 %% Print out filename and create a link if the label exists.
1137 \newcommand*{\file}[1]{%
1138 \ifcsdef{hyperref}%
1139 {\hyperref[file:#1]{\PrintFileName{#1}}}%
1140 {\PrintFileName{#1}}%
1141 }%
1142 %%
1143 } % end of \AtBeginDocument
1144
1145 % \end{macrocode}
1146 %
1147 %
1148 %
1149 % \iffalse
1150 %</doctools.sty>
1151 % \fi
1152 % \clearpage
1153 % \Finale
1154 \endinput
1155