summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/renditions/renditions.sty
blob: 43bb79e4a0cff0ef6f374b3e26e9b690072b0c26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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'.