Debian Codegraph @

texmf-dist/doc/latex/dtxgallery/conditional-code.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Part of Will Robertson's DTXGALLERY bundle, version 1.
4 %
5 %<*driver>
6 \documentclass{ltxdoc}
7 \usepackage{fancyvrb}
8 \begin{document}
9 \DocInput{conditional-code.dtx}
10 \end{document}
11 %</driver>
12 % \fi
13 %
14 % \section{Conditional inclusion of code}
15 %
16 % From previous examples the |%<*guard>|\dots|%</guard>| syntax should be a little familiar. This example demonstrates conditional extraction of such elements in the source document into multiple files. This technique makes it easy, say, to maintain a `debug' version of a package without polluting the public source with code for testing.
17 %
18 % \begin{macrocode}
19 %<A> code in `A'
20 %<B> code in `B'
21 %<!A> code not in `A'
22 %<!B> code not in `B'
23 %<A&B> code in `A' and `B'
24 %<A|B> code in `A' or `B'
25 %<(A|B)&!(A&B)> code in `A' xor `B'
26 % \end{macrocode}
27 % Note the change in the typeset source when guards are nested: \\
28 % (this is equivalent to \verb|%<A&B>|)
29 % \begin{macrocode}
30 %<*A>
31 %<B> `B' nested inside `A'
32 %</A>
33 % \end{macrocode}
34 %
35 % \section{Verbatim files that are produced}
36 % \begin{minipage}{0.45\linewidth}
37 % \subsection{Generated from `A'}
38 % \VerbatimInput[frame=single]{A.txt}
39 % \end{minipage}\hfill
40 % \begin{minipage}{0.45\linewidth}
41 % \subsection{Generated from `B'}
42 % \VerbatimInput[frame=single]{B.txt}
43 % \end{minipage}
44 % \subsection{Generated from `A' and `B'}
45 % \VerbatimInput[frame=single]{AB.txt}
46 %
47 % \Finale
48 \endinput