From 5aeceaafdf41d8bd02ef1521380f21cbb163bd69 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sun, 10 Sep 2023 03:01:10 +0000 Subject: CTAN sync 202309100301 --- .../contrib/profmaquette/doc/profmaquette-doc.pdf | Bin 177356 -> 177327 bytes .../contrib/profmaquette/doc/profmaquette-doc.tex | 2 +- .../contrib/profmaquette/latex/ProfMaquette.sty | 69 +- macros/latex/contrib/runcode/README | 4 +- macros/latex/contrib/runcode/runcode.pdf | Bin 251041 -> 251374 bytes macros/latex/contrib/runcode/runcode.sty | 322 +- macros/latex/contrib/runcode/runcode.tex | 154 +- macros/latex/contrib/ucph-revy/README.md | 81 + .../latex/contrib/ucph-revy/ucph-revy-da-doc.ins | 39 + .../latex/contrib/ucph-revy/ucph-revy-da-doc.pdf | Bin 0 -> 267723 bytes .../latex/contrib/ucph-revy/ucph-revy-da-man.ins | 38 + .../latex/contrib/ucph-revy/ucph-revy-da-man.pdf | Bin 0 -> 164707 bytes .../latex/contrib/ucph-revy/ucph-revy-en-doc.ins | 38 + .../latex/contrib/ucph-revy/ucph-revy-en-doc.pdf | Bin 0 -> 270077 bytes .../latex/contrib/ucph-revy/ucph-revy-en-man.ins | 38 + .../latex/contrib/ucph-revy/ucph-revy-en-man.pdf | Bin 0 -> 169522 bytes macros/latex/contrib/ucph-revy/ucph-revy-ex-da.ins | 34 + macros/latex/contrib/ucph-revy/ucph-revy-ex-en.ins | 34 + .../latex/contrib/ucph-revy/ucph-revy-ex-thumb.ins | 34 + macros/latex/contrib/ucph-revy/ucph-revy.bib | 27 + macros/latex/contrib/ucph-revy/ucph-revy.dtx | 3339 ++++++++++++++++++++ macros/latex/contrib/ucph-revy/ucph-revy.ins | 40 + 22 files changed, 4039 insertions(+), 254 deletions(-) create mode 100644 macros/latex/contrib/ucph-revy/README.md create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-da-doc.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-da-doc.pdf create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-da-man.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-da-man.pdf create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-en-doc.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-en-doc.pdf create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-en-man.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-en-man.pdf create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-ex-da.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-ex-en.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy-ex-thumb.ins create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy.bib create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy.dtx create mode 100644 macros/latex/contrib/ucph-revy/ucph-revy.ins (limited to 'macros/latex') diff --git a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf index 6e110bc606..8b8ff62f0c 100644 Binary files a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf and b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.pdf differ diff --git a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex index c0a336a583..8daf45b3f1 100644 --- a/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex +++ b/macros/latex/contrib/profmaquette/doc/profmaquette-doc.tex @@ -1055,7 +1055,7 @@ Cela engendre, si nécessaire, la création de fichier \lstinline!*.sol! pour le \clearpage \section*{Historique} \begin{description} -\item[\PfMfiledate{}--v \PfMfileversion] Correction de bugs. +\item[\PfMfiledate{}--v \PfMfileversion] Indépendance vis-à vis du module \lstinline!french! de \lstinline!babel!. \end{description} \end{document} %%% Local Variables: diff --git a/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty b/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty index 51dacc1bcf..01cd309781 100644 --- a/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty +++ b/macros/latex/contrib/profmaquette/latex/ProfMaquette.sty @@ -2,9 +2,9 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2023/08/17}% +\def\filedate{2023/09/09}% \let\PfMfiledate\filedate% -\def\fileversion{0.4}% +\def\fileversion{0.45}% \let\PfMfileversion\fileversion% \ProvidesPackage{ProfMaquette}[\filedate\space v\fileversion\space Maquettage de documents]% @@ -44,7 +44,7 @@ \setKVdefault[RecapBrevet]{Theme=Les nombres décimaux,Date=\today,Code={},NomExercice=Exercice}% \setKVdefault[Kholle]{Sujet=1,Numero=1,Date=15,Niveau=TSI-1,Code=\jobname,Lieu=Lycée du Hainaut (Valenciennes),NomEleve=Albert Einstein,CR=false}% -\setKVdefault[ClesExercices]{PasTitre=false,AffichageSource=false,BaremeTotal,BaremeDetaille=false,MotPoint=point,AffichageTitre=false,Calculatrice=true,Oral=false,Difficulte=0,AffichageCompetence=false,PasCorrige=false,Direct=false,Pouce=false,Parcours=false,Background=white,Cadre=gray!50}% +\setKVdefault[ClesExercices]{PasTitre=false,AffichageSource=false,BaremeTotal,BaremeDetaille=false,MotPoint=point,AffichageTitre=false,Calculatrice=true,Oral=false,Difficulte=0,AffichageCompetence=false,PasCorrige=false,Direct=false,Pouce=false,Parcours=false,Background=white,Cadre=gray!50,Numerote}% \defKV[ClesExercices]{Source=\setKV[ClesExercices]{AffichageSource}}% \defKV[ClesExercices]{Titre=\setKV[ClesExercices]{AffichageTitre}}% \defKV[ClesExercices]{Competence=\setKV[ClesExercices]{AffichageCompetence}}% @@ -226,7 +226,7 @@ \end{tabular}% \]% }% - +% %%%% %%% Définitions des environnements pour la correction \makeatletter @@ -375,8 +375,8 @@ \xintFor* ##1 in{\xintSeq{1}{\thePfMExo}}\do{% \setcounter{PfMExoSol}{##1}% \setcounter{PfMAlea}{0}% - \IfFileExists{\jobname-Ex##1.sol}{\textbf{Corrigé de l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.sol}\par\goodbreak}{\IfFileExists{\jobname-Ex##1.rep}{\textbf{Réponse(s) seule(s) de l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.rep}\par\goodbreak}{% - \IfFileExists{\jobname-Ex##1.cdp}{\textbf{Indice(s) pour l'exercice ##1}\par\nopagebreak\input{\jobname-Ex##1.cdp}\par\goodbreak}{} + \IfFileExists{\jobname-Ex##1.sol}{\textbf{Corrigé de l'exercice\ifnum\thePfMExo=1\relax\else~##1\fi}\par\nopagebreak\input{\jobname-Ex##1.sol}\par\goodbreak}{\IfFileExists{\jobname-Ex##1.rep}{\textbf{Réponse(s) seule(s) de l'exercice\ifnum\thePfMExo=1\relax\else~##1\fi}\par\nopagebreak\input{\jobname-Ex##1.rep}\par\goodbreak}{% + \IfFileExists{\jobname-Ex##1.cdp}{\textbf{Indice(s) pour l'exercice\ifnum\thePfMExo=1\relax\else~##1\fi}\par\nopagebreak\input{\jobname-Ex##1.cdp}\par\goodbreak}{} }% }% }% @@ -688,7 +688,7 @@ }{\endtcolorbox% } -\newenvironment{exerciceFiche}[1][]{% +\newenvironment{exerciceFicheold}[1][]{% \setcounter{PfMAlea}{0}% \setcounter{PfMNbLogo}{1}% \useKVdefault[ClesExercices]% @@ -707,6 +707,49 @@ }{\endtcolorbox% } +\NewDocumentEnvironment{exerciceFichenewold}{o+b}{% + \setcounter{PfMAlea}{0}% + \setcounter{PfMNbLogo}{1}% + \useKVdefault[ClesExercices]% + \setKV[ClesExercices]{#1}% + \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}% + \colorlet{PfMCadreFiche}{\useKV[ClesExercices]{Cadre}}% + \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}% + \refstepcounter{PfMSection}% + \PfMChoixCorrection% + \refstepcounter{PfMExo}% + \tcolorbox[% + tikzfiche, + label is label, + label=page-\thePfMMaquette-\thePfMExo + ] + #2 +\endtcolorbox% +}{} + +\NewDocumentEnvironment{exerciceFiche}{so+b}{% + \setcounter{PfMAlea}{0}% + \setcounter{PfMNbLogo}{1}% + \useKVdefault[ClesExercices]% + \setKV[ClesExercices]{#2}% + \IfBooleanTF{#1}{% + \setKV[ClesExercices]{Numerote=false}% + }{}% + \colorlet{ColExoFiche}{\useKV[ClesExercices]{Background}}% + \colorlet{PfMCadreFiche}{\useKV[ClesExercices]{Cadre}}% + \setKV[ClesExercices]{BaremeTotal=false,BaremeDetaille=false}% + \refstepcounter{PfMSection}% + \PfMChoixCorrection% + \refstepcounter{PfMExo}% + \tcolorbox[% + tikzfiche, + label is label, + label=page-\thePfMMaquette-\thePfMExo + ] + #3 +\endtcolorbox% +}{} + \newenvironment{exerciceDS}[1][]{% \setcounter{PfMAlea}{0}% \useKVdefault[ClesExercices]% @@ -1095,7 +1138,7 @@ \newcommand\TikzKholle{% \clearpage \begin{tcolorbox}[userkholle]% - \sffamily Interrogation Orale \no\useKV[Kholle]{Numero}\hfill + \sffamily Interrogation Orale \useKV[Kholle]{Numero}\hfill \ifboolKV[Kholle]{CR}{}{Sujet \useKV[Kholle]{Sujet}\hfill}\useKV[Kholle]{Niveau}% \par\useKV[Kholle]{Lieu}\hfill Le \useKV[Kholle]{Date}% \end{tcolorbox}% @@ -1287,7 +1330,7 @@ fill=ColExoFiche, anchor=west, xshift=\kvtcb@leftlower, - ] at (frame.north west){\bfseries\sffamily \useKV[Fiche]{NomExercice} \thePfMExo\ifboolKV[ClesExercices]{AffichageTitre}{ : \useKV[ClesExercices]{Titre}}{}}; + ] at (frame.north west){\bfseries\sffamily \useKV[Fiche]{NomExercice} \ifboolKV[ClesExercices]{Numerote}{\thePfMExo}{}\ifboolKV[ClesExercices]{AffichageTitre}{ : \useKV[ClesExercices]{Titre}}{}}; %% \ifboolKV[ClesExercices]{Calculatrice}{}{\node[fill=ColExoFiche,anchor=west,xshift=(\thePfMNbLogo*2.5+(\thePfMNbLogo-1)*20)*1pt] at (A.east) {\cancel{\faCalculator}};\stepcounter{PfMNbLogo}} \ifboolKV[ClesExercices]{Oral}{\node[fill=ColExoFiche,anchor=west,xshift=(\thePfMNbLogo*2.5+(\thePfMNbLogo-1)*20)*1pt] at (A.east) {\faBullhorn};\stepcounter{PfMNbLogo}}{} @@ -1410,7 +1453,7 @@ \newcommand\TikzDS{% \clearpage \begin{tcolorbox}[userds]% - \sffamily Devoir surveillé \no\useKV[DS]{Numero} (Sujet \useKV[DS]{Sujet})\hfill\useKV[DS]{Niveau} \useKV[DS]{Classe} + \sffamily Devoir surveillé \useKV[DS]{Numero} (Sujet \useKV[DS]{Sujet})\hfill\useKV[DS]{Niveau} \useKV[DS]{Classe} \par{\tiny\useKV[DS]{Code}}\hfill{\scriptsize\useKV[DS]{Date}} \end{tcolorbox}% }% @@ -1419,7 +1462,7 @@ \clearpage \setKV[DS]{#1} \begin{tcolorbox}[userdscor]% - \sffamily Devoir surveillé \no\useKV[DS]{Numero} (Sujet \useKV[DS]{Sujet})\hfill\useKV[DS]{Niveau} \useKV[DS]{Classe}% + \sffamily Devoir surveillé \useKV[DS]{Numero} (Sujet \useKV[DS]{Sujet})\hfill\useKV[DS]{Niveau} \useKV[DS]{Classe}% \par Correction% \end{tcolorbox}% } @@ -1503,7 +1546,7 @@ \clearpage \begin{minipage}{0.6\linewidth} \begin{tcolorbox}[userie]% - \sffamily \useKV[IE]{Nom} \no\useKV[IE]{Numero} : \useKV[IE]{Theme} \ifboolKV[IE]{Sujets}{\scriptsize(Sujet \useKV[IE]{Sujet})}{} + \sffamily \useKV[IE]{Nom} \useKV[IE]{Numero} : \useKV[IE]{Theme} \ifboolKV[IE]{Sujets}{\scriptsize(Sujet \useKV[IE]{Sujet})}{} \vspace{1em} \par{\tiny\useKV[IE]{Code}}\hfill{\scriptsize\useKV[IE]{Date}} \end{tcolorbox}% @@ -1519,7 +1562,7 @@ \clearpage% \setKV[IE]{#1}% \begin{tcolorbox}[useriecor]% - \sffamily \useKV[IE]{Nom} \no\useKV[IE]{Numero} : \useKV[IE]{Theme} \ifboolKV[IE]{Sujets}{\scriptsize(Sujet \useKV[IE]{Sujet})}{}\hfill Correction% + \sffamily \useKV[IE]{Nom} \useKV[IE]{Numero} : \useKV[IE]{Theme} \ifboolKV[IE]{Sujets}{\scriptsize(Sujet \useKV[IE]{Sujet})}{}\hfill Correction% \par{\tiny\useKV[IE]{Code}}\hfill{\scriptsize\useKV[IE]{Date}}% \end{tcolorbox}% }% diff --git a/macros/latex/contrib/runcode/README b/macros/latex/contrib/runcode/README index 7a1480a3b1..6075685680 100644 --- a/macros/latex/contrib/runcode/README +++ b/macros/latex/contrib/runcode/README @@ -1,11 +1,11 @@ -LaTeX Package: runcode 2023/06/23 v2.0 +LaTeX Package: runcode 2023/09/08 v2.2 ---------------------------------------- The runcode package enables the execution of source code (e.g., R, Julia, Matlab, shell, Python, etc.) and embed the results in the pdf file when compiling the LaTeX file. To use this package the shell-escape option must be enabled. -Copyright (C) 2020-2022 +Copyright (C) 2020-2023 Haim Bar and HaiYing Wang https://github.com/Ossifragus/runcode Files: diff --git a/macros/latex/contrib/runcode/runcode.pdf b/macros/latex/contrib/runcode/runcode.pdf index 95afe13532..0a2d35f5e0 100644 Binary files a/macros/latex/contrib/runcode/runcode.pdf and b/macros/latex/contrib/runcode/runcode.pdf differ diff --git a/macros/latex/contrib/runcode/runcode.sty b/macros/latex/contrib/runcode/runcode.sty index 1fe5b07956..06c3d346e0 100644 --- a/macros/latex/contrib/runcode/runcode.sty +++ b/macros/latex/contrib/runcode/runcode.sty @@ -4,7 +4,9 @@ % % This package is based on an ongoing work by Haim Bar and HaiYing Wang, and comments and questions are welcome! -\ProvidesPackage{runcode}[2023/06/23 runcode v2.0] +\ProvidesPackage{runcode}[2023/09/08 runcode v2.2] + +\def \langs {} \newif\ifruncode % Change to \runcodefalse if you want to suspend code execution @@ -48,105 +50,73 @@ \notnohuptrue \DeclareOption{nohup}{\notnohupfalse} +\newcounter{portNo} +\setcounter{portNo}{65430} + +\NewDocumentCommand{\InitLang}{m}{ + % Create a configuration file for the server for the language provided + % in the argument, if it does not exist, and add to the serverslist.txt file. + \IfFileExists{#1.config}{}{ + \newwrite\tempfile + \immediate\openout\tempfile=#1.config + \immediate\write\tempfile{[SERVERCONFIG]} + \immediate\write\tempfile{PORT = \theportNo} + \immediate\write\tempfile{DEBUGFILE = #1debug.txt} + \immediate\write\tempfile{PIPETIMEOUT = 60} + \immediate\closeout\tempfile + \edef\langs{\langs#1_} + \stepcounter{portNo} + } + % Start the server. Need to run just once. Can comment out after the first + % compilation, but remember to terminate the server + \ifnotnohup + {\immediate\write18{python3 -c 'from talk2stat.talk2stat import server,client; server("./","#1") if not client("./","#1","``` ```") else print("server is already running")'}} + \else + {\immediate\write18{nohup python3 -c 'from talk2stat.talk2stat import server,client; server("./","#1") if not client("./","#1","``` ```") else print("server is already running")' &}} + \fi +} + \DeclareOption{R}{ - % create a configuration file for R server if it does not exist. - \IfFileExists{R.config}{}{ - \newwrite\tempfile - \immediate\openout\tempfile=R.config - \immediate\write\tempfile{[SERVERCONFIG]} - \immediate\write\tempfile{PORT = 65432} - \immediate\write\tempfile{DEBUGFILE = Rdebug.txt} - \immediate\write\tempfile{PIPETIMEOUT = 60} - \immediate\closeout\tempfile - } - % Start the server. Need to run just once. Can comment out after the first - % compilation, but remember to terminate the server - \ifnotnohup - {\immediate\write18{python3 -c 'from talk2stat.talk2stat import server,client; server("./","R") if not client("./","R","``` ```") else print("server is already running")'}} - \else - {\immediate\write18{nohup python3 -c 'from talk2stat.talk2stat import server,client; server("./","R") if not client("./","R","``` ```") else print("server is already running")' &}} - \fi + \InitLang{R} } \DeclareOption{julia}{ - % create a configuration file for R server if it does not exist. - \IfFileExists{julia.config}{}{ - \newwrite\tempfile - \immediate\openout\tempfile=julia.config - \immediate\write\tempfile{[SERVERCONFIG]} - \immediate\write\tempfile{PORT = 65431} - \immediate\write\tempfile{DEBUGFILE = juliadebug.txt} - \immediate\write\tempfile{PIPETIMEOUT = 60} - \immediate\closeout\tempfile - } - % Start the server. Need to run just once. Can comment out after the first - % compilation, but remember to terminate the server - \ifnotnohup - {\immediate\write18{python3 -c 'from talk2stat.talk2stat import server,client; server("./","julia") if not client("./","julia","``` ```") else print("server is already running")'}} - \else - {\immediate\write18{nohup python3 -c 'from talk2stat.talk2stat import server,client; server("./","julia") if not client("./","julia","``` ```") else print("server is already running")' &}} - \fi + \InitLang{julia} } \DeclareOption{matlab}{ - % create a configuration file for R server if it does not exist. - \IfFileExists{matlab.config}{}{ - \newwrite\tempfile - \immediate\openout\tempfile=matlab.config - \immediate\write\tempfile{[SERVERCONFIG]} - \immediate\write\tempfile{PORT = 65430} - \immediate\write\tempfile{DEBUGFILE = matlabdebug.txt} - \immediate\write\tempfile{PIPETIMEOUT = 60} - \immediate\closeout\tempfile - } - % Start the server. Need to run just once. Can comment out after the first - % compilation, but remember to terminate the server - \ifnotnohup - {\immediate\write18{python3 -c 'from talk2stat.talk2stat import server,client; server("./","matlab") if not client("./","matlab","``` ```") else print("server is already running")'}} - \else - {\immediate\write18{nohup python3 -c 'from talk2stat.talk2stat import server,client; server("./","matlab") if not client("./","matlab","``` ```") else print("server is already running")' &}} - \fi + \InitLang{matlab} } \DeclareOption{python}{ - % create a configuration file for Python server if it does not exist. - \IfFileExists{python.config}{}{ - \newwrite\tempfile - \immediate\openout\tempfile=python.config - \immediate\write\tempfile{[SERVERCONFIG]} - \immediate\write\tempfile{PORT = 65433} - \immediate\write\tempfile{DEBUGFILE = pythondebug.txt} - \immediate\write\tempfile{PIPETIMEOUT = 60} - \immediate\closeout\tempfile - } - % Start the server. Need to run just once. Can comment out after the first - % compilation, but remember to terminate the server - \ifnotnohup - {\immediate\write18{python3 -c 'from talk2stat.talk2stat import server,client; server("./","python") if not client("./","python","``` ```") else print("server is already running")'}} - \else - {\immediate\write18{nohup python3 -c 'from talk2stat.talk2stat import server,client; server("./","python") if not client("./","python","``` ```") else print("server is already running")' &}} - \fi + \InitLang{python} } + \DeclareOption{stopserver}{ \AtEndDocument{ - %% stop the server when the pdf compilation is done. - \IfFileExists{R.config}{ - \immediate\write18{python3 -c 'from talk2stat.talk2stat import client; client("./","R","QUIT")'} - }{} - \IfFileExists{julia.config}{ - \immediate\write18{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","QUIT")'} - }{} - \IfFileExists{matlab.config}{ - \immediate\write18{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","QUIT")'} - }{} - \IfFileExists{python.config}{ - \immediate\write18{python3 -c 'from talk2stat.talk2stat import client; client("./","python","QUIT")'} + \IfFileExists{serverslist.txt}{ + \newread\file + \openin\file=serverslist.txt + \immediate\readline\file to\lang + \closein\file + \StrCount{\lang}{\detokenize{_}}[\langNo] + \newcounter{x} + \forloop{x}{0}{\value{x} < \langNo}{ + \StrBefore{\lang}{\detokenize{_}}[\curlang] + \StrBehind{\lang}{\detokenize{_}}[\lang] + %% stop the server when the pdf compilation is done. + \IfFileExists{\curlang.config}{ + \immediate\write18{python3 -c 'from talk2stat.talk2stat import client; client("./","\curlang","QUIT")'} + }{} + } }{} -}} + } +} \ProcessOptions* +\usepackage{etoolbox} \usepackage{morewrites} % allow more than 16 \write \usepackage[many]{tcolorbox} % to put boxes around text \tcbset{colframe=blue!25,colback=blue!10} % default colors for box output @@ -157,6 +127,15 @@ \usepackage{xifthen} \usepackage{xparse} \usepackage{xstring} +\usepackage{forloop} + +%%%% check if \langs is empty !! +\ifdefempty{\langs}{}{ + \newwrite\outfile + \immediate\openout\outfile=serverslist.txt + \immediate\write\outfile{\langs} + \immediate\closeout\outfile} +{} % Use minted by default; but the user can change to listings or fvextra. \ifminted @@ -205,7 +184,6 @@ \setvalue{\tmpname}{} % initialize with a blank - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \showCode prints the source code, using minted or listings for a pretty layout % Arg #1 is the programming language, @@ -320,8 +298,63 @@ } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \writeChunk writes a selected chunk from source code as a .txt file. +% Arg #1 is the source file name, +% Arg #2 is the chunk identifier +% Args #3 and #4 are the beginning and end markings of a chunk (optional). + +\NewDocumentCommand{\writeChunk}{m m O{label===} O{===end}} { + \IfFileExists{#1}{ + \endlinechar=-1 + \def\printcode{0} % don't print until we see the begin-block string + \newread\file + \openin\file=#1 + \newwrite\outfile + \immediate\openout\outfile=\generated/#1-#2.txt + \loop\unless\ifeof\file + \immediate\readline\file to\fileline + \ifnum\printcode=1 + \IfSubStr{\fileline}{\detokenize{#4}}{ + \renewcommand{\printcode}{-1}}{\immediate\write\outfile{\fileline}} + \fi + \IfSubStr{\fileline}{\detokenize{#3}}{ + \StrBehind{\fileline}{\detokenize{#3}}[\chunkname] + \IfStrEq*{\detokenize{#2}}{\chunkname}{\renewcommand{\printcode}{1}}{} + } + {} + \repeat + \closein\file + \immediate\closeout\outfile + \endlinechar=13 + \ifnum\printcode=0 + \textcolor{red}{\textbf{Label #2 not found in #1}} + \fi + }{\textcolor{red}{\textbf{Source file #1 not found}}} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \showChunk prints a selected chunk from source code, using minted or listings for a pretty layout. +% The chunk is identified in the source code by two strings that define the beginning and end of the chunk. +% The default beginning is label=== where should be a unique user-defined chunk ID. +% The default end marker is ===end +% In the code, these markers should appear after a comment character, so that the code will run. +% Arg #1 is the programming language, +% Arg #2 is the source file name, +% Args #3 is the chunk identifier +% Args #4 and #5 are the beginning and end markings of a chunk (optional). + +\NewDocumentCommand{\showChunk}{m m m O{label===} O{===end}}{ + \IfFileExists{#2}{ + \writeChunk{#2}{#3}[#4][#5] + \IfFileExists{\generated/#2-#3.txt}{\showCode{#1}{\generated/#2-#3.txt}} + {\textcolor{red}{\textbf{Label #3 not found in #2}}} + }{\textcolor{red}{\textbf{Source file #2 not found}}} +} + + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \inln{Arg #1}{Arg #2}[Arg #3] is used to execute short source code +% \inln{Arg #1}{Arg #2}[Arg #3][Arg #4] is used to execute short source code % and embed resulting output. % Arg #1 is the executable program; % Arg #2 is the source code; @@ -342,7 +375,7 @@ \IfBeginWith{#2}{```}{\ifruncode\immediate\write18{#1 > \tmpname.tex}\unskip\fi} {\newwrite\tempfile \immediate\openout\tempfile=\tmpname.txt - \immediate\write\tempfile{#2} + \immediate\write\tempfile{\detokenize{#2}} \immediate\closeout\tempfile \ifruncode \immediate\write18{#1 \tmpname.txt > \tmpname.tex}\unskip @@ -367,7 +400,7 @@ {\textcolor{red}{\textbf{Output file \tmpname~ not found}}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Extended and language-specific comments: +% Extended and language-specific commands: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \runCodeIncOut: runs an external code and embeds the output. @@ -388,77 +421,84 @@ \includeOutput{#4}[#5] } +\newcommand{\runcmd}[2] +{python3 -c 'from talk2stat.talk2stat import client; client("./","#1",#2)'} + % R -\NewDocumentCommand{\runR}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","R","#2")'} m m O{}} -{ - \def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","R","#2")'} - \ifstrequal{#1}{\runcmd} - {\runExtCode{#1}{}{#3}[#4]} +% It will be used as a template for other languages +\newcommand{\LANG}{R} +\newcommand{\LANGcmd}{R} + +\expandafter\NewDocumentCommand\csname run\LANG\endcsname +{O{} m m O{}} +{\ifthenelse{\isempty{#1}} + {\runExtCode{\runcmd{\LANGcmd}{"#2"}}{#2}{#3}[#4]} {\runExtCode{#1}{#2}{#3}[#4]} } -\NewDocumentCommand{\runRIncOut} -{O{python3 -c 'from talk2stat.talk2stat import client; client("./","R","#2")'} m O{} O{} O{vbox}} -{\def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","R","#2")'} - \ifstrequal{#1}{\runcmd} - {\runCodeIncOut{#1}{}[#3][#4][#5]} - {\runCodeIncOut{#1}{#2}[#3][#4][#5]}} +\expandafter\NewDocumentCommand\csname run\LANG IncOut\endcsname +{O{} m O{} O{} O{vbox}} +{\ifthenelse{\isempty{#1}} + {\runCodeIncOut{\runcmd{\LANGcmd}{"#2"}}{#2}[#3][#4][#5]} + {\runCodeIncOut{#1}{#2}[#3][#4][#5]} +} -\NewDocumentCommand{\inlnR}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","R","\tmpname.txt")'} m O{} O{inline}}{\IfBeginWith{#2}{```}{\inln{python3 -c 'from talk2stat.talk2stat import client;rc0="""#2""";rc0=rc0.lstrip("```").rstrip("```");client("./","R",f"```{rc0}```")'}{#2}[#3][#4]}{\inln{#1}{#2}[#3][#4]}} +\expandafter\NewDocumentCommand\csname inln\LANG\endcsname +{O{} m O{} O{inline}} +{\ifthenelse{\isempty{#1}} + {\IfBeginWith{#2}{```} + {\inln{\runcmd{\LANGcmd}{r"""\detokenize{#2}"""}}{#2}[#3][#4]} + {\inln{\runcmd{\LANGcmd}{"\tmpname.txt"}}{#2}[#3][#4]} + } + {\inln{#1}{#2}[#3][#4]} +} -% Julia -\NewDocumentCommand{\runJulia}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","#2")'} m m O{}} -{ - \def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","#2")'} - \ifstrequal{#1}{\runcmd} - {\runExtCode{#1}{}{#3}[#4]} - {\runExtCode{#1}{#2}{#3}[#4]} +\expandafter\NewDocumentCommand\csname run\LANG Chunk\endcsname +{O{} m m O{} O{} O{vbox}} +{\IfFileExists{\generated/#2-#3.txt}{}{\writeChunk{#2}{#3}} + {\csname run\LANG IncOut\endcsname[#1]{\generated/#2-#3.txt}[#4][#2-#3][#6]} } -\NewDocumentCommand{\runJuliaIncOut} -{O{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","#2")'} m O{} O{} O{vbox}} -{\def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","#2")'} - \ifstrequal{#1}{\runcmd} - {\runCodeIncOut{#1}{}[#3][#4][#5]} - {\runCodeIncOut{#1}{#2}[#3][#4][#5]}} +% Julia +\NewDocumentCommand{\runJulia}{O{} m m O{}} +{\renewcommand{\LANGcmd}{julia} \runR[#1]{#2}{#3}[#4]} + +\NewDocumentCommand{\runJuliaIncOut}{O{} m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{julia} \runRIncOut[#1]{#2}[#3][#4][#5]} + +\NewDocumentCommand{\inlnJulia}{O{} m O{} O{inline}} +{\renewcommand{\LANGcmd}{julia} \inlnR[#1]{#2}[#3][#4]} + +\NewDocumentCommand{\runJuliaChunk}{O{} m m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{julia} \runRChunk[#1]{#2}{#3}[#4][#5][#6]} -\NewDocumentCommand{\inlnJulia}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","julia","\tmpname.txt")'} m O{} O{inline}}{\IfBeginWith{#2}{```}{\inln{python3 -c 'from talk2stat.talk2stat import client;rc0="""#2""";rc0=rc0.lstrip("```").rstrip("```");client("./","julia",f"```{rc0}```")'}{#2}[#3][#4]}{\inln{#1}{#2}[#3][#4]}} % Matlab -\NewDocumentCommand{\runMatlab}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","#2")'} m m O{}} -{ - \def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","#2")'} - \ifstrequal{#1}{\runcmd} - {\runExtCode{#1}{}{#3}[#4]} - {\runExtCode{#1}{#2}{#3}[#4]} -} +\NewDocumentCommand{\runMatLab}{O{} m m O{}} +{\renewcommand{\LANGcmd}{matlab} \runR[#1]{#2}{#3}[#4]} + +\NewDocumentCommand{\runMatLabIncOut}{O{} m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{matlab} \runRIncOut[#1]{#2}[#3][#4][#5]} + +\NewDocumentCommand{\inlnMatLab}{O{} m O{} O{inline}} +{\renewcommand{\LANGcmd}{matlab} \inlnR[#1]{#2}[#3][#4]} -\NewDocumentCommand{\runMatlabIncOut} -{O{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","#2")'} m O{} O{} O{vbox}} -{\def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","#2")'} - \ifstrequal{#1}{\runcmd} - {\runCodeIncOut{#1}{}[#3][#4][#5]} - {\runCodeIncOut{#1}{#2}[#3][#4][#5]}} +\NewDocumentCommand{\runMatLabChunk}{O{} m m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{matlab} \runRChunk[#1]{#2}{#3}[#4][#5][#6]} -\NewDocumentCommand{\inlnMatlab}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","matlab","\tmpname.txt")'} m O{} O{inline}}{\IfBeginWith{#2}{```}{\inln{python3 -c 'from talk2stat.talk2stat import client;rc0="""#2""";rc0=rc0.lstrip("```").rstrip("```");client("./","matlab",f"```{rc0}```")'}{#2}[#3][#4]}{\inln{#1}{#2}[#3][#4]}} % Python -\NewDocumentCommand{\runPython}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","python","#2")'} m m O{}} -{ - \def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","python","#2")'} - \ifstrequal{#1}{\runcmd} - {\runExtCode{#1}{}{#3}[#4]} - {\runExtCode{#1}{#2}{#3}[#4]} -} +\NewDocumentCommand{\runPython}{O{} m m O{}} +{\renewcommand{\LANGcmd}{python} \runR[#1]{#2}{#3}[#4]} + +\NewDocumentCommand{\runPythonIncOut}{O{} m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{python} \runRIncOut[#1]{#2}[#3][#4][#5]} -\NewDocumentCommand{\runPythonIncOut} -{O{python3 -c 'from talk2stat.talk2stat import client; client("./","python","#2")'} m O{} O{} O{vbox}} -{\def\runcmd{python3 -c 'from talk2stat.talk2stat import client; client("./","python","#2")'} - \ifstrequal{#1}{\runcmd} - {\runCodeIncOut{#1}{}[#3][#4][#5]} - {\runCodeIncOut{#1}{#2}[#3][#4][#5]}} +\NewDocumentCommand{\inlnPython}{O{} m O{} O{inline}} +{\renewcommand{\LANGcmd}{python} \inlnR[#1]{#2}[#3][#4]} -\NewDocumentCommand{\inlnPython}{O{python3 -c 'from talk2stat.talk2stat import client; client("./","python","\tmpname.txt")'} m O{} O{inline}}{\IfBeginWith{#2}{```}{\inln{python3 -c 'from talk2stat.talk2stat import client;rc0="""#2""";rc0=rc0.lstrip("```").rstrip("```");client("./","python",f"```{rc0}```")'}{#2}[#3][#4]}{\inln{#1}{#2}[#3][#4]}} +\NewDocumentCommand{\runPythonChunk}{O{} m m O{} O{} O{vbox}} +{\renewcommand{\LANGcmd}{python} \runRChunk[#1]{#2}{#3}[#4][#5][#6]} %%%%%%%% @@ -503,4 +543,4 @@ } -\endinput \ No newline at end of file +\endinput diff --git a/macros/latex/contrib/runcode/runcode.tex b/macros/latex/contrib/runcode/runcode.tex index 89c7acd6aa..23f833bdf5 100644 --- a/macros/latex/contrib/runcode/runcode.tex +++ b/macros/latex/contrib/runcode/runcode.tex @@ -1,4 +1,4 @@ -% LaTeX Package: runcode 2023/06/23 v2.0 +% LaTeX Package: runcode 2023/09/08 v2.2 % % Copyright (C) 2020-2023 by Haim Bar and HaiYing Wang % @@ -49,7 +49,7 @@ package’s github repository, at \url{https://github.com/Ossifragus/runcode}. \end{abstract} \section{Installation} -\label{sec:org594ce40} +\label{sec:org6031edc} You can simply put the runcode.sty file in the \LaTeX{} project folder. The server mode requires the @@ -65,9 +65,9 @@ compiling a \LaTeX{} document. \section{Usage} -\label{sec:org826d1b1} +\label{sec:org46d9194} \subsection{Load the package:} -\label{sec:orgfba21b6} +\label{sec:orgdf4d2a5} \begin{minted}[]{latex} \usepackage[options]{runcode} \end{minted} @@ -139,7 +139,7 @@ be customized with \texttt{\textbackslash{}tcbset}, \end{minted} \subsection{Basic commands:} -\label{sec:org9a60003} +\label{sec:org1eb4192} \begin{itemize} \item \texttt{\textbackslash{}runExtCode\{Arg1\}\{Arg2\}\{Arg3\}[Arg4]} runs an external code. @@ -203,11 +203,27 @@ output file in \texttt{Arg3} exists: the cached result will be used and the code will not run. \end{itemize} \end{itemize} + +\item \texttt{\textbackslash{}showChunk\{Arg1\}\{Arg2\}[Arg3][Arg4]} prints a selected chunk from source +code. The chunk is identified in the source code by two strings that define +the beginning and end of the chunk. The default beginning is \texttt{label===} +where \texttt{} should be a unique user-defined chunk ID. The default end marker is +\texttt{===end}. In the code, these markers should appear after a comment character, so +that the code will run. + +\begin{itemize} +\item \texttt{Arg1} is the programming language. +\item \texttt{Arg2} is the source file name. +\item \texttt{Arg3} is is the chunk identifier. +\item \texttt{Arg4} and \texttt{Arg5} are the beginning and end markings of a chunk (optional with +default \texttt{label==} and \texttt{===end}. +\end{itemize} \end{itemize} + \subsection{Extended commands:} -\label{sec:org57656ef} +\label{sec:org2e715a7} \begin{itemize} \item \texttt{\textbackslash{}runCodeIncOut\{Arg1\}\{Arg2\}[Arg3][Arg4][Arg5]} runs an external code and embeds the output. This is a combination of \texttt{\textbackslash{}runExtCode} and \texttt{\textbackslash{}includeOutput}. @@ -224,89 +240,56 @@ functionality is the same as that of \texttt{Arg3} of \texttt{\textbackslash{}in \end{itemize} \subsection{Language specific shortcuts:} -\label{sec:org9f79956} -\href{https://julialang.org/}{Julia} +\label{sec:org04ff6f1} +Replace \texttt{LANG} with \texttt{Julia}, \texttt{MatLab}, \texttt{Python}, or \texttt{R}, for the \href{https://julialang.org/}{Julia}, \href{https://www.mathworks.com/products/matlab.html}{MatLab}, \href{https://www.python.org/}{Python}, \href{https://www.r-project.org/}{R} +language, respectively, for the following commands. \begin{itemize} -\item \texttt{\textbackslash{}runJulia[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external \href{https://julialang.org/}{Julia} code file. +\item \texttt{\textbackslash{}runLANG[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external \texttt{LANG} code file. \begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://julialang.org/}{Julia} server by default. +\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \texttt{LANG} server by default. \item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command \texttt{\textbackslash{}runExtCode}. \end{itemize} -\item \texttt{\textbackslash{}runJuliaIncOut[Arg1]\{Arg2\}[Arg3][Arg4][Arg5]} runs an external \href{https://julialang.org/}{Julia} code +\item \texttt{\textbackslash{}runLANGIncOut[Arg1]\{Arg2\}[Arg3][Arg4][Arg5]} runs an external \texttt{LANG} code file and embeds the output. \begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://julialang.org/}{Julia} server by default. +\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \texttt{LANG} server by default. \item \texttt{Arg2}, \texttt{Arg3}, \texttt{Arg4}, and \texttt{Arg5} have the same effects as those of the command \texttt{\textbackslash{}runCodeIncOut}. \end{itemize} -\item \texttt{\textbackslash{}inlnJulia[Arg1]\{Arg2\}[Arg3][Arg4]} runs \href{https://julialang.org/}{Julia} source code (\texttt{Arg2}) and displays +\item \texttt{\textbackslash{}inlnLANG[Arg1]\{Arg2\}[Arg3][Arg4]} runs \texttt{LANG} source code (\texttt{Arg2}) and displays the output in line. \begin{itemize} -\item \texttt{Arg1} is optional and uses the \href{https://julialang.org/}{Julia} server by default. -\item \texttt{Arg2} is the \href{https://julialang.org/}{Julia} source code to run. If the \href{https://julialang.org/}{Julia} source code is wrapped +\item \texttt{Arg1} is optional and uses the \texttt{LANG} server by default. +\item \texttt{Arg2} is the \texttt{LANG} source code to run. If the \texttt{LANG} source code is wrapped between "\texttt{```}" on both sides (as in the markdown grammar), then it will be implemented directly; otherwise the code will be written to a file on the disk and then be called. \item \texttt{Arg3} and \texttt{Arg4} have the same effects as those of the basic command \texttt{\textbackslash{}inln}. \end{itemize} -\end{itemize} -\href{https://www.mathworks.com/products/matlab.html}{MatLab} - -\begin{itemize} -\item \texttt{\textbackslash{}runMatLab[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external \href{https://www.mathworks.com/products/matlab.html}{MatLab} code file. -\begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.mathworks.com/products/matlab.html}{MatLab} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command -\texttt{\textbackslash{}runExtCode}. -\end{itemize} -\item \texttt{\textbackslash{}runMatLabIncOut[Arg1]\{Arg2\}[Arg3][Arg4][Arg5]} runs an external \href{https://www.mathworks.com/products/matlab.html}{MatLab} code -file and embeds the output. +\item \texttt{\textbackslash{}runLANGChunk[Arg1]\{Arg2\}\{Arg3\}[Arg4][Arg5][Arg6]} runs a selected chunk from +an external \texttt{LANG} code file and embeds the output. \begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.mathworks.com/products/matlab.html}{MatLab} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, \texttt{Arg4}, and \texttt{Arg5} have the same effects as those of the command -\texttt{\textbackslash{}runCodeIncOut}. -\end{itemize} -\item \texttt{\textbackslash{}inlnMatLab[Arg1]\{Arg2\}[Arg3][Arg4]} runs \href{https://www.mathworks.com/products/matlab.html}{MatLab} source code (\texttt{Arg2}) and -displays the output in line. -\begin{itemize} -\item \texttt{Arg1} is optional and uses the \href{https://www.mathworks.com/products/matlab.html}{MatLab} server by default. -\item \texttt{Arg2} is the \href{https://www.mathworks.com/products/matlab.html}{MatLab} source code to run. If the \href{https://www.mathworks.com/products/matlab.html}{MatLab} source code is wrapped -between "```" on both sides (as in the markdown grammar), then it will be -implemented directly; otherwise the code will be written to a file on the -disk and then be called. -\item \texttt{Arg3} and \texttt{Arg4} have the same effects as those of the basic command \texttt{\textbackslash{}inln}. +\item \texttt{Arg1} (optional ) uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \texttt{LANG} server by default. +\item \texttt{Arg2} is the source file name. +\item \texttt{Arg3} is is the chunk identifier. +\item \texttt{Arg4} (optional) controls whether to run the code. +\item \texttt{Arg5} (optional) is the output file name. +\item \texttt{Arg6} (optional) controls the type of output with a default value \texttt{vbox}. \end{itemize} \end{itemize} -\href{https://www.python.org/}{Python} +For example, +\begin{minted}[]{latex} +\runR{code/MontyHall_1.R}{montyhall-R1} +\runRIncOut{code/MontyHall_1.R}[][montyhall-R1] +\end{minted} + +Specifically for \href{https://www.python.org/}{Python}, \begin{itemize} -\item \texttt{\textbackslash{}runPython[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external \href{https://www.python.org/}{Python} code file. -\begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.python.org/}{Python} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command -\texttt{\textbackslash{}runExtCode}. -\end{itemize} -\item \texttt{\textbackslash{}runPythonIncOut[Arg1]\{Arg2\}[Arg3][Arg4][Arg5]} runs an external \href{https://www.python.org/}{Python} code -file and embeds the output. -\begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.python.org/}{Python} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, \texttt{Arg4}, and \texttt{Arg5} have the same effects as those of the command -\texttt{\textbackslash{}runCodeIncOut}. -\end{itemize} -\item \texttt{\textbackslash{}inlnPython[Arg1]\{Arg2\}[Arg3][Arg4]} runs \href{https://www.python.org/}{Python} source code (\texttt{Arg2}) and -displays the output in line. -\begin{itemize} -\item \texttt{Arg1} is optional and uses the \href{https://www.python.org/}{Python} server by default. -\item \texttt{Arg2} is the \href{https://julialang.org/}{Julia} source code to run. If the \href{https://www.python.org/}{Python} source code is wrapped -between "```" on both sides (as in the markdown grammar), then it will be -implemented directly; otherwise the code will be written to a file on the -disk and then be called. -\item \texttt{Arg3} and \texttt{Arg4} have the same effects as those of the basic command \texttt{\textbackslash{}inln}. -\end{itemize} \item \texttt{\textbackslash{}runPythonBatch[Arg1][Arg2]} runs an external \href{https://www.python.org/}{Python} code file in batch mode (without a server running). Python (at least currently), unlike the other languages we use, does not have an option to save and restore a session, which @@ -320,47 +303,24 @@ installed via \texttt{pip3 install dill}. \end{itemize} \end{itemize} -\href{https://www.r-project.org/}{R} - -\begin{itemize} -\item \texttt{\textbackslash{}runR[Arg1]\{Arg2\}\{Arg3\}[Arg4]} runs an external \href{https://www.r-project.org/}{R} code file. -\begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.r-project.org/}{R} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, and \texttt{Arg4} have the same effects as those of the basic command -\texttt{\textbackslash{}runExtCode}. -\end{itemize} - -\item \texttt{\textbackslash{}runRIncOut[Arg1]\{Arg2\}[Arg3][Arg4][Arg5]} runs an external \href{https://www.r-project.org/}{R} code file and -embeds the output. -\begin{itemize} -\item \texttt{Arg1} is optional and uses \href{https://pypi.org/project/talk2stat/}{talk2stat}'s \href{https://www.r-project.org/}{R} server by default. -\item \texttt{Arg2}, \texttt{Arg3}, \texttt{Arg4}, and \texttt{Arg5} have the same effects as those of the command -\texttt{\textbackslash{}runCodeIncOut}. -\end{itemize} - -\item \texttt{\textbackslash{}inlnR[Arg1]\{Arg2\}[Arg3][Arg4]} runs \href{https://www.r-project.org/}{R} -source code (\texttt{Arg2}) and displays the output in line. -\begin{itemize} -\item \texttt{Arg1} is optional and uses the \href{https://www.r-project.org/}{R} server by default. -\item \texttt{Arg2} is the \href{https://www.r-project.org/}{R} source code to run. If the \href{https://www.r-project.org/}{R} source code is wrapped between -"```" on both sides (as in the markdown grammar), then it will be -implemented directly; otherwise the code will be written to a file on the -disk and then be called. -\item \texttt{Arg3} and \texttt{Arg4} have the same effects as those of the basic command \texttt{\textbackslash{}inln}. -\end{itemize} -\end{itemize} - \section{Revisions} -\label{sec:orga78221a} +\label{sec:orgae938b1} \begin{itemize} +\item v2.2, September 8, 2023: add \texttt{\textbackslash{}showChunk} basic command and \texttt{\textbackslash{}runLANGChunk} +commands for multiple languages. +\item v2.1, June 30, 2023: detokenize code which is passed to \texttt{\textbackslash{}inln}. This is +necessary when the code contains special latex characters like backslash. +These characters are escaped by latex when they are passed to macros as arguments, +which, in the case of \texttt{\textbackslash{}inln}, alters the correct syntax and causes execution errors. +Detokenizing ensures that the code is passed as-is to R/Julia/MatLab/Python. +We thank \href{https://github.com/kiryph}{kiryph} for reporting the issue. \item v2.0, June 23, 2023: add \texttt{\textbackslash{}runCodeIncOut} command that runs an external code and embeds the output and andd some language specific shortcuts; update \texttt{\textbackslash{}runExtCode} so that if the output file does not exist, the \texttt{cache} option will be overridden and the code will run; update \texttt{\textbackslash{}inln} so that its \texttt{Arg4} accept \texttt{cache} or appending \texttt{.cache} to use the cached result. We thank \href{https://github.com/kiryph}{kiryph} for suggesting these features. - \item v1.9, June 13, 2023: update \texttt{\textbackslash{}inln} command; the optional \texttt{Arg3} is the output file name and the optional \texttt{Arg4} is the output type. \item v1.8, January 18, 2023, add support to \href{https://ctan.org/pkg/listings?lang=en}{listings.} @@ -381,7 +341,7 @@ code files, zero bytes in output files.) \end{itemize} \section{Contributing} -\label{sec:org097e6a5} +\label{sec:org9eb0902} We welcome your contributions to this package by opening issues on GitHub and/or making a pull request. We also appreciate more example documents written using \texttt{runcode}. diff --git a/macros/latex/contrib/ucph-revy/README.md b/macros/latex/contrib/ucph-revy/README.md new file mode 100644 index 0000000000..924322a797 --- /dev/null +++ b/macros/latex/contrib/ucph-revy/README.md @@ -0,0 +1,81 @@ +Package ucph-revy +================= +v1.0.0 + +A class for typesetting scripts, containing both lyrics and prose, in +the style used by the student revues (revy) at the Faculties of +Science at the University of Copenhagen (uchp). + +Installation +------------ + +To install the class, you should run the file + + ucph-revy.ins + +through LaTeX. This will create the file `ucph-revy.cls`, which you +should place in a location searched by LaTeX. In the TeX Directory +Structure, it belongs in the folder `tex/latex/ucph-revy/`. + +Generating documentation +------------------------ + +You may want to generate either the user manual (which will provide +instructions and examples on how to use the class) or the full +documentation (which will provide the user manual along with a full +source listing), in either danish or english. + +For each of these options, there is an `.ins` file that can be run +through LaTeX. To get the indexes and citations right, you will need +to run some combination of `bibtex` and `makeindex`, and then run the +`.ins` file through LaTeX a few more times, until the references +settle down. The individual `.ins` files should output instructions on +the specific commands that need to be run to get them right, in their +console output. + +The `.ins` files are: + +#### `ucph-revy-man-da.ins` #### +- Creates the user manual in danish. + +#### `ucph-revy-doc-da.ins` #### +- Creates the full documentation in danish. + +#### `ucph-revy-man-en.ins` #### +- Creates the user manual in english. + +#### `ucph-revy-doc-en.ins` #### +- Creates the full documentation in english. + +There are a few more `.ins` files, that pull some example `.tex` files +out of the main `.dtx` file: + +#### `ucph-revy-ex-da.ins` #### +- Creates `Eksempel.tex`, an example usage file in danish. + +#### `ucph-revy-ex-en.ins` #### +- Creates `Example.tex`, and example usage file in english. + +#### `ucph-revy-ex-thumb.ins` #### +- Creates `Thumbindex.tex`, a file that demonstrates how to use the + thumb index feature to create a thumb index page. + +Contact the author +------------------ + +As of 2023: + +[Kristoffer Levin Hansen](mailto:kristoffer@levinhansen.dk) + +License +------- + +This file may be distributed and/or modified under the conditions of +the LaTeX Project Public License, either version 1.3 of this license +or (at your option) any later version. The latest version of this +license is in: + + + +and version 1.3 or later is part of all distributions of LaTeX version +2005/12/01 or later. diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.ins b/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.ins new file mode 100644 index 0000000000..03271ceede --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.ins @@ -0,0 +1,39 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\makeatletter +\begingroup + \input docstrip.tex + \batchinput{ucph-revy-ex-da.ins} +\endgroup +\def\revy@doclang{danish} +\input{ucph-revy.dtx} +\hypersetup{pdftitle=Dokumentation til klassen ucph-revy} +\begin{document} +\DocInput{ucph-revy.dtx} + \typeout{**************************************************} + \typeout{*} + \typeout{* Hvis du ikke allerede har gjort det, så har du} + \typeout{* nok lyst til at køre de følgende kommandoer, for} + \typeout{* at generere bibliografien, versionshistorien} + \typeout{* og indekset:} + \typeout{*} + \typeout{* \space bibtex ucph-revy-da-doc} + \typeout{* \space makeindex -s gind.ist -o ucph-revy-da-doc.ind ucph-revy-da-doc.idx} + \typeout{* \space makeindex -s gglo.ist -o ucph-revy-da-doc.gls ucph-revy-da-doc.glo} + \typeout{*} + \typeout{* Kør så denne fil igennem LaTeX igen.} + \typeout{*} + \typeout{* Happy TeXing!} + \typeout{**************************************************} +\end{document} diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.pdf b/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.pdf new file mode 100644 index 0000000000..d6304aedad Binary files /dev/null and b/macros/latex/contrib/ucph-revy/ucph-revy-da-doc.pdf differ diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-da-man.ins b/macros/latex/contrib/ucph-revy/ucph-revy-da-man.ins new file mode 100644 index 0000000000..9b32bbc04a --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-da-man.ins @@ -0,0 +1,38 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\makeatletter +\begingroup + \input docstrip.tex + \batchinput{ucph-revy-ex-da.ins} +\endgroup +\def\revy@doclang{danish} +\AtBeginDocument{\OnlyDescription} +\input{ucph-revy.dtx} +\hypersetup{pdftitle=Manual til klassen ucph-revy} +\begin{document} +\DocInput{ucph-revy.dtx} + \typeout{**************************************************} + \typeout{*} + \typeout{* Hvis du ikke allerede har gjort det, så har du} + \typeout{* nok lyst til at køre de følgende kommandoer, for} + \typeout{* at generere bibliografien og versionshistorien:} + \typeout{*} + \typeout{* \space bibtex ucph-revy-da-man} + \typeout{* \space makeindex -s gglo.ist -o ucph-revy-da-man.gls ucph-revy-da-man.glo} + \typeout{*} + \typeout{* Kør så denne fil igennem LaTeX igen.} + \typeout{*} + \typeout{* Happy TeXing!} + \typeout{**************************************************} +\end{document} diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-da-man.pdf b/macros/latex/contrib/ucph-revy/ucph-revy-da-man.pdf new file mode 100644 index 0000000000..b6870962ad Binary files /dev/null and b/macros/latex/contrib/ucph-revy/ucph-revy-da-man.pdf differ diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.ins b/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.ins new file mode 100644 index 0000000000..79e71673cb --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.ins @@ -0,0 +1,38 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\makeatletter +\begingroup + \input docstrip.tex + \batchinput{ucph-revy-ex-en.ins} +\endgroup +\def\revy@doclang{english} +\input{ucph-revy.dtx} +\hypersetup{pdftitle=Documentation for the class ucph-revy} +\begin{document} +\DocInput{ucph-revy.dtx} + \typeout{**************************************************} + \typeout{*} + \typeout{* If you haven't already done so, you will want to} + \typeout{* run the following commands to generate the} + \typeout{* bibliography and version history:} + \typeout{*} + \typeout{* \space bibtex ucph-revy-en-doc} + \typeout{* \space makeindex -s gind.ist -o ucph-revy-en-doc.ind ucph-revy-en-doc.idx} + \typeout{* \space makeindex -s gglo.ist -o ucph-revy-en-doc.gls ucph-revy-en-doc.glo} + \typeout{*} + \typeout{* Then run this file through LaTeX again.} + \typeout{*} + \typeout{* Happy TeXing!} + \typeout{**************************************************} +\end{document} diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.pdf b/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.pdf new file mode 100644 index 0000000000..8a79c71e8a Binary files /dev/null and b/macros/latex/contrib/ucph-revy/ucph-revy-en-doc.pdf differ diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-en-man.ins b/macros/latex/contrib/ucph-revy/ucph-revy-en-man.ins new file mode 100644 index 0000000000..584c3cb573 --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-en-man.ins @@ -0,0 +1,38 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\makeatletter +\begingroup + \input docstrip.tex + \batchinput{ucph-revy-ex-en.ins} +\endgroup +\def\revy@doclang{english} +\AtBeginDocument{\OnlyDescription} +\input{ucph-revy.dtx} +\hypersetup{pdftitle=Manual for the class ucph-revy} +\begin{document} +\DocInput{ucph-revy.dtx} + \typeout{**************************************************} + \typeout{*} + \typeout{* If you haven't already done so, you will want to} + \typeout{* run the following commands to generate the} + \typeout{* bibliography and version history:} + \typeout{*} + \typeout{* \space bibtex ucph-revy-en-man} + \typeout{* \space makeindex -s gglo.ist -o ucph-revy-en-man.gls ucph-revy-en-man.glo} + \typeout{*} + \typeout{* Then run this file through LaTeX again.} + \typeout{*} + \typeout{* Happy TeXing!} + \typeout{**************************************************} +\end{document} diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-en-man.pdf b/macros/latex/contrib/ucph-revy/ucph-revy-en-man.pdf new file mode 100644 index 0000000000..02766561f2 Binary files /dev/null and b/macros/latex/contrib/ucph-revy/ucph-revy-en-man.pdf differ diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-ex-da.ins b/macros/latex/contrib/ucph-revy/ucph-revy-ex-da.ins new file mode 100644 index 0000000000..7b46ec9ff9 --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-ex-da.ins @@ -0,0 +1,34 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/ucph-revy} +\askforoverwritefalse +\preamble + +See the generating file for its conditions on distribution and reuse. + +Also, for this file by itself, to the extent possible under law, +Kristoffer Levin Hansen has waived all copyright and related or +neighboring rights to Example.tex. This work is published from: +Denmark. + +http://creativecommons.org/publicdomain/zero/1.0/ + +Note that this file probably contains text, characters and situations +covered by copyright beloninging to other entities. + +\endpreamble +\generate{\file{Eksempel.tex}{\from{ucph-revy.dtx}{ex-da}}} +\endbatchfile diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-ex-en.ins b/macros/latex/contrib/ucph-revy/ucph-revy-ex-en.ins new file mode 100644 index 0000000000..06837bbc3f --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-ex-en.ins @@ -0,0 +1,34 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/ucph-revy} +\askforoverwritefalse +\preamble + +See the generating file for its conditions on distribution and reuse. + +Also, for this file by itself, to the extent possible under law, +Kristoffer Levin Hansen has waived all copyright and related or +neighboring rights to Example.tex. This work is published from: +Denmark. + +http://creativecommons.org/publicdomain/zero/1.0/ + +Note that this file probably contains text, characters and situations +covered by copyright beloninging to other entities. + +\endpreamble +\generate{\file{Example.tex}{\from{ucph-revy.dtx}{ex-en}}} +\endbatchfile diff --git a/macros/latex/contrib/ucph-revy/ucph-revy-ex-thumb.ins b/macros/latex/contrib/ucph-revy/ucph-revy-ex-thumb.ins new file mode 100644 index 0000000000..0ff6f4672e --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy-ex-thumb.ins @@ -0,0 +1,34 @@ +%% +%% Copyright (C) 2023 Kristoffer Levin Hansen +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +\input docstrip.tex +\keepsilent +\usedir{tex/latex/ucph-revy} +\askforoverwritefalse +\preamble + +Copyright (C) 2023 Kristoffer Levin Hansen + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in: + +http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +\endpreamble +\generate{\file{Thumbindex.tex}{\from{ucph-revy.dtx}{registerindex}}} +\endbatchfile diff --git a/macros/latex/contrib/ucph-revy/ucph-revy.bib b/macros/latex/contrib/ucph-revy/ucph-revy.bib new file mode 100644 index 0000000000..ba3d6ce910 --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy.bib @@ -0,0 +1,27 @@ +@Booklet{tttikz, + title = {The {TikZ} and {PGF} Packages}, + author = {Till Tantau}, + howpublished = {\url{https://mirrors.dotsrc.org/ctan/graphics/pgf/base/doc/pgfmanual.pdf}}} +@Book{tikz, + author = {Till Tantau}, + title = {The {TikZ} and {PGF} Packages}, + publisher = {\url{https://mirrors.dotsrc.org/ctan/graphics/pgf/base/doc/pgfmanual.pdf}}, + year = 2023} +@InBook{eijkhout:toksstack, + author = {Victor Eijkhout}, + title = {{\TeX} by Topic}, + chapter = {14.5.1}, + publisher = {\url{https://github.com/VictorEijkhout/tex-by-topic/raw/main/TeXbyTopic.pdf}}, + year = 2019} +@InBook{eijkhout:hop, + author = {Victor Eijkhout}, + title = {{\TeX} by Topic}, + chapter = {13.8.6}, + publisher = {\url{https://github.com/VictorEijkhout/tex-by-topic/raw/main/TeXbyTopic.pdf}}, + year = 2019} + +@Misc{overleaf:classpackage, + author = {Overleaf}, + title = {Understanding packages and class files}, + howpublished = {\url{https://www.overleaf.com/learn/latex/Understanding_packages_and_class_files}}} + diff --git a/macros/latex/contrib/ucph-revy/ucph-revy.dtx b/macros/latex/contrib/ucph-revy/ucph-revy.dtx new file mode 100644 index 0000000000..56d3fb6c6d --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy.dtx @@ -0,0 +1,3339 @@ +% \iffalse meta-comment +% +% Copyright (C) 1995 Arne John Glenstrup +% 2000 Uffe Friis Lichtenberg +% 2023 Kristoffer Levin Hansen +% +% This file may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3 of this license or (at your option) any later +% version. The latest version of this license is in: +% +% http://www.latex-project.org/lppl.txt +% +% and version 1.3 or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +%<*driver> +\ProvidesFile{ucph-revy.dtx} +% +%\NeedsTeXFormat{LaTeX2e}[2005/12/01] +%\ProvidesClass{ucph-revy} +%<*class> + [2023/05/23 v1.0.0 Initial publish] +% +%<*driver> +\documentclass[a4paper]{ltxdoc} +\makeatletter + +\usepackage[\revy@doclang]{babel} +\usepackage{iflang} +\usepackage{calc} +\usepackage{fancyvrb} +\usepackage{hypdoc} +\usepackage{tabulary} +\usepackage{tikz} +\usepackage{caption} +\DeclareCaptionFormat{revy}{% + \hfill{\bfseries\sffamily\small #1\hspace{-1cm}} + + \footnotesize{#3} +} +\captionsetup[figure]{format=revy} +\let\oldfigure=\figure +\let\oldendfigure=\endfigure +\renewenvironment{figure}[1][]{ + \oldfigure[#1] + \rule{\textwidth + 1cm}{.5pt} + + \vspace*{-.8em}\caption{}% + \let\oldcaption\caption + \def\caption##1{ + \let\caption\oldcaption + \par\rule{\textwidth + 1cm}{1pt} + \par\vspace*{-.4em} + \caption*{##1}}% + + \vspace*{-1.5em}% +}{ + \oldendfigure +} +\bibliographystyle{plain} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\long\def\jump#1\land{} +\newenvironment{implementation}{% + \par\pagebreak[2]\noindent + \interlinepenalty 100% + \let\imppar=\par + \def\par{\penalty 100\imppar}% + \rule{\textwidth + 1cm}{.5pt}% + \makebox[0pt][r]{% + \hfill\small\raisebox{-1em}{\bfseries{\sffamily{% + \IfLanguageName{danish}{Implementering}{Implementation}% + }}}% + }\par\nopagebreak% +}{% + \par\noindent% + \raisebox{.7em}{\rule{\textwidth + 1 cm}{1pt}}% + \par\pagebreak[2]% +} +\IfLanguageName{danish}{ + \newenvironment{danish}{\relax}{\relax} + \newenvironment{english}{% + \long\def\totheend##1\end##2{% + \IfStrEq{english}{##2}{\end{english}}{\totheend}}% + \totheend + }{\relax} +}{ + \newenvironment{english}{\relax}{\relax} + \newenvironment{danish}{% + \long\def\totheend##1\end##2{% + \IfStrEq{danish}{##2}{\end{danish}}{\totheend}}% + \totheend + }{\relax} +} +\newenvironment{showcommand}{\quote}{\endquote} +\usepackage{hyperref} +\urlstyle{sf} +% +%<*class> +% +% \fi +% \begingroup +% ^^A we'll just hijack some functionality here... +% \let\endinput\relax +% \MaybeStop{ +% \gdef\implementation{% +% \def\decide##1{% +% \IfStrEq{implementation}{##1}% +% {\end{implementation}}% +% { \catcode`\{=12 \catcode`\}=12 +% \totheend +% } +% } +% \long\def\totheend##1\end{% +% \catcode`\{=1 \catcode`\}=2 +% \decide +% } +% \catcode`\{=12 \catcode`\}=12 +% \totheend +% } +% \gdef\endimplementation{\relax} +% } +%\endgroup +% +% \changes{v1.0.0}{2023/05/23}{Initial conversion to a class} +% +% \GetFileInfo{ucph-revy.dtx} +% +% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ ,\,,\/,\TeX,\LaTeX} +% \DoNotIndex{\@ne} +% \DoNotIndex{\fi,\else} +% \DoNotIndex{\advance,\begingroup,\catcode,\closein,\end,\begin} +% \DoNotIndex{\closeout,\day,\def,\edef,\else,\empty,\endgroup,\xdef} +% \DoNotIndex{\newcommand,\renewcommand,\newenvironment,\renewenvironment} +% +% \newcommand{\cn}{\textsf{ucph--revy}} +% +% \title{\begin{english}The \cn\ class\end{english}\begin{danish} +% Klassen \cn\end{danish}\thanks{This document corresponds to +% \cn~\fileversion, dated \filedate.}} +% \author{Kristoffer Levin Hansen \\ +% \href{mailto:kristoffer@levinhansen.dk}{\sf kristoffer@levinhansen.dk}} +% +% \maketitle +% +% \begin{abstract} +% \IfLanguageName{danish}{ +% En klasse, som kommer med kommer med kommandoerne til at typesætte +% et manuskript i den stil, som bruges blandt SaTyR--revyerne ved +% Science på Københavns Universitet. Tidligere kendt som +% \texttt{revy.sty}. +% }{ +% A \LaTeX\ class for typesetting scripts in the style used for +% student theatric productions at the University of Copenhagen's +% (ucph) science faculties. Formerly known to some as +% \texttt{revy.sty}. } +% \end{abstract} +% +% \tableofcontents +% +% \begin{figure}[p] +% \centering +% \newtoks\tabtoks +% \tabtoks={\undertab 0\text Akt 1\stop\overtab 1\text Introsang\stop\overtab 2\text Eksempel\stop\overtab 3\text Example\stop\overtab 4\text Studiepolitisk indlæg\stop\undertab 4\text Akt 2\stop\overtab 5\text Noget om kvant\stop\overtab 6\text Sang til en forelæser\stop\undertab 6\text Ekstranumre\stop\overtab 7\text Under bæltestedet\stop\undertab 7\text\done\stop} +% \edef\revy@tabs{\the\tabtoks} +% \let\LARGE\small +% \let\Large\footnotesize +% \let\large\scriptsize +% \tiny +% \renewenvironment{document}{}{} +% \IfLanguageName{danish}{\exDaPre}{} +% \IfLanguageName{english}{\exEnPre}{} +% \paperheight 90em +% \def\rectoheaderthumbtab{% +% \vspace*{-82em} +% \revy@thumbindex{ +% \tabheight 11.5em +% \def\overtableft{-0.4cm} +% \def\overtabright{0.1cm} +% \def\undertableft{\overtableft - 0.4cm} +% \def\underlabeloffset{\undersign.2cm} +% \filtername{\@title} +% } +% \hspace{-8.1em}% +% }% +% \begin{minipage}[t][\textheight]{\textwidth} +% \vfill +% \hspace{-4cm} +% \fbox{ +% \hspace{1cm} +% \begin{minipage}[t][81em]{.55\textwidth} +% \def\getpagerefnumber#1{2} +% \let\maketitle\class@maketitle +% \vbox to 0pt{\vss +% \hbox to \textwidth {\hfil\rectoheaderthumbtab }} +% \vspace{8em} +% \begin{danish} +% \exDaPOne +% \end{danish} +% \begin{english} +% \exEnPOne +% \end{english} +% \vspace{1em} +% \end{minipage} +% \hspace{1cm} +% } +% \fbox{ +% \hspace{1cm} +% \begin{minipage}[t][81em]{.55\textwidth} +% \ps@revyheadings +% \let\thepage=2 +% \def\pageref#1{2} +% \vspace{3em} +% \@oddhead +% \begin{danish} +% \exDaPTwo +% \exDaPThree +% \exDaPFour +% \end{danish} +% \begin{english} +% \exEnPTwo +% \exEnPThree +% \exEnPFour +% \end{english} +% \end{minipage} +% \hspace{1cm} +% } +% \hspace*{-15cm} +% +% \vfill +% +% \caption{ +% \begin{danish} +% Et eksempel på, hvad denne klasse kan bruges til at +% lave. +% \end{danish} +% \begin{english} +% An example of what this class can be used to create. +% \end{english} +% }\label{eksempel}\label{example} +% \end{minipage} +% \end{figure} +% +% \begin{danish} +% \section{Introduktion} +% +% I umindelige tider har studenterrevyerne på KU Science brugt den +% samme stil til at typesætte deres manuskripter. Den har indtil nu +% boet i filen \texttt{revy.sty}, som er blevet det rundt mellem +% revyster og revytter i andægtig stilhed. Den her klasse bibeholder +% funtionaliteten fra \texttt{revy.sty}, men implementerer den nu i +% dens korrekte plads i \LaTeX--hierakiet, som en +% klasse\cite{overleaf:classpackage}, og med et mere beskrivende +% navn, så den kan udgives i en pakkesamling. +% +% Klassen kan sætte både talt dialog og sangtekster, med +% rolleangivelse, og kommer med en bestemt stil til titler, +% sidehoveder og ting som rolle- og rekvisitlister. +% +% Et eksempel på, hvordan manuskripter skrevet i vores stil ser ud, +% er gengivet i figur \ref{eksempel}. Den er tiltænkt til brug i en +% revy, hvor hvert nummer lever sit eget liv indtil ret sent i +% processen. Derfor er hvert nummer sit eget dokument, med egen +% titel og andre informationer, og samlingen til et færdigt \TeX +% hæfte er ikke inden for klassens emnefelt. +% +% Vi har også lavet en programpakke, som står for at lave et samlet +% \TeX hæfte ud af en samling af \texttt{.tex}--filer (som bruger +% den her dokumentklasse). Den er sidst set på adressen +% \end{danish} +% \begin{english} +% \section{Introduction} +% +% A style of typesetting scripts in \LaTeX, originally developed for +% DIKURevy, the students' revue at DIKU, the Computer Scinece +% Institute at ucph, the University of Copenhagen. It has spread to +% adjacent revues at ucph Science as they have sprung into +% existence. Once known to its users as the package +% \texttt{revy.sty}, that package has been transplanted into this +% class, at the proper place in the \LaTeX\ +% hierarchy\cite{overleaf:classpackage}, practically in its +% entirety. +% +% This class features the ability to set lines of dialogue and song +% lyrics with a clearly associated indication of the speaker or +% singer, along with stage directions. The style is intended for a +% revue, which is formed out of a number of little pieces, so there +% commands for typesetting a cast list and prop list, along with +% relevant information like the time to perform, or the name of a +% larger piece, which are intended to be typeset along with the +% title. +% +% Figure \ref{eksempel} shown an example of how all this looks when +% typeset. +% +% If you're looking for the script package that's designed to help +% with typesetting and compositing a full manuscript, it was last +% seen at +% \end{english}^^A +% \url{https://github.com/fysikrevy/fysikrevytex}. +% +% \begin{danish}^^A +% Ifølge \texttt{revy.sty} var de originale forfattere +% \end{danish}^^A +% \begin{english}^^A +% According to \texttt{revy.sty}, its origianl authors were +% \end{english}^^A +% Uffe Friis Lichtenberg, Arne John Glenstrup +% \begin{danish}^^A +% og +% \end{danish}^^A +% \begin{english} +% and +% \end{english}^^A +% Anders Komár Ravn. +% +% \PrintChanges +% +% \begin{danish} +% \section{Brugsvejledning} +% Et eksempel på en \texttt{.tex}-fil, som kan bruges til at +% producere noget nær det i figur \ref{eksempel}, er gengivet i sin +% helhed i appendiks \ref{fullex}, eller filen +% \texttt{Eksempel.tex}, som \LaTeX\ burde have produceret sammen +% med den fil, som du læser nu. Her gennemgår vi nogle af +% højdepunkterne, for at forstå hvordan klassen kan bruges. +% \end{danish} +% \begin{english} +% \section{Usage} +% An example of a \texttt{.tex} file that will typeset something +% like figure \ref{example} is presented in appendix \ref{fullex}, +% or in the file \texttt{Example.tex}, which should have been +% produced by \LaTeX\ alongside the documentation file that you are +% reading. In the present section, we'll hit some of the highlights +% of that file, to understand how it works. +% \end{english} +% \begin{danish} +% \subsection{Invokering og valgmuligheder} +% Klassen (ned)kaldes, ved at starte en \texttt{.tex}--fil med +% \end{danish} +% \begin{english} +% \subsection{Invoking and arguments} +% First, to use the \cn\ class in a \verb|.tex| file, that file must +% start with +% \end{english} +% +% \begin{verbatim} +% \documentclass{ucph-revy} +% \end{verbatim} +% +% \begin{danish} +% \cn\ nedarver fra \DescribeMacro{article} +% \textsf{article}--klassen, så alle valgmuligheder, som godtages af +% \texttt{article} godtages også af \cn. Som standard vælger \cn\ +% \texttt{a4paper} og \texttt{11pt}, fra \textsf{article}'s +% valgmuligheder, hvis \cn\ ikke bliver kaldt med nogen +% valgmuligheder, som er i modstrid med dem. +% +% Derudover tilføjer \cn\ +% valgmulighederne \DescribeMacro{thumbindex} \verb|thumbindex| +% og \DescribeMacro{planfile=} \verb|planfile|, som tilføjer +% registermærkninger og lader forfatteren ændre hvilken fil +% registermærkningerne bliver bygget ud fra. Hvad det mere specifikt +% betyder bliver gennemgået i sektion \ref{thumbindex}. +% \end{danish} +% \begin{english} +% \cn\ inherits from the \texttt{article}\DescribeMacro{article} +% class, and accepts all its options. It sets \texttt{a4paper} and +% \texttt{11pt} by default, if not given any contrary options. +% +% In addition, \cn\ add the options +% \DescribeMacro{thumbindex} \verb|thumbindex| +% and \DescribeMacro{planfile=}\verb|planfile|, which activates the +% construction of thumb indexes in the file and allows setting the +% file that the thumb index is built from. We'll go through exactly +% how this works in seciton \ref{thumbindex}. +% \end{english} +% +% \begin{implementation} +% \label{loadclass} +% \begin{danish} +% Vi håndterer valgmuligheder til klassen her, i starten af +% filen. Vi skal bruge den her pakke. +% \end{danish} +% \begin{english} +% We handle class options here, at the start of the file. To do +% so, we need this package. +% \end{english} +% \begin{macrocode} +\RequirePackage{xstring} +% \end{macrocode} +% \begin{macro}{\if@thumbindex} +% \begin{danish} +% Kommer til at holde styr på, om \verb|thumbindex| er givet. Vi +% kommer til at gøre noget med den nede i sektion +% \ref{thumbindex}. +% \end{danish} +% \begin{english} +% Keeps track of \verb|thumbindex|. We will do stuff with it +% when we get to section \ref{thumbindex}. +% \end{english} +% \begin{macrocode} +\newif\if@thumbindex\@thumbindexfalse +% \end{macrocode} +% \end{macro} +% \iffalse +%<*driver> +\jump +% +% \fi +% \begin{danish} +% Og nu kan vi definere valgmulighederne: +% \end{danish} +% \begin{english} +% And now we're ready to define the arguments: +% \end{english} +% \begin{macro}{thumbindex} +% \begin{macrocode} +\DeclareOption{thumbindex}{\@thumbindextrue} +% \end{macrocode} +% \end{macro} +% \begin{macro}{planfile=} +% \begin{danish} +% Tager en tekststreng, så den skal behandles helt +% specielt. \textsf{xstring} definerer bl.a. makroen +% \verb|\IfBeginWith|. +% \end{danish} +% \begin{english} +% Takes a text string, and +% so needs particular treatment. \textsf{xstring} defines, among +% other things, the macro \verb|\IfBeginWith| +% \end{english} +% \begin{macrocode} +\newcommand{\planfile}{aktoversigt.plan} +\DeclareOption*{ + \IfBeginWith{\CurrentOption}{planfile=}{ + \def\planfile#1=#2{#2} + \edef\planfile{\expandafter\planfile\CurrentOption} + }{ + \PassOptionsToClass{\CurrentOption}{article} + } +} +\ProcessOptions\relax +\LoadClass[a4paper,11pt]{article} +% \end{macrocode} +% \end{macro} +% \end{implementation} +% +% \begin{implementation} +% \begin{danish} +% De her kommandoer gør tekstblokken højere. +% \end{danish} +% \begin{english} +% These commands make the text block taller. +% \end{english} +% \begin{macrocode} +\setlength{\topmargin}{0cm} +\setlength{\voffset}{-1cm} +\setlength{\textheight}{\paperheight} +\addtolength{\textheight}{-4cm} +% \end{macrocode} +% \end{implementation} +% +% \begin{danish} +% I eksemplet inkluderer vi fire pakker. De er ikke strengt +% nødvendige for at få \cn\ til at fungere, men de kommer næsten med +% sikkerhed til at gøre dit liv lettere. +% +% \medskip\noindent\begin{tabulary}{\textwidth}{lL} +% \verb|\usepackage[utf8]{inputenc}| & \\ +% \verb|\usepackage[T1]{fontenc}| & +% Gør \LaTeX's håndtering af danske bogstaver mere moderne. \\ +% \verb|\usepackage[danish]{babel}| & +% Fortæller \LaTeX\ en masse ting om dansk, bl.a. hvordan +% man bryder ord.\\ +% \verb|\usepackage{hyperref}| & +% Giver mulighed for at lave links, som det til Youtube i +% figur \ref{eksempel}.\\ +% \verb|\urlstyle{sf}| & +% Gør, at links bliver sat med \textsf{sans serif} tekst +% i stedet for \texttt{monospace}. +% \end{tabulary} +% \end{danish} +% \begin{english} +% In the example, we've included three packages that aren't strictly +% necessary for \cn\ to function, but will probably make your life +% easier. +% +% \medskip\noindent\begin{tabulary}{\textwidth}{lL} +% \verb|\usepackage[utf8]{inputenc}| & \\ +% \verb|\usepackage[T1]{fontenc}| & +% Modernize \LaTeX's handling of (particularly special) +% characters.\\ +% \verb|\usepackage{hyperref}| & +% Enables the creation of hyperlinks, like the one in +% figure \ref{example}.\\ +% \verb|\urlstyle{sf}| & +% Demands that hyperlinks be set in \textsf{sans serif}, +% rather than \texttt{monospace} +% \end{tabulary} +% \end{english} +% +% \begin{danish} +% \subsection{Registermærkninger}\label{thumbindex} +% +% \changes{v1.0.0}{2023/09/05}{Nyt maskineri til registermærkninger} +% Kasserne i kanten af siderne i figur \ref{eksempel} er +% registermærkninger. De er tænkt som en hjælp med at finde rundt i +% manuskripter, når de bliver sat sammen af flere enkelte numre, som +% hver især bruger \cn. De giver kun mening at bruge i dokumenter +% som er en del af en større samling, så for at sætte dem skal +% klassen gives +% valgmuligheden \DescribeMacro{thumbindex}\verb|thumbindex|. +% \end{danish} +% \begin{english} +% \subsection{Thumb index}\label{thumbindex} +% +% \changes{v1.0.0}{2023/09/05}{New machinery for thumb indexes} +% To help organizing a compiled manuscript, which might consist of a +% collection of many \texttt{.tex} files, we profide a facility for +% creating a thumb index in the typeset margins. That's the gray and +% black boxes on the edge of the pages in figure \ref{eksempel}. It +% is off by default, since it only really makes sense in a +% compilation of documents, but is enabled by giving the +% option \DescribeMacro{thumbindex}\verb|thumbindex| to the class. +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% \verb|\if@thumbindex|\DescribeMacro{\if@thumbindex}\ blev +% defineret på side \pageref{loadclass}, og fortæller bare, om +% \verb|thumbindex| er blevet valgt. Hvis den ikke er, så +% springer vi al koden i det her afsnit over. +% \end{danish} +% \begin{english} +% \verb|\if@thumbindex|\DescribeMacro{\if@thumbindex}\ was defined +% on page \pageref{loadclass}, and just tells us if the option +% \verb|thumbindex| was given. If it wasn't, well just skip +% all the code in this section. +% \end{english} +% \begin{macrocode} +\if@thumbindex + \expandafter\@firstofone +\else + \expandafter\@gobble +\fi{ +% \end{macrocode} +% \end{implementation} +% \label{begintabdefgroup} +% +% \begin{danish} +% \cn\ får at vide hvilke numre, som er med i et manuskript, fra en +% ekstern tekstfil, som vi som standard går ud fra hedder +% \texttt{aktoversigt.plan}, og ligger i samme mappe som +% \texttt{.tex}--dokumentet. Hvis det ikke passer, kan det laves om, +% ved at give +% valgmuligheden \DescribeMacro{planfile=}\verb|planfile=|\meta{filnavn} +% til pakken. Så for eksempel, hvis planfilen ligger i mappen over +% \texttt{.tex}--dokumentet og hedder \texttt{plan.txt}, kan pakken +% kaldes således: +% \end{danish} +% \begin{english}^^A +% The structure of the consolidated manuscript is +% defined in a seperate text file, which contains the filenames of +% the \texttt{.tex} files that make up the manuscript, and divide +% the show into sections with their own headings. By default, we +% assume that the plan file is in the same folder as the current +% \texttt{.tex} file, and named \verb|aktoversigt.plan|. This may be +% changed by +% passing \DescribeMacro{planfile=}\verb|planfile=|\meta{filename} +% as a parameter to the class. Calling both these options might look +% like so: +% \end{english} +% \begin{verbatim} +%\documentclass[thumbindex,planfile=../plan.txt]{ucph-revy} +% \end{verbatim} +% \begin{danish} +% Et eksempel på en sådan planfil kunne være: +% \begin{verbatim} +% Akt 1 +% sange/introsang.tex +% sketches/Eksempel.tex +% sketches/studiepolitisk_indlæg.tex +% +% Akt 2 +% sketches/noget_om_kvant.tex +% sange/sang_til_en_forelæser.tex +% +% Ekstranumre +% sange/under_bæltestedet.tex +% \end{verbatim} +% Mappenavnene (\texttt{sange}, \texttt{sketches}) er ikke +% nødvendige for at registermærkningerne kan fungere, de er bare et +% eksempel. \texttt{.tex}--filerne kan placeres hvor som helst, +% \TeX\ kan læse fra. +% +% Ud fra sådan en planfil kan klassen generere et +% register\textbf{indeks} som ligner det i figur \ref{registerex}, +% eller register\textbf{mærkninger} som dem i figur +% \ref{eksempel}. De titler, som er vist i figur \ref{registerex}, +% finder \cn\, ved at læse \verb|\title|--makroen i de filer, som er +% angivet i planfilen. +% +% \begin{figure}[hbtp] +% \paperheight 18em +% \tabtoks={\undertab 0\text Akt 1\stop\overtab 1\text Introsang\stop\overtab 2\text Eksempel\stop\overtab 3\text Studiepolitisk indlæg\stop\undertab 3\text Akt 2\stop\overtab 4\text Noget om kvant\stop\overtab 5\text Sang til en forelæser\stop\undertab 5\text Eks.\stop\overtab 6\text Under bæltestedet\stop\undertab 6\text\done\stop} +% \edef\revy@tabs{\the\tabtoks} +% \hfill\rectothumbindexwithtitles +% \caption{Et eksempel på et indeks til registermærkninger. I brug +% er det tænkt til at fylde hele siden i højden, så mærkningernes +% placering matcher registermækrningerne (som i figur +% \ref{eksempel}).} +% \label{registerex} +% \end{figure} +% +% For at sætte et registermærke i et enkelt dokument, altså som i +% figur \ref{eksempel}, skal \cn\ vide hvor den aktuelle fil er i +% rækkefølgen. For at finde ud af det, læser den hver fil, som er +% oplistet i planfilen, og sammenligner indholdet af deres +% \verb|\title|--makroer med den seneste \verb|\title|, som \TeX\ +% har set. +% +% Derfor er det nødvendigt, for at \cn\ kan sætte registermærkerne, +% at der er angivet en \verb|\title|. Det er altid den sidste +% \verb|\title| i en fil, som \cn\ sammenligner med den +% \verb|\title|, som \TeX\ kender. Det kan gå galt, hvis der er +% flere \verb|\title|'r i en fil. +% +% Hvis der er flere af filerne i planfilen, som har den +% \verb|\title| som \cn\ leder efter, vil \cn\ sætte registermærker +% for alle de tilsvarende pladser i rækkefølgen. +% \end{danish} +% +% \begin{english} +% An example of such a plan file might be: +% \begin{verbatim} +% Act 1 +% songs/opener.tex +% sketches/Example.tex +% sketches/anarchocommunist_commune.tex +% +% Act 2 +% songs/glitzy_dance_act.tex +% sketches/crossdressing.tex +% +% Act 3 +% sketches/stop_police.tex +% \end{verbatim} +% Note that the folder names (\texttt{songs}, \texttt{sketches}) are +% merely for illustration. The \texttt{.tex} files can be placed at any +% location that \TeX\ can read. +% +% From this plan file, the class can generate a thumb mark for each +% of thsee individual files, as demonstrated in figure +% \ref{eksempel}, which shows the location of that file in the +% larger structure of the piece. It can also generate a thumb index, +% as demonstrated in figure \ref{thumbindexex}, which outlines the +% location of every part of the piece, and can serve as an aide to +% navigation. +% +% \begin{figure}[hbtp] +% \paperheight 18em +% \tabtoks={\undertab 0\text Act 1\stop\overtab 1\text Opener\stop\overtab 2\text Example\stop\overtab 3\text Anarchocommunist Commune\stop\undertab 3\text Act 2\stop\overtab 4\text Non--sequitor Dance Act\stop\overtab 5\text Find a Reason to Dress as Ladies\stop\undertab 5\text Act 3\stop\overtab 6\text Stop, Police\stop\undertab 6\text\done\stop} +% \edef\revy@tabs{\the\tabtoks} +% \hfill\rectothumbindexwithtitles +% \caption{An example thumb index. This example is compressed +% vertically. It is intended to be nearly the height of the page, +% to match the thumb markings (such as the ones in figure +% \ref{eksempel}).} +% \label{thumbindexex} +% \end{figure} +% +% The titles in the thumb index demonstrated in figure +% \ref{thumbindexex} are taken from the content of the \verb|\title| +% macro in the files listed in the plan file. Also, the routine for +% setting the thumb mark for an individual file determine +% \emph{which} file it is in by comparing the content of the +% \verb|\title| macro in the files in the plan file with the title +% that \TeX\ knows about in the current file. +% +% Therefore, it is necessary for the thumb index to work that a +% \verb|\title| is declared in each of the files that are listed in +% the plan file. +% +% If there are more than one \verb|\title| invocations in a file, +% the thumb index routine will use the last one. If several of the +% files in the plan file have the same name, those files will end up +% with several thumb marks. +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% For at sammenligningen kan fungere, er vi afhængige af, at +% tekstrepræsentationen ikke skifter undervejs. Det kan ske, hvis +% \verb|.tex|--filen kalder \textsf{fontenc}, og titlerne +% indeholder specialtegn. Den simple og effektive\footnote{Læs: +% det er et hack, som ikke har givet mig problemer \emph{endnu}.} +% løsning er bare at kalde \textsf{fontenc} selv, så der ikke er +% plads til misforståelser. +% \end{danish} +% \begin{english} +% For this comparing of titles to work, we depend of the text +% representation not changing between the \verb|\title| +% declaration and the time when the thumb index routine runs. It +% might, though, if \textsf{fontenc} is called. To quickly knock +% that problem on the head,\footnote{In a way that hasn't come +% back to bite \emph{me} yet.} we'll just call \textsf{fontenc} +% ourselves. +% \end{english} +% \begin{macrocode} + \RequirePackage[T1]{fontenc} +% \end{macrocode} +% +% \begin{danish} +% Koden, som læser og forstår planfilen og de andre +% \verb|.tex|--filer bor i den her gruppe. I sidste ende kommer vi +% til at definere +% makroen \DescribeMacro{\revy@tabs}\verb|\revy@tabs|, som burde, +% for hver overskrift i planfilen, indeholde sekvensen +% \begin{showcommand} +% \verb|\undertab| \meta{tæller ved start} \verb|\text| +% \meta{overskrift} \verb|\stop|, +% \end{showcommand} +% for hvert filnavn i planfilen indeholde sekvensen +% \begin{showcommand} +% \verb|\overtab| \meta{tæller} \verb|\text| +% \meta{titel i fil} \verb|\stop|, +% \end{showcommand} +% og som afslutning sekvensen +% \begin{showcommand} +% \verb|\undertab| \meta{antal filer} \verb|\text| \verb|\done| +% \verb|\stop|. +% \end{showcommand} +% Undervejs bygger vi de her sekvenser op i en +% \verb|toks|. Konstruktionen, hvor \verb|\act| bliver defineret, og +% så kaldt med det samme, er for at styre, hvor dybt \TeX\ udvider +% vores makroer\cite{eijkhout:toksstack}. +% \end{danish} +% \begin{english} +% The code that reads and comprehends the plan file and the listed +% \texttt{.tex} files lives in this group. The ultimate effect ought +% to be defining the +% macro \DescribeMacro{\revy@tabs}\verb|\revy@tabs|, which will +% contain, for each heading in the plan file, the sequence +% \begin{showcommand} +% \verb|\undertab| \meta{counter at start} \verb|\text| +% \meta{hading} \verb|\stop|, +% \end{showcommand} +% for each file name in the plan file, the sequence +% \begin{showcommand} +% \verb|\overtab| \meta{counter} \verb|\text| +% \meta{title in file} \verb|\stop|, +% \end{showcommand} +% and finally the sequence +% \begin{showcommand} +% \verb|\undertab| \meta{no. of files} \verb|\text| \verb|\done| +% \verb|\stop|. +% \end{showcommand} +% As we go, these sequences will be built up in a \verb|toks|. The construction where \verb|\act| is defined, and then immediately called, controls how deeply \TeX\ will expand our macros\cite{eijkhout:toksstack}. +% \end{english} +% \begin{macrocode} + \begingroup +% \end{macrocode} +% \begin{macrocode} + \count256=0 + \endlinechar=-1 + \newtoks\tabtoks + \newread\tabtex + \newread\planread + \openin\planread=\planfile +% \end{macrocode} +% \begin{macrocode} + \def\expandFiHere#1\fi{\fi #1} +% \end{macrocode} +% \begin{macrocode} + \def\patheat#1/#2{% + \ifx\relax#2\else + \expandFiHere#1/\patheat#2% + \fi + } + \edef\planpath{\expandafter\patheat\planfile/\relax} +% \end{macrocode} +% \begin{macrocode} + \def\titleeater#1#2\title#3{% + \ifx\done#3% + #1% + \else + \expandFiHere + \titleeater{#3}% + \fi + } +% \end{macrocode} +% \begin{danish} +% Her i \verb|\loop|'et tjekker vi først, om vi er færdige med +% planfilen (\verb|\repeat| kobler på den \verb|\else|, som hører +% til den første \verb|\ifeof|. Hvis den \verb|\ifeof| er sand, så +% læser \TeX\ kun den \verb|\fi|, som er gemt inde i +% \verb|\repeat|, og kalder ikke den rekursion, som også ligger +% derinde. Jeg prøver at forklare det her for mig selv, for jeg +% bliver forvirret hver gang jeg vender tilbage til den her +% konstruktion.) Så tjekker vi, om der {\em ikke} er en åben fil i +% \verb|\tabtex|. Hvis ikke, prøver vi at greje den næste linje i +% planfilen. Ellers leder vi efter \verb|\title|--kald i filen i +% \verb|\tabtex| (og håber, at det ikke spænder over flere +% linjer). +% \end{danish} +% \begin{english} +% In this loop, we read the plan file plan file line by line. If the +% line ends in \texttt{.tex}, we take it as a file name, and open +% that file, looking for \verb|\title| commands, which hopefully do +% not span across any line breaks. +% \end{english} +% \begin{macrocode} + \loop\ifeof\planread + \closein\planread + \else + \ifeof\tabtex + \let\readline\empty + \read\planread to \line + \expandafter\ifx\expandafter\par\line\else + \IfEndWith{\line}{.tex}{ + \advance\count256 by 1 +% \end{macrocode} +% \begin{danish} +% \verb|\set@curr@file| tager sig af problemer med catcode'er. +% \end{danish} +% \begin{english} +% \verb|\set@curr@file| beats down issues with catcodes in +% filenames. +% \end{english} +% \begin{macrocode} + \set@curr@file{\line} + \openin\tabtex={\planpath\@curr@file} + }{% + \edef\act{\noexpand\tabtoks={% + \the\tabtoks + \noexpand\undertab + \number\count256 + \noexpand\text + \line + \noexpand\stop + }}\act + } + \fi + \else + \read\tabtex to \subline + \edef\readline{% + \expandafter\titleeater + \expandafter\readline\subline\title\done + } + \ifeof\tabtex + \edef\act{\noexpand\tabtoks={% + \the\tabtoks + \noexpand\overtab + \number\count256 + \noexpand\text + \readline + \noexpand\stop + }}\act + \fi + \fi + \repeat + \closein\tabtex +% \end{macrocode} +% +% \begin{danish} +% Afslutningssekvensen: +% \end{danish} +% \begin{english} +% The final sequence: +% \end{english} +% \begin{macrocode} + \edef\act{\noexpand\tabtoks={% + \the\tabtoks + \noexpand\undertab + \number\count256 + \noexpand\text + \noexpand\done + \noexpand\stop + }}\act +% \end{macrocode} +% \begin{macro}{\revy@tabs} +% And then, the money shot. +% \begin{macrocode} + \xdef\revy@tabs{\the\tabtoks} +% \end{macrocode} +% \end{macro} +% \begin{macrocode} + \endgroup +% \end{macrocode} +% \end{implementation} +% +% \begin{danish} +% I eksemplet i appendiks \ref{fullex} er \verb|thumbindex| ikke +% taget med, fordi det kun rigtig giver mening at lave +% registermærkninger i en samling af manuskripter. Men hvis der +% ligger en fil i samme mappe som eksempelfilen, som hedder +% \texttt{aktoversigt.plan}, hvor indholdet er eksemplet fra før, og +% hvis invokeringen i eksempelfilen skiftes ud med +% \end{danish} +% \begin{english} +% The thumbindex hasn't been enabled in the example file in appendix +% \ref{fullex}, since there's nothing to index. However, if you were +% to place the example plan file above in a file along side +% \texttt{Example.tex} named \texttt{aktoversigt.plan}, and replace +% the class invocation at the top of \texttt{Example.tex} with +% \end{english} +% \begin{verbatim} +%\documentclass[thumbindex]{ucph-revy} +% \end{verbatim} +% \begin{danish} +% så burde \texttt{.tex}--filen kompilere til et resultat, som har +% registermærkninger ligesom i eksemplet i figur +% \ref{eksempel}. Manglende filer bliver bare ignoreret. +% +% Det lyder måske som en god idé at have en side med et register, +% som ligner det i figur \ref{registerex}, men som passer i +% størrelsen til de mærkninger, som bliver sat i den enkelte +% manuskriptfil. Et eksempel på hvordan man kunne lave en side med +% sådan et registerindeks findes i appendiks +% \ref{registerindeks}. Hvis du har adgang til klassens kildefiler +% kan du også trække den kode ud i filen \texttt{Thumbindex.tex}, +% ved at køre filen \texttt{upch-revy-ex-thumb.ins} igennem \LaTeX. +% \end{danish} +% \begin{english} +% then the typeset result should have a thumb marking like the one +% in figure \ref{example}. Nonexistent files are simply ignored when +% constructing the thumb index. +% +% You might also like to have a page with an index of the thumb +% markings, something similar to figure \ref{thumbindexex}, but +% scaled to a full page. Appendix \ref{registerindeks} hold a +% complete example of one way to make a page like that. If you have +% access to the package's source files, you can also extract that +% code as the file \texttt{Thumbindex.tex}, by running the file +% \texttt{ucph-revy-ex-thumb.ins} through \LaTeX. +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% \textsf{Ti{\em k}Z} er ikke et tegneprogram\cite{tikz}, men vi +% bruger den alligevel til at tegne registermærkningerne. +% \end{danish} +% \begin{english} +% \textsf{Ti{\em k}Z} is not a drawing program\cite{tikz}, but we'll +% use it to draw our thumbtabs regardless. +% \end{english} +% \begin{macrocode} + \RequirePackage{tikz} +% \end{macrocode} +% +% \begin{macro}{\revy@thumbindex} +% \begin{danish} +% Den her makro indeholder alle procedurene, som typesætter +% registermærkningerne. Argumentet bliver ekspanderet lige før +% typesætningen rent faktisk finder sted, så makroens interne +% tilstand kan justeres. Læg særligt mærke til makroerne +% \verb|\filter|, \verb|\movetoleftside| og +% \verb|\writetitlestrue|, som bliver defineret internt i makroen, +% og som lave om på hvilke dele af registermærkerne, som bliver +% typesat. Makroerne, som bliver defineret på side +% \pageref{thumbindexuse} og frem, demonstrerer hvordan de +% bruges. +% +% Vi kommer til at se den fremgangsmåde, at der bliver lavet +% definitioner af \verb|\undertab| og \verb|\overtab|, som vi +% bagte ind i \verb|\revy@tabs| i den forrige kodeblok, der gør +% det arbejde, vi ønsker at få lavet, når \verb|\revy@tabs| bliver +% ekspanderet. +% \end{danish}^^A +% \begin{english}^^A +% This macro contains the procedures that typeset +% the thumb index. Its argument is expanded immediately before the +% thumb tabs are actually typeset, allowing you to modify the +% macro's internal state at that point. For this purpose, you'll +% want to pay special attention to the macros \verb|\filter|, +% \verb|\movetoleftside| and \verb|\writetitlestrue|, which will +% be defined internally in this macro, and alter which parts of +% the thumbindex are typeset. +% +% The approach that we will see used, as we go through the macro, +% is to define \verb|\undertab| and \verb|\overtab| in such a way +% that they perform the tasks that we want to see performed, when +% we expand \verb|\revy@tabs|. +% \end{english} +% \iffalse +%<*driver> +} +\land +% +% \fi +% \begin{macrocode} + \def\revy@thumbindex#1{% + \begingroup +% \end{macrocode} +% \begin{macro}{\expandFiHere} +% \begin{danish} +% Du genkender måske den her som \verb|\hop|, hvis du har læst +% \cite{eijkhout:hop}. +% \end{danish} +% \begin{english} +% You man reckognize this one as \verb|\hop| if you've read +% \cite{eijkhout:hop}. +% \end{english} +% \begin{macrocode} +\def\expandFiHere##1\fi{\fi ##1} +% \end{macrocode} +% \end{macro} +% \begin{danish} +% Find ud af hvor højt et enkelt mærke skal være. +% \end{danish} +% \begin{english} +% Find the height of a single tab. +% \end{english} +% \begin{macrocode} + \newdimen\tabheight + \tabheight=\paperheight + \advance\tabheight by -1cm% + \def\undertab##1\text##2\stop{ + \ifx\done##2% + \divide\tabheight by ##1% + \fi + } + \def\overtab##1\text##2\stop{}% + \revy@tabs +% \end{macrocode} +% \begin{macro}{\movetoleftside} +% \begin{danish}^^A +% De her definitioner indeholder forskellen på at vende +% registermærkningerne mod højre eller mod venstre. +% \end{danish}^^A +% \begin{english}^^A +% These definitions contain the differences +% between right and left facing thumb tabs. +% \end{english} +% \begin{macrocode} + \def\overtableft{-1cm} + \def\overtabright{1cm} + \def\undertabright{\overtabright} + \def\undertableft{\overtableft - 1cm} + \def\underangle{|-} + \def\underpos{.25} + \def\undersign{} + \def\underlabeloffset{\undersign.5cm} + \def\textanchorcorner{east} + \def\textoffset{\undertableft - .5cm} + \def\textside{right} + \def\movetoleftside{ +% \end{macrocode} +% \begin{macrocode} + \def\overtableft{-1.8cm} + \def\overtabright{.2cm} + \def\undertabright{\overtabright + 1cm} + \def\undertableft{\overtableft} + \def\underangle{-|} + \def\undersign{-} + \def\underpos{.75} + \def\textanchorcorner{west} + \def\textoffset{\undertabright + .5cm} + \def\textside{left} + } +% \end{macrocode} +% \end{macro} +% \begin{macro}{\ifwritetitles} +% \begin{macrocode} +\newif\ifwritetitles\writetitlesfalse +% \end{macrocode} +% \end{macro} +% \begin{danish} +% Her kobler vi mening på de tokens, som vi stoppede ind i +% \verb|\revy@tabtoks| tidligere. +% \end{danish} +% \begin{english} +% Here, we attach meaning to the tokens we stuffed into +% \verb|\revy@tabtoks| previously. +% \end{english} +% \begin{macrocode} + \def\printovertab##1##2{ + \fill ( 0, -##1\tabheight ) + node[ text=white, anchor=east ]{\bfseries##1} + +( \overtableft, -.5\tabheight + 1mm ) + rectangle +( \overtabright, .5\tabheight - 1mm ) + +( \textoffset, 0 ) + \ifwritetitles + node[ anchor=\textanchorcorner ]{\small\bfseries##2} + \fi + ; + }% +% \end{macrocode} +% \begin{macrocode} + \def\printundertab##1##2##3{% + \path ( 0, -##1\tabheight ) +( \undertabright, -.5\tabheight - 1mm ) + coordinate (topright); + \path ( 0, -##2\tabheight ) +( \undertableft, -.5\tabheight + 1mm ) + coordinate (bottomleft); + \fill[ color=black!30 ] (topright) rectangle (bottomleft); + \path (bottomleft) + \underangle node[ xshift=\underlabeloffset, + pos=\underpos, + rotate=\undersign90 + ]{\Large##3} + (topright); + }% +% \end{macrocode} +% \begin{macrocode} + \def\overtab##1\text##2\stop{% + \printovertab{##1}{##2} + } +% \end{macrocode} +% \begin{macrocode} + \def\undertab##1\text##2\stop{ + \ifx\done##2\else + \let\undertab\undertabspan + \expandFiHere + \undertab##1\text##2\stop + \fi + } +% \end{macrocode} +% \begin{macrocode} + \def\undertabspan##1\text##2\stop##3\undertab##4\text##5\stop{% + \printundertab{##1}{##4}{##2}% + ##3% + \ifx\done##5\else + \expandFiHere + \undertab##4\text##5\stop + \fi + }% +% \end{macrocode} +% \begin{macro}{\filtername} +% \begin{macrocode} + \def\filtername##1{ + \def\doWhenMatch{} + \def\overtab####1\text####2\stop{ + \IfStrEq{##1}{####2}{ + \doWhenMatch + \printovertab{####1}{####2} + }{} + } +% \end{macrocode} +% \begin{macrocode} + \def\undertabspan####1\text####2\stop####3\undertab####4\text####5\stop{ + \def\doWhenMatch{ + \printundertab{####1}{####4}{####2} + \def\doWhenMatch{} + } +% \end{macrocode} +% \begin{macrocode} + ####3 + \ifx\done####5\else + \expandFiHere + \undertab####4\text####5\stop + \fi + } + } +% \end{macrocode} +% \end{macro} +% \begin{danish} +% Som lovet, argumentet til makroen, lige før registermærkningerne +% bliver typesat. +% \end{danish} +% \begin{english} +% As promised, the macro argument, just before the thumbindex is +% actually typeset. +% \end{english} +% \begin{macrocode} + #1 +% \end{macrocode} +% \begin{macrocode} + \begin{tikzpicture} + \revy@tabs + \path (0, 0) -- (0, -\paperheight + .5cm); + \end{tikzpicture} + \endgroup + } +% \end{macrocode} +% \begin{danish} +% Og således slutter \verb|\revy@thumbindex|. +% \end{danish} +% \begin{english} +% And thus concludes \verb|\revy@thumbindex|. +% \end{english} +% \end{macro} +% \end{implementation} +% +% \label{thumbindexuse} +% \begin{danish} +% I resten af det her afsnit følger de makroer, som kan bruges til +% at tegne registermærkningerne. +% \end{danish} +% \begin{english} +% In the remaider of this section, we list the macros that may be +% used to typeset the thumb indices. +% \end{english} +% +% \begin{macro}{\rectothumbtabfor} +% \begin{danish} +% \begin{showcommand} +% \verb|\rectothumbtabfor|\marg{titel} +% \end{showcommand} +% Sætter et registermærke, som er orienteret mod højre, +% altså egenet til en recto--side, for filen (eller filerne), hvis +% titel matcher dens argument. Det giver mest mening hvis den får +% titlen på det aktuelle dokument, som er gemt i \verb|\@title|. Det +% er den her makro, som bliver brugt til at sætte registermærkerne i +% eksemplet i figur \ref{eksempel}. +% \end{danish} +% \begin{english} +% \begin{showcommand} +% \verb|\rectothumbtabfor|\marg{title} +% \end{showcommand} +% Sets a thumb tab, oriented to the right, so suitable for a recto +% page, that corresponds to the file (or files) whose discovered +% title matches the argument. The most sensible argument to give it +% is the title of the current document, which can be found in +% \verb|\@title|. This is the macro that typeset the thumb tabs in +% figure \ref{example}. +% \end{english} +% \begin{implementation} +% \begin{macrocode} + \newcommand{\rectothumbtabfor}[1]{ + \revy@thumbindex{ + \filtername{#1} + } + } +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \begin{macro}{\rectothumbindexwithtitles} +% \begin{showcommand} +% \verb|\rectothumbindexwithtitles| +% \end{showcommand} +% \begin{danish} +% Sætter registerindekset, som i figur \ref{registerex}. Læg mærke +% til, at eksemplet i figur \ref{registerex} er trykket sammen i +% højden. Som standard skalerer den her makro indekset efter +% \verb|\paperheight|, ligesom mærkerne i figur \ref{eksempel} er. +% \end{danish} +% \begin{english} +% Sets the thumbs index, as was demonstrated in figure +% \ref{thumbindexex}. Do note that the example in figure +% \ref{thumbindexex} has been squeezed vertically. By default, the +% index is scaled vertically after \verb|\paperheight|, like the +% thumb tabs in figure \ref{example} were. +% \end{english} +% \begin{implementation} +% \begin{macrocode} + \newcommand{\rectothumbindexwithtitles}{ + \revy@thumbindex{ + \writetitlestrue + } + } +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \begin{macro}{\rectothumbindex} +% \begin{showcommand} +% \verb|\rectothumbindex| +% \end{showcommand} +% \begin{danish} +% Sætter alle mærkerne, ligesom den forrige makro, men uden +% titelnavnene. +% \end{danish} +% \begin{english} +% Sets all the thumb marks, just like the previous macro, but +% without writing out the titles. +% \end{english} +% \begin{implementation} +% \begin{macrocode} + \newcommand{\rectothumbindex}{ + \revy@thumbindex{} + } +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \begin{macro}{\rectothumbtabwithtitlefor} +% \begin{danish} +% \begin{showcommand} +% \verb|\rectothumbtabwithtitlefor|\marg{titel} +% \end{showcommand} +% Sætter kun registermærket for indgangen(e) med samme titel som +% parameteren, og skriver dens titel. Det svæver lidt i det uhvisse, +% hvad det gavner, at gøre sådan, men muligheden er med for +% fuldstændighedens skyld. +% \end{danish} +% \begin{english} +% \begin{showcommand} +% \verb|\rectothumbtabwithtitlefor|\marg{title} +% \end{showcommand} +% Sets only the thumb tab for the entr(y/ies) with the title given +% in the parameter. It's unclear why you'd want to, but the option +% is included, for completeness. +% \end{english} +% \begin{implementation} +% \begin{macrocode} + \newcommand{\rectothumbtabwithtitlefor}[1]{ + \revy@thumbindex{ + \filtername{#1} + \writetitlestrue + } + } +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\versothumbtabfor} +% \begin{macro}{\versothumbindexwithtitles} +% \begin{macro}{\versothumbindex} +% \begin{macro}{\versothumbtabwithtitlefor} +% \begin{danish} +% Alle disse makroer kommer også i en venstreorienteret udgave, som +% egner sig til marginen på en verso--side: +% \end{danish} +% \begin{english} +% These macros also come in left oriented versions, suitable for the +% margin of verso pages. +% \end{english} +% \begin{showcommand} +% \verb|\versothumbtabfor|\marg{titel} +% \item\verb|\versothumbindexwithtitle| +% \item\verb|\versothumbindex| +% \item\verb|\versothumbtabwithtitlefor|\marg{titel} +% \end{showcommand} +% \begin{implementation} +% \begin{macrocode} + \newcommand{\versothumbindex}{ + \revy@thumbindex{ + \movetoleftside + } + } + \newcommand{\versothumbindexwithtitles}{ + \revy@thumbindex{ + \movetoleftside + \writetitlestrue + } + } + \newcommand{\versothumbtabfor}[1]{ + \revy@thumbindex{ + \movetoleftside + \filtername{#1} + } + } + \newcommand{\versothumbtabwithtitlefor}[1]{ + \revy@thumbindex{ + \movetoleftside + \filtername{#1} + \writetitlestrue + } + } +% \end{macrocode} +% \end{implementation} +% \iffalse +%<*driver> +\jump +{ +% +% \fi +% \begin{implementation} +% \begin{danish} +% Og således afsluttes den betingede gruppe for +% \verb|\if@thumbindex|. +% \end{danish} +% \begin{english} +% And thus concludes the conditional group for +% \verb|\if@thumbindex|. +% \end{english} +% \begin{macrocode} +} +% \end{macrocode} +% \end{implementation} +% \end{macro}\end{macro}\end{macro}\end{macro} +% +% \begin{danish} +% \subsection{Infoblokken} +% Lige efter titlen kan vi sætte en masse information, som er +% brugbar i arbejdet med at organisere en revy. Figur \ref{title} +% viser et eksempel på, hvordan titlen ser ud med alle informationer +% fyldt ud. +% +% \begin{figure}[hbtp] +% \begin{macro}{\maketitle} +% \changes{v1.0.0}{2023/09/05}{Nyt layout af titelblokken} +% \phantom{.} +% \begingroup +% \exDaPre +% \def\getpagerefnumber#1{2} +% \vspace{6em} +% \class@maketitle +% \medskip +% \endgroup +% \caption{Et eksempel på, hvordan titlen er ud, når alle de +% informationer, som kan sættes sammen med den, er fyldt ud. Det +% bliver sat med kommandoen \texttt{\textbackslash +% maketitle}.\label{title}} +% \end{macro} +% \end{figure} +% +% I \texttt{.tex}--filen fortæller vi \cn\ om de her ting med en +% række makroer i preamble'en. For eksemplets skyld er alle +% makroerne vist i eksemplet, men de kan, untagen versionsnummeret, +% sagtens udelades i et \cn--dokument, hvis det ikke giver mening +% at have dem med. Makroerne var: +%\end{danish} +%\begin{english} +% \subsection{The infoblock} +% \cn's modified title block contains some additinal information that +% is useful in organizing a show. Figure \ref{title} shows an example +% of how the title block looks with every possilbe piece of +% informaiton included. +% +% \begin{figure}[hbtp] +% \begin{macro}{\maketitle} +% \changes{v1.0.0}{2023/09/05}{New layout of the tile block} +% \phantom{.} +% \begingroup +% \exEnPre +% \def\getpagerefnumber#1{2} +% \vspace{6em} +% \class@maketitle +% \medskip +% \endgroup +% \caption{An example of how \cn's tilte block looks with every +% possible piece of information filled in. It is set with the +% command \texttt{\textbackslash maketitle}.\label{title}} +% \end{macro} +% \end{figure} +% +% We give \cn\ this information with a series of preamble +% commands. For the sake of the example, the example file includes +% all of these commands, but they are not required for a \cn\ +% document to compile. If they don't make sense to include in a +% document, just leave them out. The macros were: +% \end{english} +% \iffalse +%<*driver> +\land +% +% \fi +% \begin{macro}{\version} +%\begin{verbatim} +%\version{1.0} +%\end{verbatim} +% \begin{implementation} +% \begin{macrocode} +\def\version#1{\def\@version{#1}} +% \end{macrocode} +% \end{implementation} +% \begin{danish} +% \verb|\version| er den eneste af de her kommandoer, som ikke kan +% udelades, fordi versionskontrol er vigtigt\footnote{Måske synes +% du, at der findes bedre måder, at lave versionskontrol på her i +% det futuristiske år 2023, men så kan du se det her påmindelse om +% rent faktiske at bruge dem.}. +% \end{danish} +% \begin{english} +% \verb|\version| is the only one of these commands that may not +% be omitted, because version conrol is important\footnote{You +% might be of the opinion that there are better ways of doing +% version control in the far future year 2023. In which case, you +% may take this as a reminder to actually use one of them.}. +% \end{english} +% \begin{implementation} +% \begin{danish} +% Versionsnummeret gøres påkrævet af de her kommandoer: +% \end{danish} +% \begin{english} +% The version number is made a requirement by these commands: +% \end{english} +% \begin{macrocode} +\def\@version{\@ifundefined{the@version} +{\typein[\versionsnr]{Indtast revytekstens versionsnummer: }% +\global\let\the@version=\versionsnr}{}\the@version} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\revyname} +% \begin{macro}{\revyyear} +% \begin{macro}{\title} +% \begin{danish} +%\begin{verbatim} +%\revyname{FysikRevy\texttrademark} +%\revyyear{2019} +%\title{Eksempel} +%\author{en eksempelsmed} +%\end{verbatim} +%\end{danish} +%\begin{english} +% \begin{verbatim} +%\revyname{The Meaning of Liff} +%\revyyear{3001} +%\title{Example} +%\author{an examplesmith} +% \end{verbatim} +%\end{english} +% \begin{implementation} +% \begin{macrocode} +\def\revyname#1{\def\@revyname{#1}} +\def\revyyear#1{\def\@revyyear{#1}} +% \end{macrocode} +% \begin{danish} +% \verb|\title| og \verb|\author| bliver ikke ændret. +% \end{danish} +% \begin{english} +% \verb|\title| and \verb|\author| remian unaltered. +% \end{english} +% \end{implementation} +% \begin{danish} +% Hvis \cn\ ikke får at vide, hvad revyens navn og år skal være, +% og hvad titlen er, går den som standard ud fra, at det er +% "`DIKUrevy"', "`1973"' og "`En sketch"'. +% \end{danish} +% \begin{english} +% If \cn\ isn't given a revue name, year or a title, it will use the +% defaults of ``DIKUrevy'', ``1973'' and ``En sketch''. +% \end{english} +% \begin{implementation} +% \begin{macrocode} +\def\@revyyear{1973} +\def\@revyname{DIKUrevy} +\def\@title{En sketch} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\author} +% \begin{macro}{\status} +% \begin{macro}{\eta} +% \begin{macro}{\responsible} +% \begin{macro}{\melody} +% \begin{danish} +% De resterende bliver ikke sat, hvis de ikke bliver defineret. +%\begin{verbatim} +%\status{eksempel} +%\eta{$1$ minut, $47$ sekunder} +%\responsible{Dig} +%\author{en eksempelsmed} +%\melody{Queen: "`Bohemian Rhapsody"' (\url{https://youtu.be/fJ9rUzIMcZQ})} +%\end{verbatim} +% \end{danish} +% \begin{english} +% The rest aren't typeset if they are not defined. +%\begin{verbatim} +%\status{example} +%\eta{$1$ minute, $47$ seconds} +%\responsible{Probably you} +%\melody{Monty Python: ``Always look on the bright side of life'' +% (\url{https://youtu.be/SJUhlRoBL8M})} +%\end{verbatim} +% \end{english} +% \begin{implementation} +% \begin{danish} +% For at holde styr på, om de her ting er defineret, definerer +% vi følgende \verb|\if|--makroer, og sætter dem til falsk som +% udgangspunkt: +% \end{danish} +% \begin{english} +% These new \verb|\if| macros keep track of which of these +% things have been defined. +% \end{english} +% \begin{macrocode} +\newif\if@author\@authorfalse +\newif\if@status\@statusfalse +\newif\if@eta\@etafalse +\newif\if@responsible\@responsiblefalse +\newif\if@melody\@melodyfalse +% \end{macrocode} +% \begin{danish} +% Og så makroerne, som sætter værdierne: +% \end{danish} +% \begin{english} +% And these macros define them: +% \end{english} +% \begin{macrocode} +\def\author#1{\def\@author{#1}\@authortrue} +\def\status#1{\def\@status{#1}\@statustrue} +\def\eta#1{\def\@eta{#1}\@etatrue} +\def\responsible#1{\def\@responsible{#1}\@responsibletrue} +\def\melody#1{\def\@melody{#1}\@melodytrue} +% \end{macrocode} +% \begin{danish} +% Vi sørger for, at de interne makroer ikke er udefinerede: +% \end{danish} +% \begin{english} +% Ensuring that the internal macros aren't undefined: +% \end{english} +% \begin{macrocode} +\def\@author{} +\def\@status{} +\def\@eta{} +\def\@responsible{} +\def\@melody{} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\auteurs} +% \begin{danish} +% Og som bonus har vi bibeholdt \verb|\auteurs|, som er et alias til +% \verb|\author|, for folk med fine fornemmelser. +% \end{danish} +% \begin{english} +% And as a bonus, we've retained \verb|\auteurs| as an alias of +% \verb|\author|, for fancy folk. +% \end{english} +% \begin{implementation} +% \begin{macrocode} +\let\auteurs\author +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\writtenbyname} +% \begin{macro}{\melodyname} +% \begin{macro}{\responsibletext} +% \begin{macro}{\statustext} +% \begin{danish} +% Mærkaterne, som \cn\ bruger i infoblokken, altså +% "`\@writtenbyname"', "`\@melodyname"', etc., kan laves om med +% makroerne +% \begin{showcommand} +% \verb|\writtenbyname|\marg{tekst} +% \item\verb|\melodyname|\marg{tekst} +% \item\verb|\responsibletext|\marg{tekst} +% \end{showcommand} +% og +% \begin{showcommand} +% \verb|\statustext|\marg{tekst} +% \end{showcommand} +% De fleste af dem tager bare den nye mærkat som argument, så fx +% "`\@responsibletext"' kan laves om til "`Kæmpehare:"' ved at sige +% \begin{verbatim} +%\responsibletext{Kæmpehare:} +% \end{verbatim} +% \end{danish} +% \begin{english} +% \begin{verbatim} +%\writtenbyname{written by} +%\melodyname{Melody:} +%\responsibletext{\TeX--responsible} +% \end{verbatim} +% The labels on some of the bits of info are in danish by default: +% ``\@writtenbyname'', ``\@melodyname'' and ``\@responsibletext'', +% respectively. These commands overwrite those defaults. There is +% also a command for changing the ``Status'' label, which happens +% not to be necessary in english: +% \begin{showcommand} +% \verb|\statustext| \marg{text} +% \end{showcommand} +% \end{english} +% \begin{implementation} +% \begin{macrocode} +\def\writtenbyname#1{\def\@writtenbyname{#1}} +\def\melodyname#1{\def\@melodyname{#1}} +\def\responsibletext#1{\def\@responsibletext{#1}} +\def\statustext#1{\def\@statustext{#1}} +\def\@writtenbyname{skrevet af} +\def\@melodyname{Melodi:} +\def\@responsibletext{\TeX--ansvarlig:} +\def\@statustext{Status:} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\pagessum} +% \begin{danish} +% Men sidetallet er lidt mere kompliceret, så her har vi brug for +% en makro, som tager 1 argument (et \meta{tal}), og sætter ordet +% `side' i det rigtige tal efter det. Så \verb|\pagessum{0}| giver +% "`0 sider"', mens \verb|\pagessum{1}| giver "`1 side"'. En ny +% makro, som hedder \verb|\pagessum|, men gør ngoet andet, kan +% defineres med \verb|\renewcommand|. +% \end{danish} +% \begin{english} +% The page count is a touch more complicated, and requires a macro +% that takes 1 argument (a \meta{number}), and evaluates to the +% grammatically correct phrase for that page count. Thus +% \verb|\pagessum{0}| becomes ``0 sider'' (the plural), while +% \verb|\pagessum{1}| becomes ``1 side'' (the singular). +% \end{english} +% \begin{implementation} +% \begin{english} +% The default macro, for danish, is +% \end{english} +% \begin{macrocode} +\newcommand{\pagessum}[1]{#1 side\ifnum1=#1\else r\fi} +% \end{macrocode} +% \end{implementation} +% \begin{english} +% In the example, such a macro is given for english in the line +% \begin{verbatim} +%\renewcommand{\pagessum}[1]{#1 page\ifnum#1=1\else s\fi} +% \end{verbatim} +% \end{english} +% \end{macro} +% +% \begin{implementation} +% \begin{macro}{\maketitle} +% \begin{danish} +% omskrives, så den laver en titelblok som den i figur \ref{title}. +% \end{danish} +% \begin{english} +% is rewritten to create a title segment like what was shown in +% figure \ref{title}. +% \end{english} +% \iffalse +%<*driver> +%^^A I do want to keep the real \maketitle in the .dtx file, though +\let\actual@maketitle\maketitle +% +% \fi +% \begin{macrocode} +\def\maketitle{{\thispagestyle{empty} + \vspace*{-\headheight}\vspace*{-\headsep} + \centering{\Large\@revyname{} \@revyyear}\vspace{5pt}\\ + {\LARGE \bf \@title}\vspace{5pt}\\ + \if@author{\large\@writtenbyname{} \@author}\vspace{5pt}\\\fi + \if@melody{\sl\@melodyname{} \@melody}\vspace{5pt}\\\fi +% \end{macrocode} +% \begin{macrocode} + \if@leftfields + \begin{varwidth}[t]{\bigheaderwidth}\raggedleft + \if@status{\@statustext{} \@status}\vspace{2pt}\\\fi + \if@responsible{\@responsibletext{} \@responsible}\vspace{2pt}\\\fi + \if@eta{(\@eta)}\\\fi + \end{varwidth}% +% \end{macrocode} +% \begin{danish} +% Det eksplicitte mellemrum her holder formatteringen konsistent. +% \end{danish} +% \begin{english} +% The explicit space here keeps the foratting regular. +% \end{english} +% \begin{macrocode} + \ \hspace{.5em}\vrule{}\hspace{.5em} + \begin{varwidth}[t]{\smallheaderwidth}\raggedright + Version \@version\vspace{2pt}\\ + \today\vspace{2pt}\\ + \pagessum{\getpagerefnumber{lastpage}} + \end{varwidth} +% \end{macrocode} +% \begin{macrocode} + \else + Version \@version + \ \hspace{.5em}\vrule\hspace{.5em} + \today + \ \hspace{.5em}\vrule\hspace{.5em} + \pagessum{\getpagerefnumber{lastpage}} + \fi + \vskip 5pt }} +% \end{macrocode} +% \iffalse +%<*driver> +\let\class@maketitle\maketitle +\let\maketitle\actual@maketitle +% +% \fi +% +% \begin{danish} +% Miljøet \verb|varwidth|\DescribeEnv{varwidth}\ styrer placeringen +% af dobbeltkolonnedelen af titelblokken. Det kommer fra +% \end{danish} +% \begin{english} +% The environment \verb|varwidth|\DescribeEnv{varwidth}\ controls the +% placement of the two--column part of the title block. It comes +% from +% \end{english} +% \begin{macrocode} +\RequirePackage{varwidth} +% \end{macrocode} +% \iffalse +%<*driver> +\jump +% +% \fi +% +% \begin{danish} +% \texttt{\bslash getpagerefnumber} er en version af \texttt{\bslash +% pageref} som kan udvides. Den kommer fra +% \end{danish} +% \begin{english} +% \texttt{\bslash getpagerefnumber} is an expandable version of +% \texttt{\bslash pageref} from +% \end{english} +% \begin{macrocode} +\RequirePackage{refcount} +% \end{macrocode} +% +% \begin{macro}{\if@leftfields} +% \begin{danish} +% Den her makro fungerer som\footnote{her er $\lor$ logisk +% `eller'.} \verb|\if@responsible| $\lor$ \verb|\if@status| +% $\lor$ \verb|\if@eta|. \TeX{}'s \texttt{\bslash +% if}--mekanisme understøtter ikke som sådan en +% $\lor$--operator, så vi bruger tallene 0 og 1 som +% stedfortrædere for booliske værdier, og bruger +% talsammenligninger til at definere +% \end{danish} +% \begin{english} +% This macro is defined to effectively be\footnote{$\lor$ being +% logical OR.} \verb|\if@responsible| $\lor$ \verb|\if@status| +% $\lor$ \verb|\if@eta|. In the absence of a real +% $\lor$--operator for \TeX{}'s \texttt{\bslash if}, it uses +% 1's and 0's as standins for boolean values. +% \end{english} +% \iffalse +%<*driver> +\land +% +% \fi +% \begin{macrocode} +\def\if@leftfields{ + \def\@responsiblenum{\ifx\iftrue\if@responsible 1 \else 0 \fi} + \def\@statusnum{\ifx\iftrue\if@status 1 \else 0 \fi} + \def\@etanum{\ifx\iftrue\if@status 1 \else 0 \fi} +% \end{macrocode} +% \begin{macrocode} + \ifnum1=\ifnum1=\@responsiblenum 1 + \else \ifnum1=\@statusnum 1 + \else \ifnum1=\@etanum 1 + \else 0 + \fi\fi\fi +} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\smallheaderwidth} +% \begin{macro}{\bigheaderwidth} +% \begin{danish} +% Og disse længder blev brugt. +% \end{danish} +% \begin{english} +% And these lengths were used. +% \end{english} +% \begin{macrocode} +\newlength{\smallheaderwidth} +\setlength{\smallheaderwidth}{22ex} +\newlength{\bigheaderwidth} +\setlength{\bigheaderwidth}{\textwidth} +\addtolength{\bigheaderwidth}{-\smallheaderwidth} +\addtolength{\bigheaderwidth}{-1.5em} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \iffalse +%<*driver> +\jump +% +% \fi +% \end{macro} +% \end{implementation} +% +% \begin{danish} +% \subsubsection{Sidehoveder} +% Klassen definerer også sine egne sidehoveder, illustreret i figur +% \ref{sidehoved}, som indeholder nogle af de samme informationer. +% \end{danish} +% \begin{english} +% \subsubsection{Page headers} +% The class also defines its own header style, which is illustrated +% in figure \ref{sidehoved}, and contains some of the same information. +% \end{english} +% +% \begin{figure}[htbp] +% \begingroup +% \IfLanguageName{danish}{\exDaPre}{} +% \IfLanguageName{english}{\exEnPre}{} +% \ps@revyheadings +% \let\thepage=2 +% \def\pageref#1{2} +% \renewcommand{\rectoheaderthumbtab}{} +% \vspace{3em} +% \@oddhead +% \medskip +% \endgroup +% \begin{danish} +% \caption{Et eksempel på sidehovederne, som \cn\ definerer.} +% \end{danish} +% \begin{english} +% \caption{An example of the headers that \cn\ define.} +% \end{english} +% \label{sidehoved} +% \end{figure} +% +% \iffalse +%<*driver> +\land +% +% \fi +% +% \begin{danish} +% De her sidehoveder hører til en ny \texttt{pagestyle}, som hedder +% \texttt{revyheadings}. +% \end{danish} +% \begin{english} +% These headers belong ot a new \texttt{pagestyle} named +% \texttt{revyheadings} +% \end{english} +% \begin{implementation} +% \begin{macro}{\ps@revyheadings} +% \begin{macrocode} +\gdef\ps@revyheadings{ + \def\@oddhead{\vbox to 0pt{\vss + \hbox to \textwidth{\hfil\rectoheaderthumbtab} + \hbox{\rm\strut\@revyname{} \@revyyear} + \hbox to \textwidth{Version \@version\quad\today + \hfil {\large\sl\@title}\hfil + Side \rm\thepage/\pageref{lastpage}} + \hrule}} + \def\@evenhead{\vbox to 0pt{\vss + \hbox{\versoheaderthumbtab} + \hbox to \textwidth{\hfil\rm\strut\@revyname{} \@revyyear} + \hbox to \textwidth{Side \rm\thepage/\pageref{lastpage} + \hfil {\large\sl\@title}\hfil + Version \@version\quad\today} + \hrule}} + \def\@oddfoot{}\def\@evenfoot{}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\rectoheaderthumbtab} +% \begin{macro}{\versoheaderthumbtab} +% \begin{danish} +% Her er \verb|\rectoheaderthumbtab| og +% \verb|\versoheaderthumbtab| makroer, som placerer +% registermærkningerne korrekt på siden i forhold til sidehovedet, +% og kalder kommandoen, som tegner dem, så længe \cn\ er blevet +% kaldt med valgmuligheden \verb|thumbindex|, se sektion +% \ref{thumbindex}. Hvis ikke, så gør de ikke noget. +% \end{danish} +% \begin{english} +% Here, the \verb|\rectoheaderthumbtab| and +% \verb|\versoheaderthumbtab| are macros that place the thumb +% markings correctly in relation to the page header, and call the +% drawing macro, so long as \cn\ has been given the option +% \verb|thumbindex|, see section \ref{thumbindex}. If not, they do +% nothing. +% \end{english} +% \begin{macrocode} +\newcommand{\rectoheaderthumbtab}{% + \if@thumbindex + \rectothumbtabfor{\@title}% + \vspace*{ -\paperheight }\vspace*{ -\voffset }\vspace*{ 0.32in }% + \hspace{-\paperwidth }\hspace{ 1in }\hspace{ \oddsidemargin }% + \hspace{ \hoffset }\hspace{ \textwidth }\hspace{-.6cm}% + \fi +} +\newcommand{\versoheaderthumbtab}{% + \if@thumbindex + \hspace{ -2.5in }\hspace{ -\evensidemargin }% + \hspace{ -\hoffset }\hspace{ -1in }% + \versothumbtabfor{\@title}% + \vspace*{ -\paperheight }\vspace*{ -\voffset }\vspace*{ 0.32in }% + \fi +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \iffalse +%<*driver> +\jump +% +% \fi +% \end{implementation} +% \begin{danish} +% Den nye \texttt{pagestyle} er aktiveret som standard. +% \end{danish} +% \begin{english} +% The new \texttt{pagestyle} is activated by default. +% \end{english} +% \begin{implementation} +% \begin{macrocode} +\pagestyle{revyheadings} +% \end{macrocode} +% \DescribeMacro{\ps@empty} +% \begin{danish}^^A +% Men vi omdefinerer også \texttt{pagestyle}'en "`\texttt{empty}"' +% til at være +% \end{danish}^^A +% \begin{english}^^A +% But we also redefine the \texttt{pagestyle} ``\texttt{enpty}'' to be +% \end{english} +% \begin{macrocode} +\gdef\ps@empty{ + \def\@oddhead{\vbox to 0pt{\vss + \hbox to \textwidth {\hfil\rectoheaderthumbtab } + \vbox to 2em{}}} + \def\@evenhead{\vbox to 0pt{\vss\hbox{\versoheaderthumbtab}}} + \def\@oddfoot{}\def\@evenfoot{}} +% \end{macrocode} +% \end{implementation} +% +% \begin{danish} +% \subsection{Tildelingslister} +% +% Rolle- og rekvisitlisterne i starten af eksemplet, som også er +% gengivet i figur \ref{lists}, produceres af følgende linjer: +% +%\begin{verbatim} +% \begin{roles} +% \role{PH}[Jophiel] Per Hedegaard +% \role{I} Vred instruktør +% \role{A9}[A--ni] Anine +% \end{roles} +% \begin{props} +% \prop{Hedegaard--hår}[Person, der skaffer] +% \prop{Didgeridoo}[Anine] +% \end{props} +%\end{verbatim} +% +% \begin{figure}[htbp] +% \medskip +% \begin{roles} +% \role{PH}[Jophiel] Per Hedegaard +% \role{I} Vred instruktør +% \role{A9}[A--ni] Anine +% \end{roles} +% \begin{props} +% \prop{Hedegaard--hår}[Person, der skaffer] +% \prop{Didgeridoo}[Anine] +% Et traditionelt Australsk blæseinstrument +% \end{props} +% \medskip +% \caption{Eksempel på lister, som kan sættes med \cn\ til at +% uddele, for eksempel, roller og ansvar for for rekvisitter.} +% \label{lists} +% \end{figure} +% +% \end{danish} +% \begin{english} +% \subsection{Assignement lists} +% +% We provide a number of environments for setting information about +% the material in a file in lists. In the example file, we produce +% something like the lists shown in figure \ref{lists}, with the +% passage +% \begin{verbatim} +%\rolename{Roles:} +%\begin{roles} +% \role{KA}[Graham] Arthur, king of all the Britons +% \role{P}[Michael] Peasant +% \role{RC}[John] Roman Centurion +% % [...] +%\end{roles} +%\propname{Props:} +%\begin{props} +% \prop{Large sign} +% \prop{Field of crosses} +%\end{props} +% \end{verbatim} +% \begin{figure}[hbtp] +% \medskip +% \rolename{Roles:} +% \begin{roles} +% \role{KA}[Graham] Arthur, king of all the Britons +% \role{P}[Michael] Peasant +% \role{RC}[John] Roman Centurion +% \end{roles} +% \propname{Props:} +% \begin{props} +% \prop{Large sign} +% \prop{Field of crosses} +% \end{props} +% \medskip +% \caption{Examples of the assignment lists that can be typeset +% with \cn, for noting cast lists, among other things.} +% \label{lists} +% \end{figure} +% \end{english} +% +% \iffalse +%<*driver> +\land +% +% \fi +% \begin{implementation} +% \begin{environment}{revy@list} +% \begin{danish} +% Begge de miljøer blev udledt fra det her miljø. +% \end{danish} +% \begin{english} +% Both those environments are derived from this environment. +% \end{english} +% \begin{macrocode} +\newenvironment{revy@list}[1]% +{{\smallskip\noindent\Large\bf#1} + \begin{list}{}{ + \labelwidth 8em + \leftmargin 10em + \rightmargin 0em + \labelsep 1em + \listparindent 0em + \topsep 1ex + \partopsep 0ex + \parsep 1ex + \itemsep -1ex\relax + }% + }% + {\end{list}\smallskip\hfil\rule{6cm}{0.1mm}\medskip\par} +% \end{macrocode} +% \begin{danish} +% Argumentet, som det her miljø tager, er listens overskrift. +% \end{danish} +% \begin{english} +% The argument that this environment takes is the title for the +% list. +% \end{english} +% \end{environment} +% +% \begin{macro}{\revy@itemname} +% \begin{danish} +% Fordi \texttt{revy@list} er afledt fra \texttt{list}--miljøet, +% så forventer det, at punkter på listen bliver kaldt med +% \verb|\item|. Vi, som brugere, forventer, at vi kan bruge vores +% egne navne for punkter på de her lister, og at de bliver sat i +% deres egen stil. Den her makro laver de definitioner, som er +% nødvendige, for at bruge de kommandoer. +% \end{danish} +% \begin{english} +% As the \texttt{revy@list} environment is derived from the +% \texttt{list} environment, it expects entries in its list to +% ultimately be called with \verb|\item|. However, for the +% environments presented to the end user, we like to provide item +% commands that more closely match the intended use. This macro +% bundles the process of creating those commands. +% \end{english} +% \begin{macrocode} +\def\revy@itemname#1{% + \def\@itemwithout##1{\item [{\bf ##1} \hfill] } + \def\@itemwith##1[##2]{\item [{\bf ##1} (##2) \hfill] } + \expandafter\def\csname #1\endcsname##1{% + \@ifnextchar [{\@itemwith{##1}}{\@itemwithout{##1}}%] + } +} +% \end{macrocode} +% \begin{danish} +% Argumentet er navnet på den kommando, som kommer til at sætte +% punkter på listen. +% +% Se nogle eksempler på, hvordan den bruges, lige under her. +% \end{danish} +% \begin{english} +% The argument is the name of the macro that will be created for +% setting items on our lists. +% +% Some examples of how these are used will follow. +% \end{english} +% \end{macro} +% \end{implementation} +% +% \begin{environment}{roles} +% \begin{danish} +% I rollelisten, for eksempel, sættes hver rolletildeling med +% kommandoen +% +% \verb|\role|\marg{fk.}\oarg{skuespiller}\meta{rollebeskrivelse}. +% \end{danish} +% \begin{english} +% In the role list, each role is set with the macro +% +% \verb|\role|\marg{abr.}\oarg{actor}\meta{description} +% \end{english} +% \begin{implementation} +% \begin{danish} +% Her afledes rollelistemiljøet fra \texttt{revy@list}. +% \end{danish} +% \begin{english} +% The roles list environment is here derived from +% \texttt{revy@list}. +% \end{english} +% \begin{macrocode} +\newenvironment{roles}{ + \begin{revy@list}{\@rolename} + \revy@itemname{role} + }{ + \end{revy@list} +} +% \end{macrocode} +% \end{implementation} +% \end{environment} +% +% \begin{environment}{props} +% \begin{environment}{mics} +% \begin{environment}{instructors} +% \begin{danish} +% Ud over rollelisten findes også miljøer til lister over +% rekvisitter (som også ver med i eksemplet), mikrofoner og +% instruktørere.\footnote{\cn\ stiller ikke nogen krav til +% hvorvidt nogen af de her miljøer bliver brugt. Check med din +% revyorganisation for at høre hvad der skal være med i materiale +% til din revy.} For de sidste miljøer er kommandoerne til at lave +% et punkt på de lister henholdsvis +% \begin{showcommand} +% \verb|\prop|\marg{rekvisit}\oarg{ansvarlig}\meta{beskrivelse}, +% +% \end{showcommand} +% \begin{showcommand} +% \verb|\mic|\marg{fk.}\oarg{skuespiller}\meta{mikrofon} +% \end{showcommand} +% og +% \begin{showcommand} +% \verb|\instructor|\oarg{titel}\meta{navn}. +% \end{showcommand} +% \end{danish} +% \begin{english} +% Beyond the roles environment, \cn\ defines these three +% additional environments, for typesetting lists that may be +% useful to a production. Of these, the examples in figures +% \ref{eksempel} and \ref{lists} used \verb|props|. +% +% Within these environments, \verb|props|, \verb|mics| and +% \verb|instructors|, the macros for setting a list item are +% \begin{showcommand} +% \verb|\prop|\marg{prop}\oarg{responsible}\meta{description}, +% \end{showcommand} +% \begin{showcommand} +% \verb|\mic|\marg{abr.}\oarg{actor}\meta{microphon} +% \end{showcommand} +% og +% \begin{showcommand} +% \verb|\instructor|\oarg{title}\meta{name}, +% \end{showcommand} +% respectively. +% \end{english} +% \begin{implementation} +% \begin{danish} +% Definitionen følger de samme linjer som definitionen af +% \texttt{roles}--miljøet. +% \end{danish} +% \begin{english} +% Their definitions run along the same lines as the +% \texttt{roles} environment. +% \end{english} +% \begin{macrocode} +\newenvironment{props}{ + \begin{revy@list}{\@propname} + \revy@itemname{prop} + }{ + \end{revy@list} +} +\newenvironment{mics}{ + \begin{revy@list}{\@micname} + \revy@itemname{mic} + }{ + \end{revy@list} +} +% \end{macrocode} +% \begin{danish} +% Strukturen i listekommandoen \verb|\instructor|, i +% \texttt{instructors}, er forskellig fra den, som +% \verb|\revy@itemname| definerer, så vi implementerer den særskilt. +% \end{danish} +% \begin{english} +% However, the structure of the item macro in \texttt{instructors} +% doesn't fit the pattern, and so needs its own particular +% implementation. +% \end{english} +% \begin{macrocode} +\newenvironment{instructors}{ + \begin{revy@list}{\@instructorname} + \def\@instructorwith[##1]{\item [{\bf ##1} \hfill] } + \def\@instructorwithout{\item} + \def\instructor{% + \@ifnextchar [{\@instructorwith}{\@instructorwithout}%] + } + }{ + \end{revy@list} +} +% \end{macrocode} +% \end{implementation} +% \end{environment} +% \end{environment} +% \end{environment} +% +% +% \begin{macro}{\rolename} +% \begin{macro}{\propname} +% \begin{macro}{\micname} +% \begin{macro}{\instructorname} +% \begin{danish} +% Miljøernes standardoverskrifter---"`Roller:"', "`Rekvisitter:"', +% "`Mikrofoner"' og "`Instruktører:"'---kan ændres med +% makroerne +% \begin{showcommand} +% \verb|\rolename|\marg{tekst}, +% \item\verb|\propname|\marg{tekst}, +% \item\verb|\micname|\marg{tekst} +% \end{showcommand} +% og +% \begin{showcommand} +% \verb|\instructorname|\marg{tekst} +% \end{showcommand} +% \end{danish} +% \begin{english} +% The default headings for these environments---``Roller:'', +% ``Rekvisitter:'', ``Mikrofoner'' and ``Instruktører:''---may be +% changed with the macros +% \begin{showcommand} +% \verb|\rolename|\marg{text}, +% \item\verb|\propname|\marg{text}, +% \item\verb|\micname|\marg{text} +% \end{showcommand} +% og +% \begin{showcommand} +% \verb|\instructorname|\marg{text} +% \end{showcommand} +% \end{english} +% \begin{implementation} +% \begin{macrocode} +\def\rolename#1{\def\@rolename{#1}} +\def\propname#1{\def\@propname{#1}} +\def\micname#1{\def\@micname{#1}} +\def\instructorname#1{\def\@instructorname{#1}} +% \end{macrocode} +% \begin{danish} +% Makroerne, som opbevarer de her navne, er +% \end{danish} +% \begin{english} +% The macros that store these names are +% \end{english} +% \begin{macrocode} +\def\@rolename{Roller:} +\def\@propname{Rekvisitter:} +\def\@micname{Mikrofoner:} +\def\@instructorname{Instruktører:} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{danish} +% \subsection{Brødtekst} +% \end{danish} +% \begin{english} +% \subsection{Body text} +% \end{english} +% \subsubsection{\texttt{sketch}} +% \begin{environment}{sketch} +% \begin{danish} +% \changes{v1.0.0}{2023/09/05}{Brødtekst--makroer +% (\texttt{\textbackslash scene}, etc.) findes ikke længere uden for +% \texttt{song} og \texttt{sketch} miljøerne.} +% For at sætte talte replikker, som eksemplet vist i figur +% \ref{sketchex}, bruger vi miljøet |sketch|. +% +% \begin{figure}[hbtp] +% \begin{center}$\vdots$\end{center} +% \begin{sketch} +% \says{A9} Nå, men så må jeg jo hellere begynde at lede. \act{Vender +% sig mod Bandet} Bandet, har I...? +% \scene Hvert bandmedlem holder sin egen didgeridoo op. +% \says{A9}[Til PH] Den ser ud til at være i vinkel. +% \says{PH} Sejt. +% \end{sketch} +% \begin{center}$\vdots$\end{center} +% \caption{Et eksempel på, hvordan replikker typesættes med +% \texttt{sketch}--miljøet.} +% \label{sketchex} +% \end{figure} +% \end{danish} +% \begin{english} +% \changes{v1.0.0}{2023/09/05}{The body text macros +% (\texttt{\textbackslash scene}, etc.) are no longer available +% outside the \texttt{song} and \texttt{sketch} environments.} +% To typese spoken lines, as in the example shown in figure +% \ref{sketchex}, use the \texttt{sketch} envrionment. +% +% \begin{figure}[hbtp] +% \begin{center}$\vdots$\end{center} +% \begin{sketch} +% \says{RC}[To KA] Did you write th... wait a minute. \act{Off +% stage} It's him! \act{Back at KA} How did you get here? +% +% \does{KA} attempts to sidle away. +% +% \says{RC} Get him! +% +% \scene Several Roman soldiers appear, and drag \role{KA} off +% stage, while \role{KA} attempts to protest. +% \end{sketch} +% \begin{center}$\vdots$\end{center} +% \caption{An example of how spoken lines are typeset, using the +% \texttt{sketch} environment.} +% \label{sketchex} +% \end{figure} +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% \verb|sketch| er, ligesom tildelingslisterne, implementeret +% ved brug af \verb|list|--milljøet. Miljøet +% \verb|revy@bodycommon| introducerer makroer, som er fælles +% mellem miljøerne \verb|sketch| og \verb|song|. Den bliver +% defineret på side \pageref{bodycommon}. +% \end{danish} +% \begin{english} +% \verb|sketch|, like the assignment list environments, is +% derived from the \verb|list| environment. The environment +% \verb|revy@bodycommon| introduces macros that are shared +% between the \verb|sketch| and \verb|song| environments. It is +% defined on page \pageref{bodycommon}. +% \end{english} +% \begin{macrocode} +\newenvironment{sketch}{% + \begin{revy@bodycommon} + \rm\begin{list}{}{ + \labelwidth 2em + \leftmargin 3em + \rightmargin 0em + \labelsep 0.5em + \listparindent 2em + \topsep 1ex + \partopsep 1ex + \parsep 0ex + \itemsep 1ex\relax}% + \item \rule{0.2em}{0em}\vspace{-1em}\par %} +% \end{macrocode} +% \end{implementation} +% +% \begin{macro}{\says} +% \begin{danish} +% Inde i \verb|sketch| sætter makroen \verb|\says| hver enkelt +% replik. Den fulde syntaks er: +% \begin{showcommand} +% \verb|\says|\marg{fk.}\oarg{instruktion} \meta{replik} +% \end{showcommand} +% \end{danish} +% \begin{english} +% Inside the \verb|sketch| environment, the macro \verb|\says| +% sets each line of dialouge. Its complete syntax is: +% \begin{showcommand} +% \verb|\says|\marg{abr.}\oarg{direction} \meta{line} +% \end{showcommand} +% \end{english} +% \begin{implementation} +% \begin{danish} +% \verb|\says| og \verb|\scene| (se side \pageref{sceneuse}) +% skifter frem og tilbage mellem hver deres tilstand i +% miljøet. Vi piller ved \verb|\leftskip|, for at ændre +% indrykningen af \verb|\scene|. +% \end{danish} +% \begin{english} +% \verb|\says| and \verb|\scene| (see page \pageref{sceneuse}) +% effectively shift the environment back and forth between two +% modes of typesetting. We mess around with \verb|\leftskip| to +% accomplish changes in indentation. +% \end{english} +% \begin{macrocode} + \newdimen\old@leftskip + \old@leftskip \leftskip + \newdimen\short@leftskip + \short@leftskip \leftskip + \advance\short@leftskip -1.5em +% \end{macrocode} +% \begin{macro}{\says} +% \begin{macrocode} +\def\says##1{\@ifnextchar [{\@saysas{##1}}{\@says{##1}}} %] +\def\@saysas##1[##2]{\rm\item [{\bf ##1 }{\it (##2)\,}\hfill:] + \leftskip \old@leftskip} +\def\@says##1{\rm\item [{\bf ##1\,}\hfill:]\leftskip \old@leftskip} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\scene} +% \begin{macrocode} +\def\scene{\medskip\par\noindent\it\leftskip \short@leftskip } +% \end{macrocode} +% \end{macro} +% \end{implementation} +% +% \begin{danish} +% Så for eksempel den næstsidste replik i figur \ref{sketchex} er +% kreéret med følgende kode: +% \begin{verbatim} +% \says{A9}[Til PH] Den ser ud til at være i vinkel. +% \end{verbatim} +% \end{danish} +% \begin{english} +% Thus, for example, part of the first line of figure +% \ref{sketchex} gets created with the following code: +% \begin{verbatim} +% \says{RC}[To KA] Did you write th... wait a minute. \act{Off stage} (...) +% \end{verbatim} +% \end{english} +% \end{macro} +% +% \begin{implementation} +% \begin{danish} +% Og her afslutter vi \verb|sketch|--miljøet. +% \end{danish} +% \begin{english} +% And here, the \verb|sketch| environment is concluded. +% \end{english} +% \begin{macrocode} + }{% + \end{list} + \end{revy@bodycommon} +} +% \end{macrocode} +% \end{implementation} +% \end{environment} +% +% \subsubsection{\texttt{song}} +% \begin{environment}{song} +% \begin{danish} +% \changes{v1.0.0}{2023/09/05}{Brødtekst--makroer +% (\texttt{\textbackslash scene}, etc.) findes ikke længere uden for +% \texttt{song} og \texttt{sketch} miljøerne.} +% Miljøet \verb|song| er til sangtekster, som sættes som eksemplet +% i figur \ref{songex}. +% +% \begin{figure}[hbtp] +% \begin{center}$\vdots$\end{center} +% \begin{song} +% \scene{Bandet spiller "`Bohemian Rhapsody"' af Queen, +% udelukkende på +% didgeridoo.} +% \sings{A9} Åh, Per Hede +% Er den lede +% Og han dumped' mig i kvant! +% +% \sings{PH} Per Hedegaard har er reeksamenssæt til dig +% \end{song} +% \begin{center}$\vdots$\end{center} +% \caption{Et eksempel på, hvordan sangtekster typesættes, med +% miljøet \texttt{song}.} +% \label{songex} +% \end{figure} +% \end{danish} +% \begin{english} +% \changes{v1.0.0}{2023/09/05}{The body text macros +% (\texttt{\textbackslash scene}, etc.) are no longer available +% outside the \texttt{song} and \texttt{sketch} environments.} +% The \verb|song| environment is for song lyrics, which are set as +% demonstrated in figure \ref{songex}. +% +% \begin{figure}[hbtp] +% \begin{center}$\vdots$\end{center} +% \begin{song} +% \sings{CC} ...be silly chumps, +% Just purse you're lips and whistle, +% That's the thing. +% +% And, always look on the bright side of life, +% \end{song} +% \begin{center}$\vdots$\end{center} +% \caption{An example of how song lyrics are typeset, using the +% \texttt{song} environment.} +% \label{songex} +% \end{figure} +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% \verb|song|--miljøet er også implementeret ud fra \verb|list| +% og \verb|revy@bodycommon|. +% \end{danish} +% \begin{english} +% The \verb|song| environment is also implemented as a +% derivative of \verb|list| and uses \verb|revy@bodycommon|. +% \end{english} +% \begin{macrocode} +\newenvironment{song}{% + \begin{revy@bodycommon} + \rm\begin{list}{}{% + \raggedright + \labelwidth 4.5em + \leftmargin 7em + \rightmargin 0em + \labelsep 2em + \listparindent -2em + \topsep 0ex + \partopsep \bigskipamount + \parsep .6\baselineskip + \itemsep -.6\baselineskip + \relax + } + \item[] \rule{0.2em}{0em}\vspace{-\baselineskip}\strut\par %} +% \end{macrocode} +% \end{implementation} +% +% \begin{macro}{\sings} +% \begin{danish} +% Inde i \verb|song|--miljøet sætter makroen \verb|\sings| +% sangstrofer. Den fulde syntaks er +% +% \begin{showcommand} +% \verb|\sings|\marg{fk.}\oarg{instruktion} \meta{sangtekst} +% \end{showcommand} +% +% Linjeskift er vigtige i sangtekster, så \verb|song|--miljøet +% ændrer, hvordan \LaTeX\ reagerer på linjeskift i kildefilen. For +% eksempel kan \textbf{A9}'s strofer i figur \ref{songex} kreeres +% med denne kildekode: +% \begin{verbatim} +% \sings{A9} Åh, Per Hede +% Er den lede +% Og han dumped' mig i kvant! +% \end{verbatim} +% \end{danish} +% \begin{english} +% Within the \verb|song| environment, the macro \verb|\sings| sets +% song lyrics. Its full syntax is +% \begin{showcommand} +% \verb|\sings|\marg{abr.}\oarg{direction} \meta{lyric} +% \end{showcommand} +% +% Line breaks are significant in song lyrics, and so the +% \verb|song| chanees how \LaTeX\ reacts to carriage returns in +% the source file. For example, the lyric shown in figure +% \ref{songex} is the product, in part, of this source code: +% \begin{verbatim} +% \sings{CC} ...be silly chumps, +% Just purse you're lips and whistle, +% That's the thing. +% \end{verbatim} +% \end{english} +% \begin{implementation} +% \begin{danish} +% \verb|\sings| og \verb|\scene| skifter frem og tilbage mellem +% to endnu mere forskellige tilstande, end \verb|\says| og +% \verb|\scene| i \verb|sketch|--miljøet. Læg især mærke til +% brugen af \verb|\obeycr| og \verb|\restorecr|. +% \end{danish} +% \begin{english} +% \verb|\sings| and \verb|\scene| shift back and forth between +% to even more different states within the \verb|song| +% environment than was the case in \verb|sketch|. Much of the +% magic relates to the macros \verb|\obeycr| and +% \verb|\restorecr|. +% \end{english} +% \begin{macrocode} + \newdimen\old@leftskip + \old@leftskip \leftskip + \newdimen\short@leftskip + \short@leftskip \leftskip + \advance\short@leftskip -5.5em +% \end{macrocode} +% \begin{macro}{\sings} +% \begin{macrocode} +\def\sings##1{\obeycr + \@ifnextchar [{\@singsas{##1}}{\@sings{##1}}} %} +\def\@singsas##1[##2]{\rm\item [\hskip\@leftsingpad{\bf ##1 }{\it + (##2)\,}:\hskip\@rightsingpad]\hskip-2em\leftskip \old@leftskip} +\def\@sings##1{\rm\item [\hskip\@leftsingpad{\bf ##1\,}:\hskip + \@rightsingpad]\hskip-2em\leftskip \old@leftskip} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\scene} +% \begin{macrocode} +\let\old@sings=\sings +\def\scene{% + \def\sings{\let\sings=\old@sings \medskip\sings} + \medskip\par\leftskip \short@leftskip \restorecr + \it\noindent\relax +} +% \end{macrocode} +% \end{macro} +% +% \begin{danish} +% \verb|\@leftsingpad| og \verb|\@rightsingpad| gør det muligt, at +% stille sangtekster til at være venstre- eller højrejusterede. +% \end{danish} +% \begin{english} +% \verb|\@leftsingpad| and \verb|\@rightsingpad| allow us to set +% lyrics to be left or right justfied. +% \end{english} +% \begin{macrocode} + \newskip\@leftsingpad + \newskip\@rightsingpad + \def\flushsingsright{\@leftsingpad 0pt plus 1fill\@rightsingpad 0pt\relax} + \def\flushsingsleft{\@leftsingpad 0pt\@rightsingpad 0pt plus 1fill\relax} +% \end{macrocode} +% \begin{danish} +% Som standard sætter vi venstrejustering. +% \end{danish} +% \begin{english} +% We set left justification as the default. +% \end{english} +% \begin{macrocode} + \flushsingsleft +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{implementation} +% \begin{danish} +% Vi kalder \verb|\obeycr| her, sammen med nogle kommandoer, som +% fortæller \LaTeX, at den ikke skal bekymre sig så meget om +% længderne på linjer. +% \end{danish} +% \begin{english} +% We call \verb|\obeycr| here, along with some macros that get +% \LaTeX\ to be less concerned about the proper length of lines. +% \end{english} +% \begin{macrocode} + \tolerance10000\hfuzz21cm\obeycr +}{ + \end{list} + \end{revy@bodycommon} +} +% \end{macrocode} +% \end{implementation} +% +% \begin{implementation} +% \begin{macro}{\obeycr} +% \begin{macro}{\restorecr} +% \begin{danish} +% Makroerne, som gør linjeskift--magien mulig, er +% \end{danish} +% \begin{english} +% The macros that make the line breaking magic possible, are +% \end{english} +% \begin{macrocode} +\newif\if@newpar +{ + \catcode`\^^M=13 +% \end{macrocode} +% \begin{danish} +% Så nu skal vi passe på med vores linjeskift her i koden... +% \end{danish} +% \begin{english} +% At this point, we must be careful with carriage returns in the +% code itself... +% \end{english} +% \begin{macrocode} + \gdef\@carriagereturn{% + \@ifnextchar^^M{% + \@newpartrue% + }{% + \@ifnextchar\end{}{% + \@ifnextchar\sings{% + \if@newpar\bigskip\par\fi\@newparfalse% + }{% + \if@newpar\par\else\\\fi\@newparfalse% + }% + }% + }% + }% + \gdef\obeycr{% + \catcode`\^^M=13 % + \let^^M=\@carriagereturn% + \@gobblecr% + }% + \gdef\restorecr{\catcode`\^^M=5 }% +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{implementation} +% \end{environment} +% +% \begin{danish} +% +% \subsubsection{Fælles for \texttt{sketch} og \texttt{song}} +% Vi har også de følgende makroer, som kan bruges i både +% \verb|song|- og \verb|sketch|--miljøerne: +% \end{danish} +% \begin{english} +% \subsubsection{Both \texttt{sketch} and \texttt{song}} +% The \verb|sketch| and \verb|song| macros both provide the +% following macros: +% \end{english} +% \begin{implementation}\label{bodycommon} +% \begin{environment}{revy@bodycommon} +% \begin{danish} +% De bliver pakket i miljøet \verb|revy@bodycommon|. +% \end{danish} +% \begin{english} +% They are packaged in the environment \verb|revy@bodycommon|. +% \end{english} +% \DescribeEnv{revy@bodycommon} +% \begin{macrocode} +\newenvironment{revy@bodycommon}{ +% \end{macrocode} +% ^^A} +% \end{environment} +% \end{implementation} +% +% \begin{macro}{\role} +% \begin{danish} +% En makro til at formattere rolleforkortelser i teksten. +% \end{danish} +% \begin{english} +% A macro for formatting role abbreviations within the text. +% \end{english} +% \begin{implementation} +% \begin{danish} +% Den her makro har det samme navn som indgangskommandoen i +% \verb|roles|--miljøet. Men det er fint, for den bliver +% defineret inde i \verb|roles|'s interne \verb|group|. +% \end{danish} +% \begin{english} +% This macro has the same name as the item command inside the +% \verb|roles| environment. But it's OK, because that command is +% defined inside \verb|roles|'s internal \verb|group|. +% \end{english} +% \begin{macrocode} + \let\role = \textbf +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\does} +% \begin{danish} +% \changes{v1.0.0}{2023/09/05}{Ny makro} +% En makro til at give instruktioner til en bestemt rolle, som +% ikke er en talt replik, som for eksempel +% \begin{verbatim} +%\does{I} reagerer med åbenmundet vantro. +% \end{verbatim} +% \end{danish} +% \begin{english} +% \changes{v1.0.0}{2023/09/05}{New macro} +% A macro for giving instructions for a particular role that +% aren't a spoken line, such as +% \begin{verbatim} +%\does{KA} attempts to sidle away. +% \end{verbatim} +% \end{english} +% \begin{implementation} +% \begin{danish} +% Udrykningen på 1em er en hårdt indkodet længde, som passer +% til, hvordan \verb|song| og \verb|sketch| er sat op lige +% nu. Jeg er sikker på den ikke kommer til at hoppe op og bide +% nogen bagi senere... +% \end{danish} +% \begin{english} +% The 1em exdent is a hardcoded length that matches how +% \verb|song| and \verb|sketch| are defined right now. I'm sure +% it won't jump up and bite anyone in the future... +% \end{english} +% \begin{macrocode} + \def\does##1{\scene \hspace{-1em}\role{##1}} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\scene}\label{sceneuse} +% \begin{danish} +% \verb|\scene| bruges til regibemærkninger, som for eksempel +% \begin{verbatim} +% \scene Hvert bandmedlem holder sin egen didgeridoo op. +% \end{verbatim} +% \end{danish} +% \begin{english} +% \verb|\scene| is used for stage directions, such as +% \begin{verbatim} +% \scene P \& KA are startled. +% \end{verbatim} +% \end{english} +% \begin{implementation} +% \begin{danish} +% \verb|\scene| blev implementeret inde i \verb|sketch|- og +% \verb|song|--miljøerne. +% \end{danish} +% \begin{english} +% \verb|\scene| was implemented inside the \verb|sketch| and +% \verb|song| environments. +% \end{english} +% \end{implementation} +% \end{macro} +% +% \begin{macro}{\act} +% \begin{danish} +% \verb|\act| er til instruktioner, som for eksempel +% \begin{verbatim} +% (...) \act{Vender sig mod Bandet} Bandet, har I...? +% \end{verbatim} +% \end{danish} +% \begin{english} +% \verb|\act| is for directions, such as in +% \begin{verbatim} +% (...) It's him! \act{Back at KA} How did you get here? +% \end{verbatim} +% \end{english} +% \begin{implementation} +% \begin{macrocode} + \def\act##1{\textit{(##1)}} +% \end{macrocode} +% \end{implementation} +% \end{macro} +% +% \begin{danish} +% De blev begge brugt til at lave eksemplet i figur \ref{sketchex}. +% \end{danish} +% \begin{english} +% Both were used in the example in figure \ref{sketchex}. +% \end{english} +% +% \begin{implementation} +% \begin{danish} +% Og her afslutter vi miljøet \verb|revy@bodycommon|. +% \end{danish} +% \begin{english} +% And here, we end the the environment \verb|revy@bodycommon|. +% \end{english} +% \begin{macrocode} +}{} +% \end{macrocode} +% \end{implementation} +% \iffalse +%<*driver> +\jump +% +% \fi +% +% \begin{implementation} +% \begin{danish} +% \subsection{\texttt{.aux}--filen} +% Til fremtidigt brug sørger vi for, at vores metadata også bliver +% skrevet ud til \texttt{.aux}--filen, når dokumentet er færdigt. +% +% Det er også her, vi sætter en \texttt{label} på den sidste side. +% \end{danish} +% \begin{english} +% \subsection{The \texttt{.aux} file} +% For futue use, we will also ensure that our metadata is written +% to the \texttt{.aux} file at the end of the document. +% +% This is also where we \texttt{label} the last page. +% \end{english} +% \begin{macrocode} +\let\revyinfo=\relax +\newtoks\@titletoks +\newtoks\@authortoks +\newtoks\@melodytoks +\newtoks\@revyrevynametoks +\newtoks\@revyrevyyeartoks +\let\end@document=\enddocument +\def\enddocument{\label{lastpage}\write\@auxout + {\string\@ifundefined{revyinfo}{\string\def\string + \revyinfo\string##1\string##2\string##3\string + ##4\string##5\string##6\string##7\string##8{}}{}}\@titletoks= + \expandafter{\@title}\@titletoks= + \expandafter{\@title}\@authortoks= + \expandafter{\@author}\@melodytoks= + \expandafter{\@melody}\@revyrevynametoks= + \expandafter{\@revyname}\@revyrevyyeartoks= + \expandafter{\@revyyear}\write\@auxout + {\string\revyinfo{\the\@titletoks}{\@version} + {\today}% + {\the\@authortoks}% + {\the\@melodytoks}% + {}% + {\the\@revyrevynametoks}% + {\the\@revyrevyyeartoks}% + }% + \end@document +} +% \end{macrocode} +% \end{implementation} +% +% \appendix +% \bibliography{ucph-revy} +% \begin{implementation} +% \PrintIndex +% \end{implementation} +% \begin{danish} +% \section{Komplet eksempel} +% \label{fullex} +% \VerbatimInput{Eksempel.tex} +% \end{danish} +% \begin{english} +% \section{Complete example} +% \label{fullex} +% \VerbatimInput{Example.tex} +% \end{english} +% +% \iffalse +% +%<*ex-da> +\documentclass{ucph-revy} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[danish]{babel} +\usepackage{hyperref} +%<*driver> +\land +\def\exDaPre{ +% +\urlstyle{sf} + +\version{1.0} +\revyname{FysikRevy\texttrademark} +\revyyear{2019} +\status{eksempel} +\eta{$1$ minut, $47$ sekunder} +\responsible{Dig} + +\title{Eksempel} +\author{en eksempelsmed} +\melody{Queen: „Bohemian Rhapsody`` (\url{https://youtu.be/fJ9rUzIMcZQ})} +%<*driver> +} +\def\exDaPOne{ +% + +\begin{document} +\maketitle + +\begin{roles} + \role{PH}[Jophiel] Per Hedegaard + \role{I} Vred instruktør + \role{A9}[A--ni] Anine +\end{roles} +\begin{props} + \prop{Hedegaard--hår}[Person, der skaffer] + \prop{Didgeridoo}[Anine] +\end{props} + +\begin{sketch} + \scene{Lys op} + \says{PH} Hej venner. I den her sketch, der spiller jeg Per + Hedegaard. Det kan man se ud fra farven på mit hår. Men bare rolig, + jeg er ikke Per Hedegaard i virkeligheden, der er ikke nogen + regneøvelser, I har glemt at lave. + + Se, hvis jeg tager håret af \act{fjerner parykken}, så er det helt + tydeligt, at jeg ikke er den rigtige Hedegaard. + + \says{I}[Stormer ind på scenen] \emph{NEEEEEJ}, for helvede. Du må + ikke pille ved den fjerde væg. Det er simpelthen så uprofessionelt, + det der! + + \says{PH} Se, venner, det var meningen, at der skulle have været en + anden replik der, men fordi der ikke er sat nogen på den rolle i + rollelisten, så kunne vi ikke høre nogen som helst kritik af min + performance. + + \does{I} reagerer med åbenmundet vantro. + + \says{PH} Det må også være svært at følge skuepil--instruktioner, + når man ikke eksisterer, kan jeg forestille mig. + + \says{A9} Hej Jophiel. + \does{PH} tager sin paryk på igen. + \says{A9} Hej, Per Hedegaard. + \says{A9} Var det ikke meningen, at det her skulle være en sang? + \says{PH} Jo, for dælen. Har du en didgeridoo med? + \says{A9} Didgeridoo? + \says{PH} Ja. Der står i rekvisitlisten, at du skaffer en. + \says{A9} Jamen så må det jo passe. + \says{PH} Ja, ellers skriver vi "`Person, der skaffer,"' for at + minde os om at skrive et navn ind. + \says{A9} Nå, men så må jeg jo hellere begynde at lede. \act{Vender + sig mod Bandet} Bandet, har I...? +%<*driver> +\end{sketch} +\end{document} +} +\def\exDaPTwo{ + \begin{document} + \begin{sketch} +% + \scene{Hvert bandmedlem holder sin egen didgeridoo op.} + \says{A9}[Til PH] Den ser ud til at være i vinkel. + \says{PH} Sejt. + \says{PH}[Råber til Bandet] Og \emph{tre!} \emph{Fire!} +\end{sketch} +%<*driver> +} +\catcode`\^^M=13% +\def\exDaPThree{% +% +\begin{song}% +%<*driver> + % \restorecr doesn't work, if the cr's have already been tokenized, + % so we need to do something else + \let\old@scene=\scene% + \let\old@cr=^^M% + \def\scene{\old@scene\def^^M{ \relax}}% + \let\old@sings\sings% + \def\sings{\let^^M=\old@cr \old@sings}% +% + \scene{Bandet spiller ``Bohemian Rhapsody" af Queen, udelukkende på + didgeridoo.} + + \sings{A9} Åh, Per Hede + Er den lede + Og han dumped' mig i kvant! + + \sings{PH} Per Hedegaard har er reeksamenssæt til dig + \sings{A9} Til mig? + \sings{PH} Til dig! + \scene{Episk didgeridoo--solo, mens A9 løser reeksamenssæt.} + + \scene ... + + \does{A9} rækker hånden i vejret, og bandet stopper. +\end{song}% +%<*driver> +}\catcode`\^^M=5 +\def\exDaPFour{ +% +\begin{sketch} + \says{PH}[Er et stykke tid om at lægge mærke til A9, men kommer til + sidst over] Ja, spørgsmål? + \says{A9} Det her eksamenssæt er jo trivielt...? + \scene{Lys ned} +\end{sketch} + +\end{document} +% +%<*driver> +} +\jump +% +%<*ex-en> +\documentclass{ucph-revy} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{hyperref} +%<*driver> +\land +\def\exEnPre{ +% +\urlstyle{sf} + +\version{1.0} +\revyname{The Meaning of Liff} +\revyyear{3001} +\title{Example} +\author{an examplesmith} +\status{example} +\eta{$1$ minute, $47$ seconds} +\responsible{Probably you} +\melody{Monty Python: ``Always look on the bright side of life'' + (\url{https://youtu.be/SJUhlRoBL8M})} + +\writtenbyname{written by} +\melodyname{Melody:} +\responsibletext{\TeX--responsible} + +%<*driver> +\renewcommand{\pagessum}[1]{##1 page\ifnum##1=1\else s\fi} +} +\iffalse +% +\renewcommand{\pagessum}[1]{#1 page\ifnum#1=1\else s\fi} +%<*driver> +\fi +\def\exEnPOne{ +% + +\begin{document} +\maketitle + +\rolename{Roles:} +\begin{roles} + \role{KA}[Graham] Arthur, king of all the Britons + \role{P}[Michael] Peasant + \role{RC}[John] Roman Centurion + \role{R1...?} Several Roman Soldiers + \role{CC}[Eric] Crucified Criminal + \role{B}[Graham] Brian +\end{roles} +\propname{Props:} +\begin{props} + \prop{Large sign} + \prop{Field of crosses} +\end{props} + +\begin{sketch} + \scene Lights up on a muddy field with a castle in the background. + + \says{KA}[As he enters] Hello! + + \says{KA} Now, by rights, you should all be kneeling, given that I + am Arthur, king of all the Britons. However, it has been brought to + my attention that the audence seating is not laid out to allow for + that. We had some considerable trouble during dress rehearsals. So I + will excuse you from that requirement. + + Now, has anyone seen a particularly fancy cup? Perhaps out + in the bar? You see, I am on a quest given to me by God, to find the + holy... \act{Interrupted, as he steps in a hole.} Oh dear... + + \says{P}[Shrieking, as he rears up from the ground] Oi! What do you + think you're doing! + + \says{P} You broke my sign! + + \says{KA} Sign? What sign? + + \says{P} Well, look. + + \does{P} raises up a sign that reads + + \begin{center}\sc Romanes Eunt Dom[ ]\end{center} + + The last bit of the sign has a foot--shaped hole in it. + + \says{P} You can't read it anymore! + + \says{KA} You certainly can! It says ``Romans go home.'' + + \says{RC}[Appears from offstage] No it doesn't. + + \does{P \& KA} are startled. + +%<*driver> +\end{sketch} +\end{document} +} +\def\exEnPTwo{ + \begin{sketch} +% + \says{RC}[To KA] Did you write th... wait a minute. \act{Off stage} + It's him! \act{Back at KA} How did you get here? + + \does{KA} attempts to sidle away. + + \says{RC} Get him! + + \scene Several Roman soldiers appear, and drag \role{KA} off stage, + while \role{KA} attempts to protest. + + \says{KA}[As he is dragged off] I am not him! I am Arthur, King of + the Britons! + + \scene The scene changes to a field of crosses, with several + crucified criminals and B. + + \does{CC} is in the middle of singing to \role{B}. +\end{sketch} +%<*driver> +} +\catcode`\^^M=13% +\def\exEnPThree{% +% +\begin{song}% +%<*driver> + % \restorecr doesn't work, if the cr's have already been tokenized, + % so we need to do something else + \let\old@scene=\scene% + \let\old@cr=^^M% + \def\scene{\old@scene\def^^M{ \relax}}% + \let\old@sings\sings% + \def\sings{\let^^M=\old@cr \old@sings}% +% + \sings{CC} ...be silly chumps, + Just purse you're lips and whistle, + That's the thing. + + And, always look on the bright side of life, + Always look on the right side of life, + For life is quite absurd, + An. death's the final word... +\end{song} +%<*driver> +}\catcode`\^^M=5 +\def\exEnPFour{ +\begin{document} +% +\begin{sketch} + \says{RC}[Shouting as he walks on stage] Right, you lanky reprobate! + Don't think that the mighty Roman bureaucracy doesn't keep track of + its inmates + + \scene KA is dragged on stage by two Roman soldiers behind RA. + + \says{RA} Look, we have your designated cross ready for you + right... \act{points to B'a cross, then falters when he notices + B.} + + \scene Everyone looks back and forth between B and KA. + + \scene End scene +\end{sketch} +\end{document} +} +% +%\fi +%\begin{danish} +% +%\section{Eksempel på registerindeks}\label{registerindeks} +% \end{danish} +% \begin{english} +% \section{Example of a thumb index page}\label{registerindeks} +% \end{english} +% \iffalse +%<*driver> +\jump +% +%<*registerindex> +% \fi +%\begin{verbatim} + +\documentclass[a4paper,11pt,thumbindex]{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage[danish]{babel} +\usepackage{calc} +\usepackage{tikz} + +\version{1.0} +\title{Registerindeks} + +\begin{document} +\thispagestyle{empty} +\newlength{\torightside} +\setlength{\torightside}{ \paperwidth - 1in - \hoffset % + - \oddsidemargin + .6cm} +\newlength{\totop} +\setlength{\totop}{ -\headsep - \headheight - \topmargin % + - \voffset - 1in - .5cm} + +\vbox to 0pt{\vskip \totop \hbox to \torightside{\hss% + \rectothumbindexwithtitles% + }} +\vbox to 0pt{\tikz \path (0,0) -- (0, -.5\textheight) + node[rotate=90]{\parbox{\textheight}{\maketitle}}; } +\end{document} +%\end{verbatim} +% \iffalse +% +%<*driver> +\land +% +% \fi +\endinput +% Local Variables: +% mode: doctex +% TeX-master: t +% End: diff --git a/macros/latex/contrib/ucph-revy/ucph-revy.ins b/macros/latex/contrib/ucph-revy/ucph-revy.ins new file mode 100644 index 0000000000..4f3ab5ea6c --- /dev/null +++ b/macros/latex/contrib/ucph-revy/ucph-revy.ins @@ -0,0 +1,40 @@ +\input docstrip.tex +\keepsilent +\usedir{tex/latex/ucph-revy} +\askforoverwritefalse +\preamble +This is a generated file. + +Copyright (C) 1995 Arne John Glenstrup + 2000 Uffe Friis Lichtenberg + 2023 Kristoffer Levin Hansen + +This file may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3 of this license or (at your option) any later +version. The latest version of this license is in: + +http://www.latex-project.org/lppl.txt + +and version 1.3 or later is part of all distributions of +LaTeX version 2005/12/01 or later. +\endpreamble +\generate{\file{ucph-revy.cls}{\from{ucph-revy.dtx}{class}}} +\obeyspaces +\Msg{****************************************************} +\Msg{* *} +\Msg{* To finish the installation you have to move the *} +\Msg{* following file into a directory searched by TeX: *} +\Msg{* *} +\Msg{* ucph-revy.cls *} +\Msg{* *} +\Msg{* To produce the documentation run the file *} +\Msg{* ucph-revy-en-doc.ins through LaTeX. *} +\Msg{* To produce the user manual, or documentation in} +\Msg{* danish, run the corresponding .ins file thorugh} +\Msg{* LaTeX. See the README file for the full list.} +\Msg{* *} +\Msg{* Happy TeXing! *} +\Msg{* *} +\Msg{****************************************************} +\endbatchfile -- cgit v1.2.3