summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ran_toks/examples/ctrl-build.tex
blob: c5401a303d9d21fa8cda39dbc501ef43053ba95f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
\documentclass{article}
\usepackage{shellesc}
\usepackage{fancyvrb}

\newif\ifcompileit \compileittrue

\begin{document}

\noindent
This is a dummy file to help compile multiple versions of the same source file.
The commands are very simple, they can be improved in a variety of ways.

\def\basename{mc-dbu-ctrld} % base name of target file
\def\altbasename{mc-dbu}    % base name of output file
% define a simple \forVersion command, convert letter to upper case
\def\forVersion#1{\uppercase{\edef\selVersion{#1}}}

% select the version letter (upper or lower case)
\forVersion{a}
% define a suffix that follows \altbasename, redefine as desired
\edef\altsuffix{%
  \if\selVersion Asec01\else
  \if\selVersion Bsec02\else
  \if\selVersion Csec03\else
  \if\selVersion Dsec04\fi\fi\fi\fi}

\begin{VerbatimOut}[commandchars=!()]{build-info.tex}
\examNum{1}
\numVersions{4}
\forVersion{!selVersion}
\vA{\useThisSeed{54356}}
\vB{\useThisSeed{577867}}
\vC{\useThisSeed{6746788}}
\vD{\useThisSeed{856785}}
%\viewIDstrue % to view the IDs of problems used
\end{VerbatimOut}

\medskip\noindent
Compiling the file \texttt{\basename.tex} for version~\selVersion\space(\altsuffix), and renaming the final
PDF produced to \texttt{\altbasename-\altsuffix.pdf}


\ifcompileit

% compile using the PDF creator of your choice, copy and paste this next
% line to execute multiple compiles to bring labels, if any, up to date
\ShellEscape{pdflatex \basename}
%\ShellEscape{pdflatex \basename}
%\ShellEscape{pdflatex \basename}

% copy the newly created file to a new file name
\ShellEscape{move \basename.pdf \altbasename-\altsuffix.pdf}
% delete build-info.tex
\ShellEscape{del build-info.tex}

\fi

\end{document}