Debian Codegraph @

texmf-dist/doc/latex/ran_toks/examples/ctrl-build.tex

raw
1 \documentclass{article}
2 \usepackage{shellesc}
3 \usepackage{fancyvrb}
4
5 \newif\ifcompileit \compileittrue
6
7 \begin{document}
8
9 \noindent
10 This is a dummy file to help compile multiple versions of the same source file.
11 The commands are very simple, they can be improved in a variety of ways.
12
13 \def\basename{mc-dbu-ctrld} % base name of target file
14 \def\altbasename{mc-dbu} % base name of output file
15 % define a simple \forVersion command, convert letter to upper case
16 \def\forVersion#1{\uppercase{\edef\selVersion{#1}}}
17
18 % select the version letter (upper or lower case)
19 \forVersion{a}
20 % define a suffix that follows \altbasename, redefine as desired
21 \edef\altsuffix{%
22 \if\selVersion Asec01\else
23 \if\selVersion Bsec02\else
24 \if\selVersion Csec03\else
25 \if\selVersion Dsec04\fi\fi\fi\fi}
26
27 \begin{VerbatimOut}[commandchars=!()]{build-info.tex}
28 \examNum{1}
29 \numVersions{4}
30 \forVersion{!selVersion}
31 \vA{\useThisSeed{54356}}
32 \vB{\useThisSeed{577867}}
33 \vC{\useThisSeed{6746788}}
34 \vD{\useThisSeed{856785}}
35 %\viewIDstrue % to view the IDs of problems used
36 \end{VerbatimOut}
37
38 \medskip\noindent
39 Compiling the file \texttt{\basename.tex} for version~\selVersion\space(\altsuffix), and renaming the final
40 PDF produced to \texttt{\altbasename-\altsuffix.pdf}
41
42
43 \ifcompileit
44
45 % compile using the PDF creator of your choice, copy and paste this next
46 % line to execute multiple compiles to bring labels, if any, up to date
47 \ShellEscape{pdflatex \basename}
48 %\ShellEscape{pdflatex \basename}
49 %\ShellEscape{pdflatex \basename}
50
51 % copy the newly created file to a new file name
52 \ShellEscape{move \basename.pdf \altbasename-\altsuffix.pdf}
53 % delete build-info.tex
54 \ShellEscape{del build-info.tex}
55
56 \fi
57
58 \end{document}