summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/renditions
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/renditions
Initial commit
Diffstat (limited to 'macros/latex/contrib/renditions')
-rw-r--r--macros/latex/contrib/renditions/README22
-rw-r--r--macros/latex/contrib/renditions/renditions.dtx214
-rw-r--r--macros/latex/contrib/renditions/renditions.ins59
-rw-r--r--macros/latex/contrib/renditions/renditions.pdfbin0 -> 60135 bytes
-rw-r--r--macros/latex/contrib/renditions/renditions.sty61
-rw-r--r--macros/latex/contrib/renditions/test_ren.tex27
6 files changed, 383 insertions, 0 deletions
diff --git a/macros/latex/contrib/renditions/README b/macros/latex/contrib/renditions/README
new file mode 100644
index 0000000000..c6830289ab
--- /dev/null
+++ b/macros/latex/contrib/renditions/README
@@ -0,0 +1,22 @@
+The renditions package
+Dated: 02/05/10
+
+Using the renditions package, you can create many versions, or renditions, of content from the same source file.
+
+This is a short package sets up comment environments, called renditions. These renditions can be included or excluded according to the value of the rendition option. The basic options of this package are max and rendition,
+
+ \usepackage[max=4,rendition=3]{renditions}
+
+In the above example, max=4 declares that there are 4 renditions in the document, the option rendition=3 causes the package to include rendition3, and to exclude all the others rendition1, rendition2, and rendition4.
+
+The renditions package is a stand-alone package, but it was designed for use with the AeB Builder utility.
+
+The package requires the comment package.
+
+Now, I simply must get back to my retirement.
+
+Dr. D. P. Story
+www.acrotex.net
+dpstory@uakron.edu
+dpstory@acrotex.net
+02/05/10
diff --git a/macros/latex/contrib/renditions/renditions.dtx b/macros/latex/contrib/renditions/renditions.dtx
new file mode 100644
index 0000000000..e5ec36393a
--- /dev/null
+++ b/macros/latex/contrib/renditions/renditions.dtx
@@ -0,0 +1,214 @@
+%\iffalse
+%<*copyright>
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Renditions.sty package, 2010-1-29 %%
+%% Copyright (C) 1999-2002 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% History: Noel Vaillant began developing a better renditions.sty
+%% based on my earlier published renditions.sty. Many thanks
+%% to him for starting me off.
+%%---------------------------------------------------------
+%</copyright>
+%<package>\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+%<package>\ProvidesPackage{rendition}
+%<package> [2010/01/29 v0.1 rendition: Package for creating multiple renditions from the same source (dps)]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{amsmath}
+\usepackage[colorlinks,hyperindex]{hyperref}
+\usepackage{calc}
+%\pdfstringdefDisableCommands{\let\\\textbackslash}
+%\EnableCrossrefs \CodelineIndex
+\begin{document}
+\def\CMD#1{\textbackslash#1}
+ \GetFileInfo{renditions.sty}
+ \title{The \textsf{rendition} Package\texorpdfstring{\\[1ex]}{: }Creating multiple renditions (versions)\texorpdfstring{\\[1ex]}{}
+ from the same source file}
+ \author{D. P. Story\\
+ Email: \texttt{dpstory@uakron.edu}}
+ \date{processed \today}
+ \maketitle
+ \tableofcontents
+ \let\Email\texttt
+ \DocInput{renditions.dtx}
+ \PrintIndex
+\end{document}
+%</driver>
+% \fi
+% \MakeShortVerb{|}
+% \StopEventually{}
+%
+% \DoNotIndex{\def,\edef,\gdef,\xdef,\global,\long,\let}
+% \DoNotIndex{\expandafter,\string,\the,\ifx,\else,\fi}
+% \DoNotIndex{\csname,\endcsname,\relax,\begingroup,\endgroup}
+% \DoNotIndex{\DeclareTextCommand,\DeclareTextCompositeCommand}
+% \DoNotIndex{\space,\@empty,\special}
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+% \section{The \textsf{renditions} Package}
+% This is a short package sets up comment environments, called \emph{renditions}. These
+% renditions can be included or excluded according to the value of the
+% \texttt{rendition} option. The basic options of this package are \texttt{max} and \texttt{rendition}
+%\begin{verbatim}
+% \usepackage[max=4,rendition=3]{renditions}
+%\end{verbatim}
+% In the above example, \texttt{max=4} declares that there are 4 renditions in the
+% document, the option \texttt{rendition=3} causes the package to include
+% \texttt{rendition3}, and to exclude all the others \texttt{rendition1}, \texttt{rendition2}, and \texttt{rendition4}.
+%
+%The \textsf{renditions} package is a stand-alone package, but it was designed for use with the \textsf{AeB Builder} utility.
+%
+%Below is an example of a document that uses the \textsf{renditions} package.
+%
+%\bigskip\noindent\begin{minipage}[t]{.4\linewidth-5pt}
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage[%
+% max=4,
+% rendition=3
+%]{renditions}
+%\end{verbatim}
+%\verb!%\rendition{2}!
+%\begin{verbatim}
+%\parindent0pt\parskip6pt
+%
+%\begin{document}
+%This is a test file for
+%renditions.
+%
+%\begin{rendition1}
+%Rendition 1
+%\end{rendition1}
+%
+%\begin{rendition2}
+%Rendition 2
+%\end{rendition2}
+%
+%\begin{rendition3}
+%Rendition 3
+%\end{rendition3}
+%
+%\begin{rendition4}
+%Rendition 4
+%\end{rendition4}
+%
+%\end{document}
+%\end{verbatim}
+%\end{minipage}\hfill
+%\begin{minipage}[t]{.6\linewidth-5pt}\parskip\medskipamount
+%There are two options for the \textsf{renditions} package: \texttt{max} and \texttt{rendition}. The value of \texttt{max} sets the maximum number of renditions in the document; the value of the \texttt{rendition} key determines which of the renditions is to be typeset. You can also select the rendition using the \cs{rendition} command, as illustrated to the left. (The \cs{rendition} command in the preamble would override the value of the \texttt{rendition} key.)
+%
+%The various renditions are defined with the \texttt{rendition<n>} environment.
+%These environments are just comment environments created by the \textsf{comments} %package, and they are selectively included or excluded depending on the value of %the rendition defined by either the \texttt{rendition} key or the \cs{rendition} command.
+%
+%The \textsf{rendition} package does modular arithmetic in the case when $\text{rendition} > %\text{max}$. For example, if \texttt{max=4}, and \texttt{rendition=6}, then the rendition %displayed is \texttt{rendition=2}.
+%
+%There is a third way of setting the value of the rendition parameter, and that is %through the \texttt{rendition.cfg} file. If you create a file with the code
+%\begin{verbatim}
+% \ExecuteOptionsX{rendition=3}
+%\end{verbatim}
+%Then \texttt{rendition=3} is used.
+%\end{minipage}
+%
+%\paragraph*{Default values.}The default value of \texttt{max}, if it is not specified is %3, and the default value of \texttt{rendition} if it is not specified is 1.
+%
+% There should not be a \texttt{rendition<n>} environment with a number, \texttt{<n>}, greater than that specified by \texttt{max}; however,
+% if the value of \texttt{rendition} is greater than \texttt{max}, modular arithmetic
+% is performed, and the rendition numbered \texttt{rendition} Mod \texttt{max} is used.
+%
+%\paragraph*{History.} The core of this package was originally developed
+% for my online testing system TAOAS (The {Acro\negthinspace\TeX} Online
+% Assessment System). In that system, the \texttt{rendition.cfg} approach was used
+% to select a rendition to be used.
+%
+%\section{The Main Code}
+% We use xkeyval to create the two options \texttt{max} and \texttt{rendition}.
+% \begin{macrocode}
+\RequirePackage{xkeyval}
+% \end{macrocode}
+% \begin{macro}{max}
+% The maximum number of renditions present in this file. The value of max
+% must be a positive integer, no checking takes place. The default number is
+% 3.
+% \begin{macro}{rendition}
+% The number of the rendition what you want to use for this run of the latex
+% compiler. The default number is 1.
+% \begin{macrocode}
+\DeclareOptionX{max}{\def\ren@numberOf{#1}}
+\def\ren@numberOf{3}
+\DeclareOptionX{rendition}{\def\thisrendition{#1}}
+\def\thisrendition{1}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% Input the configuration file, if it exists. This file normally contains
+% the line of {\LaTeX} code \verb!\ExecuteOptions{rendition=<n>}!
+% \begin{macrocode}
+\InputIfFileExists{rendition.cfg}{}{}
+% \end{macrocode}
+% Process the options.
+% \begin{macrocode}
+\ProcessOptionsX
+% \end{macrocode}
+% The comment package is required.
+% \begin{macrocode}
+\RequirePackage{comment}
+% \end{macrocode}
+% Based on the value of \texttt{max}, we create the requested number
+% of rendition environments: \texttt{rendition1}, \texttt{rendition2},\dots,
+% \texttt{rendition<max>}.
+% \begin{macrocode}
+\let\save@message\message\let\message\@gobble
+\@tempcnta=0
+\@whilenum\@tempcnta<\ren@numberOf\do{%
+ \@tempcntb=\@tempcnta\advance\@tempcntb1
+ \edef\temp@exp{\noexpand\excludecomment{rendition\the\@tempcntb}}%
+ \temp@exp
+ \expandafter\let\csname Afterver\the\@tempcntb Comment\endcsname\relax
+ \advance\@tempcnta1
+}\let\message\save@message
+% \end{macrocode}
+% We include the selected version at the beginning of the document.
+% \begin{macrocode}
+\AtBeginDocument{\includecomment{rendition\thisrendition}}
+% \end{macrocode}
+% \begin{macro}{\rendition}
+% A convenience macro for setting the current renditions. This
+% command defines the command \cs{thisrendition}, which expands
+% to the selected rendition number. If the value of \cs{thisredition}
+% is greater than \texttt{max} (\cs{ren@numberOf}), modular arithmetic
+% is performed, and \cs{thisrendition} is redefined.
+% \begin{macrocode}
+\def\rendition#1{\def\thisrendition{#1}%
+ \ifnum\thisrendition>\ren@numberOf
+ \@tempcnta=\thisrendition
+ \@tempcntb=\@tempcnta
+ \advance\@tempcnta-1 \divide\@tempcnta\ren@numberOf
+ \multiply\@tempcnta\ren@numberOf
+ \advance\@tempcntb-\@tempcnta
+ \edef\thisrendition{\the\@tempcntb}%
+ \typeout{Modular arithmetic applied: ren=\thisrendition}%
+ \fi
+}
+\@onlypreamble{\rendition}
+% \end{macrocode}
+% We execute \cs{rendition} for the selected rendition.
+% \begin{macrocode}
+\expandafter\rendition\expandafter{\thisrendition}
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+% \Finale
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/renditions/renditions.ins b/macros/latex/contrib/renditions/renditions.ins
new file mode 100644
index 0000000000..65cdc4b5cd
--- /dev/null
+++ b/macros/latex/contrib/renditions/renditions.ins
@@ -0,0 +1,59 @@
+%%
+%% This file will generate fast loadable files and documentation
+%% driver files from the doc files in this package when run through
+%% LaTeX or TeX.
+%%
+%% Copyright 2010 D. P. Story
+%%
+%% -------------------------------------------
+%%
+%% It may be distributed under the conditions of the LaTeX Project Public
+%% License, either version 1.2 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.2 or later is part of all distributions of LaTeX
+%% version 1999/12/01 or later.
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+\def\filedate{2010/02/01}
+\def\batchfile{renditions.ins}
+
+\input docstrip
+\ifx\generate\undefined
+ \Msg{**********************************************}
+ \Msg{*}
+ \Msg{* This installation requires docstrip}
+ \Msg{* version 2.4 or later.}
+ \Msg{*}
+ \Msg{* An older version of docstrip has been input}
+ \Msg{*}
+ \Msg{**********************************************}
+ \errhelp{Move or rename old docstrip.tex and get a newer one.}
+ \errmessage{Old docstrip in input path}
+ \batchmode
+ \csname @@end\endcsname\end
+\fi
+
+\keepsilent
+\askforoverwritefalse
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\preamble
+\endpreamble
+
+\generate
+{%
+ \file{renditions.sty}{\from{renditions.dtx}{copyright,package}}
+}
+
+\Msg{***************************************************************}
+\Msg{*}
+\Msg{* \space To finish the installation you have to copy the files }
+\Msg{*}
+\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX}
+\Msg{*}
+\Msg{***************************************************************}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\endinput
diff --git a/macros/latex/contrib/renditions/renditions.pdf b/macros/latex/contrib/renditions/renditions.pdf
new file mode 100644
index 0000000000..b9f2b42349
--- /dev/null
+++ b/macros/latex/contrib/renditions/renditions.pdf
Binary files differ
diff --git a/macros/latex/contrib/renditions/renditions.sty b/macros/latex/contrib/renditions/renditions.sty
new file mode 100644
index 0000000000..43bb79e4a0
--- /dev/null
+++ b/macros/latex/contrib/renditions/renditions.sty
@@ -0,0 +1,61 @@
+%%
+%% This is file `renditions.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% renditions.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Renditions.sty package, 2010-1-29 %%
+%% Copyright (C) 1999-2002 D. P. Story %%
+%% dpstory@uakron.edu %%
+%% %%
+%% This program can redistributed and/or modified under %%
+%% the terms of the LaTeX Project Public License %%
+%% Distributed from CTAN archives in directory %%
+%% macros/latex/base/lppl.txt; either version 1 of the %%
+%% License, or (at your option) any later version. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% History: Noel Vaillant began developing a better renditions.sty
+%% based on my earlier published renditions.sty. Many thanks
+%% to him for starting me off.
+%%---------------------------------------------------------
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{rendition}
+ [2010/01/29 v0.1 rendition: Package for creating multiple renditions from the same source (dps)]
+\RequirePackage{xkeyval}
+\DeclareOptionX{max}{\def\ren@numberOf{#1}}
+\def\ren@numberOf{3}
+\DeclareOptionX{rendition}{\def\thisrendition{#1}}
+\def\thisrendition{1}
+\InputIfFileExists{rendition.cfg}{}{}
+\ProcessOptionsX
+\RequirePackage{comment}
+\let\save@message\message\let\message\@gobble
+\@tempcnta=0
+\@whilenum\@tempcnta<\ren@numberOf\do{%
+ \@tempcntb=\@tempcnta\advance\@tempcntb1
+ \edef\temp@exp{\noexpand\excludecomment{rendition\the\@tempcntb}}%
+ \temp@exp
+ \expandafter\let\csname Afterver\the\@tempcntb Comment\endcsname\relax
+ \advance\@tempcnta1
+}\let\message\save@message
+\AtBeginDocument{\includecomment{rendition\thisrendition}}
+\def\rendition#1{\def\thisrendition{#1}%
+ \ifnum\thisrendition>\ren@numberOf
+ \@tempcnta=\thisrendition
+ \@tempcntb=\@tempcnta
+ \advance\@tempcnta-1 \divide\@tempcnta\ren@numberOf
+ \multiply\@tempcnta\ren@numberOf
+ \advance\@tempcntb-\@tempcnta
+ \edef\thisrendition{\the\@tempcntb}%
+ \typeout{Modular arithmetic applied: ren=\thisrendition}%
+ \fi
+}
+\@onlypreamble{\rendition}
+\expandafter\rendition\expandafter{\thisrendition}
+\endinput
+%%
+%% End of file `renditions.sty'.
diff --git a/macros/latex/contrib/renditions/test_ren.tex b/macros/latex/contrib/renditions/test_ren.tex
new file mode 100644
index 0000000000..169af9e8a3
--- /dev/null
+++ b/macros/latex/contrib/renditions/test_ren.tex
@@ -0,0 +1,27 @@
+\documentclass{article}
+\usepackage[max=4, rendition=2]{renditions}
+
+%\rendition{3}
+
+\parindent0pt\parskip6pt
+
+\begin{document}
+This is a test file for renditions.
+
+\begin{rendition1}
+Rendition 1
+\end{rendition1}
+
+\begin{rendition2}
+Rendition 2
+\end{rendition2}
+
+\begin{rendition3}
+Rendition 3
+\end{rendition3}
+
+\begin{rendition4}
+Rendition 4
+\end{rendition4}
+
+\end{document} \ No newline at end of file