diff options
author | Karl Berry <karl@freefriends.org> | 2010-02-06 23:41:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-02-06 23:41:34 +0000 |
commit | c4de2d646327abffb394d44f2b06b2085dd4bfb0 (patch) | |
tree | 30bba6a0d563570ca8b3974c99e72b54fceb2fdb /Master/texmf-dist/source/latex | |
parent | 585255c491e58499ca285c62e610eee9e3a257df (diff) |
new latex package renditions 0.1 (6feb10)
git-svn-id: svn://tug.org/texlive/trunk@16932 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/renditions/renditions.dtx | 214 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/renditions/renditions.ins | 59 |
2 files changed, 273 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/renditions/renditions.dtx b/Master/texmf-dist/source/latex/renditions/renditions.dtx new file mode 100644 index 00000000000..e5ec36393a0 --- /dev/null +++ b/Master/texmf-dist/source/latex/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/Master/texmf-dist/source/latex/renditions/renditions.ins b/Master/texmf-dist/source/latex/renditions/renditions.ins new file mode 100644 index 00000000000..65cdc4b5cd9 --- /dev/null +++ b/Master/texmf-dist/source/latex/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 |