diff options
Diffstat (limited to 'texmf-dist/tex/latex')
-rw-r--r-- | texmf-dist/tex/latex/lmacs/lmacs.sty | 28 | ||||
-rw-r--r-- | texmf-dist/tex/latex/popupmenu/popupmenu.sty | 83 | ||||
-rw-r--r-- | texmf-dist/tex/latex/rangen/rangen.sty | 1175 | ||||
-rw-r--r-- | texmf-dist/tex/latex/renditions/renditions.sty | 61 | ||||
-rw-r--r-- | texmf-dist/tex/latex/richtext/richtext.sty | 366 | ||||
-rw-r--r-- | texmf-dist/tex/latex/yt4pdf/yt4pdf.cfg | 10 | ||||
-rw-r--r-- | texmf-dist/tex/latex/yt4pdf/yt4pdf.sty | 346 |
7 files changed, 2069 insertions, 0 deletions
diff --git a/texmf-dist/tex/latex/lmacs/lmacs.sty b/texmf-dist/tex/latex/lmacs/lmacs.sty new file mode 100644 index 00000000..0d49bf26 --- /dev/null +++ b/texmf-dist/tex/latex/lmacs/lmacs.sty @@ -0,0 +1,28 @@ +%% +%% This is file `lmacs.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% lmacs.dtx (with options: `package') +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{lmacs} + [2012/05/21 v1.1 Imports local macro files] +\RequirePackage{kvoptions}[2009/07/21] +\let\LM@inputlist\@empty +\newcommand{\LM@input}[2]{\InputIfFileExists{#1.#2}{}% + {\LM@warning{#1}{#2}}} +\newcommand{\LM@warning}[2]{\PackageWarning{lmacs} + {The file #1.#2 cannot be found}} +\define@key{lmacs}{cfg}{\g@addto@macro\LM@inputlist{\LM@input{#1}{cfg}}} +\define@key{lmacs}{!cfg}{} +\define@key{lmacs}{def}{\g@addto@macro\LM@inputlist{\LM@input{#1}{def}}} +\define@key{lmacs}{!def}{} +\define@key{lmacs}{js}{\g@addto@macro\LM@inputlist{\LM@input{#1}{js}}} +\define@key{lmacs}{!js}{} +\ProcessKeyvalOptions{lmacs} +\LM@inputlist +\endinput +%% +%% End of file `lmacs.sty'. diff --git a/texmf-dist/tex/latex/popupmenu/popupmenu.sty b/texmf-dist/tex/latex/popupmenu/popupmenu.sty new file mode 100644 index 00000000..49dbb8d5 --- /dev/null +++ b/texmf-dist/tex/latex/popupmenu/popupmenu.sty @@ -0,0 +1,83 @@ +%%
+%% This is file `popupmenu.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% popupmenu.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% popupmenu.sty package, 2009-10-15 %%
+%% Copyright (C) 2009 D. P. Story %%
+%% dpstory@acrotex.net %%
+%% storyd@nwfsc.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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{popupmenu}
+ [2010/09/18 v1.0 Provides support for popup menus (dps)]
+\RequirePackage{xkeyval}
+\define@key{menustruct}{title}[]{\def\menustruct@title{#1}}
+\define@boolkey{menustruct}{marked}[true]{}
+\define@boolkey{menustruct}{enabled}[true]{}
+\define@key{menustruct}{return}[]{\def\menustruct@return{#1}}
+\let\pum@holdtoks\@empty
+\newcommand{\@AddToMenuToks}{\g@addto@macro\pum@holdtoks}
+\newcount\pum@cnt
+\def\pum@updateindex{\global\advance\pum@cnt\@ne
+ \edef\pum@rc{\pum@topindex[\the\pum@cnt]}\edef\itemindex{'\pum@rc'}}
+\def\pum@initIndexMenu#1{\global\pum@cnt=-1\relax\edef\pum@rc{#1}%
+ \edef\pum@topindex{\pum@rc}}
+\newenvironment{popupmenu}[1]{\pum@initIndexMenu{}%
+ \let\pum@holdtoks\@empty
+ \toks@={\pum@mytab}\@makeother\~
+ \gdef\msarg{#1}\@AddToMenuToks{\@gobble}%
+ \let\item\pum@item
+}{%
+ \expandafter\xdef\csname\msarg\endcsname{%
+ var \msarg\space = [ \pum@holdtoks^^J];}%
+}
+\newcommand{\pum@item}[1]{\pum@updateindex
+ \edef\tmp@exp{\noexpand
+ \setkeys{menustruct}{title,marked=false,enabled,return,#1}}\tmp@exp
+ \edef\tmp@exp{,^^J\the\toks@
+ {cName: "\menustruct@title"%
+ \ifKV@menustruct@marked, bMarked: true\fi%
+ \ifKV@menustruct@enabled\else, bEnabled: false\fi%
+ \ifx\menustruct@return\@empty\else,
+ cReturn: "\menustruct@return"\fi}}%
+ \expandafter\@AddToMenuToks\expandafter{\tmp@exp}%
+}
+\begingroup
+\catcode`<=1 \catcode`\>=2 \@makeother\{ \@makeother\}
+\gdef\pum@lbrace<{>\gdef\pum@rbrace<}>
+\endgroup
+\def\pum@mytab{\space\space\space\space}
+\newenvironment{submenu}[1]{\pum@updateindex
+ \xdef\saved@pum@cnt{\the\pum@cnt}%
+ \pum@initIndexMenu{\pum@rc.oSubMenu}\edef\temp@toks{\the\toks@}%
+ \toks@=\expandafter{\temp@toks\pum@mytab}%
+ \setkeys{menustruct}{title,marked=false,enabled,return,#1}%
+ \edef\tmp@exp{,^^J\the\toks@
+ \noexpand\pum@lbrace cName: "\menustruct@title"%
+ \ifKV@menustruct@marked, bMarked: true\fi%
+ \ifKV@menustruct@enabled\else, bEnabled: false\fi,
+ oSubMenu:^^J\the\toks@[}%
+ \expandafter\@AddToMenuToks\expandafter{\tmp@exp\@gobble}%
+}{%
+ \edef\tmp@exp{^^J\the\toks@ ]\pum@rbrace}%
+ \expandafter\@AddToMenuToks\expandafter{\tmp@exp}%
+ \global\pum@cnt\saved@pum@cnt
+}
+\def\popUpMenu(#1){app.popUpMenuEx.apply( app, #1 )}
+\providecommand{\urlPath}[1]{\def\pum@urlName{#1}%
+ \hyper@normalise\pum@urlPath}
+\def\pum@urlPath#1{\expandafter\xdef\pum@urlName{#1}}
+\endinput
+%%
+%% End of file `popupmenu.sty'.
diff --git a/texmf-dist/tex/latex/rangen/rangen.sty b/texmf-dist/tex/latex/rangen/rangen.sty new file mode 100644 index 00000000..0ab1a585 --- /dev/null +++ b/texmf-dist/tex/latex/rangen/rangen.sty @@ -0,0 +1,1175 @@ +%%
+%% This is file `rangen.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% rangen.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% Rangen.sty package, 2016-02-19 %%
+%% Copyright (C) 1999-2016 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{rangen}
+ [2014/10/17 v1.4 Rangen: Generate Random Questions (dps)]
+\newcount\seedCnt
+\DeclareOption{testmode}{%
+ \InputIfFileExists{\jobname.seed}{}{\def\thisseed{1}}%
+ \PassOptionsToPackage{seed=\thisseed}{lcg}%
+ \AtEndOfPackage{\reseedEachRun}%
+}
+\def\reseedEachRun{%
+ \seedCnt=\thisseed
+ \advance\seedCnt1\relax
+ \newwrite \rngWrite
+ \immediate\openout\rngWrite \jobname.seed
+ \immediate\write\rngWrite{\string\def\string\thisseed{\the\seedCnt}}
+ \immediate\closeout\rngWrite
+}
+\def\RNG@Dec{.}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{lcg}}
+\ProcessOptions
+\RequirePackage{lcg}[2008/09/10]
+\edef\rng@saveSeed{\the\cr@nd}
+\newcount\loopCnt
+\def\maxLoopLimit{10}
+\def\typeCodeForz{0}
+\def\typeCodeForq{1}
+\def\typeCodeForr{2}
+\newcount\rng@cnta
+\newcount\rng@cntb
+\def\@getVarName#1{%
+ \edef\@varName{\expandafter\@gobble\string#1}%
+}
+\def\@getVarType#1{%
+ \@getVarName{#1}\edef\varType{\csname typeof@\@varName\endcsname}}
+\def\gcd#1#2{{% #1 = a, #2 = b
+ \ifnum#2=0 \edef\next{#1}\else
+ \@tempcnta=#1 \@tempcntb=#2 \divide\@tempcnta by\@tempcntb
+ \multiply\@tempcnta by\@tempcntb % q*b
+ \@tempcntb=#1
+ \advance\@tempcntb by-\@tempcnta % remainder in \@tempcntb
+ \ifnum\@tempcntb=0
+ \@tempcnta=#2
+ \ifnum\@tempcnta < 0 \@tempcnta=-\@tempcnta\fi
+ \xdef\gcd@next{\noexpand%
+ \def\noexpand\thegcd{\the\@tempcnta}}%
+ \else
+ \xdef\gcd@next{\noexpand\gcd{#2}{\the\@tempcntb}}%
+ \fi
+ \fi}\gcd@next
+}
+\def\lcm#1#2{% #1 = a, #2 = b
+ \gcd{#1}{#2}%
+ {\@tempcnta=#1
+ \multiply\@tempcnta by#2
+ \divide\@tempcnta by\thegcd
+ \xdef\thelcm{\the\@tempcnta}}%
+}
+\def\amodb#1#2{% #1 = a, #2 = b
+ {\@tempcnta=#1
+ \divide\@tempcnta by#2
+ \multiply\@tempcnta by#2
+ \@tempcntb=#1
+ \advance\@tempcntb by-\@tempcnta
+ \xdef\retnmod{\the\@tempcntb}}%
+}
+\newcommand\reduceFrac[2]
+{%
+ \gcd{#1}{#2}{\@tempcnta=#1 \divide\@tempcnta by\thegcd
+ \@tempcntb=#2 \divide\@tempcntb by\thegcd
+ \ifnum\@tempcntb<0\relax
+ \@tempcntb=-\@tempcntb
+ \@tempcnta=-\@tempcnta
+ \fi
+ \xdef\rfNumer{\the\@tempcnta}\xdef\rfDenom{\the\@tempcntb}}%
+}
+\def\convertRatTo#1#2#3{{%
+ \@tempcnta=#3
+ \multiply\@tempcnta by#1
+ \divide\@tempcnta by#2
+ \xdef\rng@retn@num{\the\@tempcnta}%
+}}
+\newcommand\RNGadd[2]{%
+ \rng@cnta=\nOf#1 \multiply\rng@cnta by\dOf#2
+ \rng@cntb=\nOf#2 \multiply\rng@cntb by\dOf#1
+ \advance\rng@cnta by\the\rng@cntb
+ \rng@cntb=\dOf#1 \multiply\rng@cntb by\dOf#2
+ \reduceFrac{\the\rng@cnta}{\the\rng@cntb}
+}
+\def\rng@isControl#1{\@ifundefined{\expandafter\@gobble\string#1}%
+ {\let\rng@isC@ntrol=0}{\let\rng@isC@ntrol=1}}
+\def\rng@existStar#1{\rng@existSt@r#1**\@nil}
+\def\rng@existSt@r#1*#2*#3\@nil{\def\rng@isStari{#1}%
+ \def\rng@isStarii{#2}\def\rng@isStariii{#3}%
+}
+\def\rng@NameEndpoint#1{%
+ \ifx\rng@isStari\@empty
+ \edef#1{\expandafter\noexpand\rng@isStarii}%
+ \else\ifx\rng@isStarii\@empty
+ \edef#1{\expandafter\noexpand\rng@isStari}%
+ \fi\fi
+}
+\newcommand\defineZ[2]
+{%
+ \@getVarName#1\relax
+ \expandafter\def\csname typeof@\@varName\endcsname{0}%
+ \expandafter\edef\csname n@\@varName\endcsname{#2}%
+ \expandafter\edef\csname d@\@varName\endcsname{1}%
+ \edef\display@TeXfmt{#2}\edef\inline@TeXfmt{#2}%
+ \ifnum#2=1\relax\rng@makeOneFmtDefns
+ \else\ifnum#2=-1\relax\rng@makeMinusOneFmtDefns
+ \else\rng@makeOtherFmtDefns\fi\fi
+ \expandafter\let\csname\@varName*\endcsname\display@TeXfmt
+ \expandafter\let\csname\@varName!\endcsname\inline@TeXfmt
+ \expandafter\edef\csname\@varName\endcsname{#2}%
+}
+\newcommand\defineQ[3]
+{%
+ \@getVarName#1\relax
+ \expandafter\def\csname typeof@\@varName\endcsname{1}%
+ \expandafter\edef\csname n@\@varName\endcsname{#2}%
+ \expandafter\edef\csname d@\@varName\endcsname{#3}%
+ \edef\display@TeXfmt{\frac{#2}{#3}}\edef\inline@TeXfmt{#2/#3}%
+ \ifnum#2=#3\relax\rng@makeOneFmtDefns
+ \else\ifnum#2=-#3\relax\rng@makeMinusOneFmtDefns
+ \else\rng@makeOtherFmtDefns\fi\fi
+ \expandafter\let\csname\@varName*\endcsname\display@TeXfmt
+ \expandafter\let\csname\@varName!\endcsname\inline@TeXfmt
+ \expandafter\edef\csname\@varName\endcsname{#2/#3}%
+ \simplifyCurrentQ
+}
+\newcommand{\defineR}[2]{%
+ \@getVarName{#1}\RNGparseDec{#2}%
+ \expandafter\def\csname typeof@\@varName\endcsname{2}%
+ \reduceFrac{\rng@intpart\rng@fracpart}{\rndPower}%
+ \expandafter\edef\csname n@\@varName\endcsname{\rfNumer}%
+ \expandafter\edef\csname d@\@varName\endcsname{\rfDenom}%
+ \edef\display@TeXfmt{#2}\edef\inline@TeXfmt{#2}%
+ \ifnum\rfNumer=1\relax\rng@makeOneFmtDefns
+ \else\ifnum\rfNumer=-1\relax\rng@makeMinusOneFmtDefns
+ \else\rng@makeOtherFmtDefns\fi\fi
+ \expandafter\let\csname\@varName*\endcsname\display@TeXfmt
+ \expandafter\let\csname\@varName!\endcsname\inline@TeXfmt
+ \expandafter\edef\csname\@varName\endcsname{#2}%
+ \simplifyCurrentR
+}
+\newcommand{\simplifyCurrentR}{%
+ \ifnum\csname d@\@varName\endcsname=1
+ \expandafter\defineZ
+ \csname\@varName\endcsname{\csname n@\@varName\endcsname}\fi
+}
+\def\rng@makeOneFmtDefns{%
+ \expandafter\def\csname\@varName!e\endcsname{}%
+ \expandafter\def\csname\@varName!c\endcsname{}%
+ \expandafter\def\csname\@varName*e\endcsname{}%
+ \expandafter\def\csname\@varName*c\endcsname{}%
+}
+\def\rng@makeMinusOneFmtDefns{%
+ \expandafter\def\csname\@varName!e\endcsname{-1}%
+ \expandafter\def\csname\@varName!c\endcsname{-}%
+ \expandafter\def\csname\@varName*e\endcsname{-1}%
+ \expandafter\def\csname\@varName*c\endcsname{-}%
+}
+\def\rng@makeOtherFmtDefns{%
+ \expandafter\let\csname\@varName!e\endcsname\inline@TeXfmt
+ \expandafter\let\csname\@varName!c\endcsname\inline@TeXfmt
+ \expandafter\let\csname\@varName*e\endcsname\display@TeXfmt
+ \expandafter\let\csname\@varName*c\endcsname\display@TeXfmt
+}
+\def\RNGparseRat#1{\expandafter\@chkslash#1//\@nil}
+\def\@chkslash#1/#2/#3\@nil{%
+ \def\rng@num{#1}\def\rng@denom{#2}%
+ \def\rng@parseQ@iii{#3}%
+ \ifx\rng@denom\@empty\def\rng@denom{1}\fi
+}
+\newcommand{\RNGparseDec}[1]{\edef\parse@argi{#1}%
+ \expandafter\@chkdec\parse@argi..\@nil}
+\def\@chkdec#1.#2.#3\@nil{%
+ \def\rng@intpart{#1}\def\rng@fracpart{#2}%
+ \def\rng@parseR@iii{#3}\rng@getnDec}
+\def\rng@getnDec{%
+ \begingroup
+ \ifx\rng@fracpart\@empty\gdef\rndnDec{0}\gdef\rndPower{1}\else
+ \count0=0\relax\count2=1\relax
+ \expandafter\cntNumDec\rng@fracpart\end\fi
+ \endgroup}
+\def\cntNumDec#1#2\end{%
+ \advance\count0by1
+ \def\rng@arg{#2}%
+ \ifx\rng@arg\@empty
+ \xdef\rndnDec{\the\count0}%
+ \xdef\rndPower{1\@nameuse{rng@tz\the\count0}}%
+ \let\rng@next\relax
+ \else
+ \def\rng@next{\cntNumDec#2\end}%
+ \fi\rng@next
+}
+\newcommand{\nDivisionsPowerOfTen}[1]{%
+ \begingroup
+ \count0=#1\relax
+ \ifnum\count0>4\relax
+ \PackageError{rangen}{Number of subdivisions too large}%
+ {Reduce the argument of \string\nDivisionsPowerOfTen.}%
+ \else
+ \ifnum\count0<1\relax
+ \PackageError{rangen}{Number of subdivisions too large}%
+ {Increase the argument of \string\nDivisionsPowerOfTen.}%
+ \fi\fi
+ \xdef\RNGpowerOfTen{1\@nameuse{rng@tz#1}}%
+ \endgroup
+}
+\nDivisionsPowerOfTen{2}
+\newcommand\RandomZ[4][]
+{%
+ \def\rng@ne@values{}%
+ \setkeys{rangen}{ne,#1}%
+ \let\rng@CtrlLEP=0\let\rng@CtrlUEP=0%
+ \let\rng@makeLEPStrict=0\let\rng@makeUEPStrict=0%
+ \rng@existStar{#3}\rng@NameEndpoint{\rng@LEP}%
+ \if\rng@isStariii*\edef\tmp@exp{%
+ \noexpand\rng@isControl{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlLEP=1\let\rng@makeLEPStrict=1%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \ifcase\varType % integer
+ \rng@cnta=\rng@LEP
+ \or % rational
+ \rng@dima=\expandafter\nOf\rng@LEP pt
+ \divide\rng@dima by\expandafter\dOf\rng@LEP
+ \defineR{\rng@LEP}{\strip@pt\rng@dima}%
+ \RNGparseDec{\rng@LEP}%
+ \rng@cnta=\rng@intpart
+ \or % real
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \RNGparseDec{\rng@LEP}%
+ \rng@cnta=\rng@intpart
+ \fi
+ \advance\rng@cnta by1\relax
+ \defineZ{\rng@LEP}{\the\rng@cnta}%
+ \else
+ \defineZ{\rng@LEP}{\rng@LEP}%
+ \fi
+ \else
+ \rng@isControl{#3}%
+ \if\rng@isC@ntrol1% control sequence
+ \let\rng@CtrlLEP=1%
+ \def\rng@LEP{#3}%
+ \@getVarType{#3}%
+ \ifcase\varType % integer
+ \defineZ{\rng@LEP}{#3}%
+ \or % rational
+ \rng@dima=\nOf{#3}pt
+ \divide\rng@dima by\dOf{#3}%
+ \defineR{\rng@LEP}{\strip@pt\rng@dima}%
+ \RNGparseDec{\rng@LEP}%
+ \defineZ{\rng@LEP}{\rng@intpart}%
+ \or % real
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \RNGparseDec{\rng@LEP}%
+ \defineZ{\rng@LEP}{\rng@intpart}%
+ \fi
+ \else
+ \defineZ{\rng@LEP}{#3}%
+ \fi
+ \fi
+ \rng@existStar{#4}\rng@NameEndpoint{\rng@UEP}%
+ \if\rng@isStariii*\edef\tmp@exp{%
+ \noexpand\rng@isControl{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlUEP=1\let\rng@makeUEPStrict=1%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \ifcase\varType % integer
+ \rng@cnta=\rng@UEP
+ \or % rational
+ \rng@dima=\expandafter\nOf\rng@UEP pt
+ \divide\rng@dima by\expandafter\dOf\rng@UEP
+ \defineR{\rng@UEP}{\strip@pt\rng@dima}%
+ \RNGparseDec{\rng@UEP}%
+ \rng@cnta=\rng@intpart
+ \or % real
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \RNGparseDec{\rng@UEP}%
+ \rng@cnta=\rng@intpart
+ \fi
+ \advance\rng@cnta by-1\relax
+ \defineZ{\rng@UEP}{\the\rng@cnta}%
+ \else
+ \defineZ{\rng@UEP}{\rng@UEP}%
+ \fi
+ \else
+ \rng@isControl{#4}%
+ \if\rng@isC@ntrol1% control sequence
+ \let\rng@CtrlUEP=1%
+ \def\rng@UEP{#4}%
+ \@getVarType{#4}%
+ \ifcase\varType % integer
+ \defineZ{\rng@UEP}{#4}%
+ \or % rational
+ \rng@dima=\nOf{#4}pt
+ \divide\rng@dima by\dOf{#4}%
+ \defineR{\rng@UEP}{\strip@pt\rng@dima}%
+ \RNGparseDec{\rng@UEP}%
+ \defineZ{\rng@UEP}{\rng@intpart}%
+ \or % real
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \RNGparseDec{\rng@UEP}%
+ \defineZ{\rng@UEP}{\rng@intpart}%
+ \fi
+ \else
+ \defineZ{\rng@UEP}{#4}%
+ \fi
+ \fi
+ \def\@currentName{#2}%
+ \@getVarName{#2}%
+ \expandafter\def\csname typeof@\@varName\endcsname{0}%
+ \expandafter\edef\csname first@\@varName\endcsname{\rng@LEP}%
+ \expandafter\edef\csname last@\@varName\endcsname{\rng@UEP}%
+ \rng@chgrand[first=\rng@LEP,last=\rng@UEP]\rand
+ \defineZ{#2}{\arabic{rand}}%
+ \ifx\rangen@ne\@empty\else\loopCnt=0\relax
+ \@whilenum\loopCnt<\maxLoopLimit\do{%
+ \rng@cnta=1\relax
+ \@for\ne@@tmp:=\rangen@ne\do{%
+ \ifnum\value{rand}=\ne@@tmp\relax
+ \multiply\rng@cnta0\relax
+ \else
+ \multiply\rng@cnta1\relax
+ \fi
+ }%
+ \ifnum\rng@cnta=1\relax % all conditions met
+ \loopCnt=\maxLoopLimit
+ \else % if \rng@cnta \ne 1, try again
+ \advance\loopCnt1\relax
+ \ifnum\loopCnt=\maxLoopLimit
+ \PackageWarning{rangen}{Not all conditions met
+ after \maxLoopLimit\space tries}%
+ \else
+ \rng@chgrand[first=\rng@LEP,last=\rng@UEP]\rand
+ \fi
+ \fi
+ }%
+ \fi
+ \defineZ{#2}{\arabic{rand}}%
+}
+\def\updateZ#1#2{%
+ \@getVarName#1\relax
+ \expandafter\edef\csname\@varName\endcsname{#2}%
+ \expandafter\edef\csname n@\@varName\endcsname{#2}%
+ \expandafter\edef\csname d@\@varName\endcsname{1}%
+}
+\newcommand{\RandomQ}[2][]
+{%
+ \setkeys{rangen}{ne,#1}%
+ \def\rq@currentName{#2}%
+ \@RandomQ
+}
+\newcommand{\@RandomQ}[3][]
+{%
+ \let\rng@CtrlLEP=0\let\rng@CtrlUEP=0%
+ \let\rng@makeLEPStrict=0\let\rng@makeUEPStrict=0%
+ \rng@existStar{#2}\rng@NameEndpoint{\rng@LEP}%
+ \if\rng@isStariii*\edef\tmp@exp{\noexpand%
+ \rng@isControl{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlLEP=1\let\rng@makeLEPStrict=1%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \ifcase\varType % integer
+ \defineQ{\rng@LEP}{\rng@LEP}{1}%
+ \or % rational
+ \edef\tmp@exp{\noexpand%
+ \defineQ{\noexpand\rng@LEP}{\expandafter\nOf\rng@LEP}%
+ {\expandafter\dOf\rng@LEP}}\tmp@exp
+ \or % real
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \RNGparseDec{\rng@LEP}%
+ \defineQ{\rng@LEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else
+ \RNGparseRat{\rng@LEP}%
+ \defineQ{\rng@UEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else
+ \rng@isControl{#2}%
+ \if\rng@isC@ntrol1% a control sequence
+ \@getVarType{#2}%
+ \ifcase\varType % integer
+ \defineQ{\rng@LEP}{#2}{1}%
+ \or % rational
+ \defineQ{\rng@LEP}{\nOf{#2}}{\dOf{#2}}%
+ \or % real
+ \defineR{\rng@LEP}{#2}%
+ \RNGparseDec{\rng@LEP}%
+ \defineQ{\rng@LEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else % a number, required to be rational
+ \RNGparseRat{#2}%
+ \defineQ{\rng@LEP}{\rng@num}{\rng@denom}%
+ \fi
+ \fi
+ \rng@existStar{#3}\rng@NameEndpoint{\rng@UEP}%%
+ \if\rng@isStariii*%
+ \edef\tmp@exp{\noexpand%
+ \rng@isControl{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlUEP=1\let\rng@makeUEPStrict=1%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \ifcase\varType % integer
+ \defineQ{\rng@UEP}{\rng@UEP}{1}%
+ \or % rational
+ \edef\tmp@exp{\noexpand%
+ \defineQ{\noexpand\rng@UEP}{\expandafter\nOf\rng@UEP}%
+ {\expandafter\dOf\rng@UEP}}\tmp@exp
+ \or % real
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \RNGparseDec{\rng@UEP}%
+ \defineQ{\rng@UEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else
+ \RNGparseRat{\rng@UEP}%
+ \defineQ{\rng@UEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else
+ \rng@isControl{#3}%
+ \if\rng@isC@ntrol1% a control sequence
+ \@getVarType{#3}%
+ \ifcase\varType % integer
+ \defineQ{\rng@UEP}{#3}{1}%
+ \or % rational
+ \defineQ{\rng@UEP}{\nOf{#3}}{\dOf{#3}}%
+ \or % real
+ \defineR{\rng@UEP}{#3}%
+ \RNGparseDec{\rng@UEP}%
+ \defineQ{\rng@UEP}{\rng@intpart}{\rng@fracpart}%
+ \fi
+ \else % a number, required to be rational
+ \RNGparseRat{#3}%
+ \defineQ{\rng@UEP}{\rng@num}{\rng@denom}%
+ \fi
+ \fi
+ \@@RandomQ{#1}{\nOf{\rng@LEP}}{\dOf{\rng@LEP}}%
+ {\nOf{\rng@UEP}}{\dOf{\rng@UEP}}%
+}
+\newcommand{\@@RandomQ}[5]
+{%
+ \updateQ\@rqi{#2}{#3}\updateQ\@rqii{#4}{#5}%
+ \lcm{#3}{#5}\edef\@thelcm{\thelcm}%
+ \def\@maxDenom{#1}%
+ \ifx\@maxDenom\@empty\edef\@maxDenom{\@thelcm}\else
+ \lcm{\@thelcm}{#1}\edef\@thelcm{\thelcm}\fi
+ \convertRatTo{\nOf\@rqi}{\dOf\@rqi}{\@thelcm}%
+ \updateQ\@@rqi{\rng@retn@num}{\@thelcm}%
+ \convertRatTo{\nOf\@rqii}{\dOf\@rqii}{\@thelcm}%
+ \updateQ\@@rqii{\rng@retn@num}{\@thelcm}%
+ \rng@cnta=\@thelcm \divide\rng@cnta by\@maxDenom
+ \edef\@divisor{\the\rng@cnta}%
+ \rng@cnta=\nOf\@@rqi
+ \divide\rng@cnta by\@divisor
+ \advance\rng@cnta by1
+ \rng@cntb=\nOf\@@rqii\divide\rng@cntb by\@divisor
+ \if\rng@makeLEPStrict1\advance\rng@cnta1\relax\fi
+ \if\rng@makeUEPStrict1\advance\rng@cntb-1\relax\fi
+ \expandafter\@getVarName\rq@currentName
+ \let\save@varName\@varName
+ \expandafter\edef\csname first@n@\@varName\endcsname{\the\rng@cnta}%
+ \expandafter\edef\csname last@n@\@varName\endcsname{\the\rng@cntb}%
+ \expandafter\edef\csname first@d@\@varName\endcsname{\@maxDenom}%
+ \expandafter\edef\csname last@d@\@varName\endcsname{\@maxDenom}%
+ \edef\rng@LEP{\csname first@n@\@varName\endcsname}%
+ \edef\rng@UEP{\csname last@n@\@varName\endcsname}%
+ \rng@chgrand[first=\rng@LEP,last=\rng@UEP]\rand
+ \let\@currentName\rq@currentName
+ \expandafter\@getVarName\rq@currentName
+ \expandafter\defineQ\@currentName{\arabic{rand}}{\@maxDenom}%
+ \simplifyCurrentQ
+ \expandafter\defineQ\@currentName{\expandafter\nOf\@currentName}%
+ {\expandafter\dOf\@currentName}%
+ \ifx\rangen@ne\@empty\else\loopCnt=0\relax
+ \@whilenum\loopCnt<\maxLoopLimit\do{%
+ \rng@cnta=1\relax
+ \@for\ne@@tmp:=\rangen@ne\do{%
+ \let\save@currentName\rq@currentName
+ \RNGparseRat{\ne@@tmp}%
+ \defineQ{\cmp@Name}{\rng@num}{\rng@denom}%
+ \let\@varName\save@varName
+ \syncronizeQs{\@varName}%
+ \ifnum\csname n@\@varName\endcsname=\n@cmp@Name
+ \multiply\rng@cnta0\relax
+ \else
+ \multiply\rng@cnta1\relax
+ \fi
+ }%
+ \ifnum\rng@cnta=1\relax % all conditions met
+ \loopCnt=\maxLoopLimit
+ \else % if \rng@cnta \ne 1, try again
+ \advance\loopCnt1\relax
+ \ifnum\loopCnt=\maxLoopLimit
+ \PackageWarning{rangen}{Not all conditions met
+ after \maxLoopLimit\space tries}%
+ \else
+ \rng@chgrand[first=\rng@LEP,last=\rng@UEP]\rand
+ \expandafter\@getVarName\rq@currentName
+ \expandafter\defineQ\@currentName{\arabic{rand}}%
+ {\@maxDenom}%
+ \fi
+ \fi
+ }%
+ \fi
+ \simplifyCurrentQ
+ \expandafter\defineQ\@currentName{\expandafter\nOf\@currentName}%
+ {\expandafter\dOf\@currentName}%
+ \let\@currentName\rq@currentName
+ \expandafter\@getVarName\rq@currentName
+ \ifnum\csname d@\@varName\endcsname=1\relax\expandafter
+ \defineZ\@currentName{\expandafter\nOf\@currentName}%
+ \fi
+ \simplifyCurrentQ
+}
+\newcommand\updateQ[3]
+{%
+ \@getVarName#1\relax
+ \expandafter\edef\csname\@varName\endcsname{#2/#3}%
+ \expandafter\edef\csname n@\@varName\endcsname{#2}%
+ \expandafter\edef\csname d@\@varName\endcsname{#3}%
+}
+\def\simplifyCurrentQ
+{%
+ \reduceFrac{\csname n@\@varName\endcsname}%
+ {\csname d@\@varName\endcsname}%
+ \expandafter\edef\csname n@\@varName\endcsname{\rfNumer}%
+ \expandafter\edef\csname d@\@varName\endcsname{\rfDenom}%
+ \ifnum\csname n@\@varName\endcsname=0
+ \expandafter\edef\csname\@varName\endcsname{0}%
+ \edef\display@TeXfmt{0}\edef\inline@TeXfmt{0}%
+ \else
+ \ifnum\csname n@\@varName\endcsname=\csname d@\@varName\endcsname
+ \expandafter\defineZ\csname\@varName\endcsname{1}%
+ \else
+ \ifnum\csname n@\@varName\endcsname
+ =-\csname d@\@varName\endcsname
+ \expandafter\defineZ\csname\@varName\endcsname{-1}%
+ \else
+ \ifnum\csname d@\@varName\endcsname=1
+ \expandafter\defineZ\csname\@varName\endcsname
+ {\csname n@\@varName\endcsname}%
+ \else
+ \expandafter\edef\csname \@varName\endcsname{%
+ \csname n@\@varName\endcsname/%
+ \csname d@\@varName\endcsname}%
+ \edef\display@TeXfmt{%
+ \frac{\csname n@\@varName\endcsname}
+ {\csname d@\@varName\endcsname}}%
+ \edef\inline@TeXfmt{%
+ \csname n@\@varName\endcsname/%
+ \csname d@\@varName\endcsname}%
+ \expandafter\let
+ \csname\@varName*\endcsname\display@TeXfmt
+ \fi
+ \fi
+ \fi
+ \fi
+}
+\newcommand\nOf[1]{\csname n@\expandafter\@gobble\string#1\endcsname}
+\newcommand\dOf[1]{\csname d@\expandafter\@gobble\string#1\endcsname}
+\newcommand{\iOf}[1]{\csname i@\expandafter\@gobble\string#1\endcsname}
+\newcommand\typeOf[1]{%
+ \csname typeof@\expandafter\@gobble\string#1\endcsname}
+\newif\iftrailingzeros\trailingzerosfalse
+\@namedef{rng@tz1}{0}
+\@namedef{rng@tz2}{00}
+\@namedef{rng@tz3}{000}
+\@namedef{rng@tz4}{0000}
+\@namedef{rng@tz5}{00000}
+\@namedef{rng@tz6}{000000}
+\@namedef{rng@tz7}{0000000}
+\@namedef{rng@tz8}{00000000}
+\def\rng@true{true}\def\rng@false{false}
+\newdimen\rng@dima
+\newdimen\rng@dimb
+\newdimen\rng@dimc
+\define@key{rangen}{ne}[]{\edef\rangen@ne{#1}}
+\define@key{rangen}{round}[]{\def\rangen@round{#1}}
+\define@key{rangen}{showzeros}[]{\def\rangen@showzeros{#1}%
+ \ifx\rangen@showzeros\@empty\global\trailingzerostrue\else
+ \ifx\rangen@showzeros\rng@true\global\trailingzerostrue\else
+ \global\trailingzerosfalse\fi\fi}
+\define@key{rangen}{index}[]{\edef\rangen@index{#1}}
+\newcommand{\RandomR}[4][]{%
+ \setkeys{rangen}{ne,round,showzeros=false,#1}%
+ \let\rng@CtrlLEP=0\let\rng@CtrlUEP=0%
+ \let\rng@makeLEPStrict=0\let\rng@makeUEPStrict=0%
+ \def\rng@lcg@first{0}\edef\rng@lcg@last{\RNGpowerOfTen}%
+ \rng@existStar{#3}\rng@NameEndpoint{\rng@LEP}%
+ \if\rng@isStariii*\edef\tmp@exp{\noexpand%
+ \rng@isControl{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlLEP=1\let\rng@makeLEPStrict=1%
+ \def\rng@lcg@first{1}%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@LEP}}\tmp@exp
+ \ifcase\varType % integer
+ \defineR{\rng@LEP}{\rng@LEP\RNG@Dec}%
+ \or % rational
+ \rng@dima=\expandafter\nOf\rng@LEP pt
+ \divide\rng@dima by\expandafter\dOf\rng@LEP
+ \defineR{\rng@LEP}{\strip@pt\rng@dima}%
+ \or % real
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \fi
+ \else
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \fi
+ \else
+ \rng@isControl{#3}%
+ \if\rng@isC@ntrol1% control sequence
+ \let\rng@CtrlLEP=1\def\rng@LEP{#3}%
+ \@getVarType{#3}%
+ \ifcase\varType % integer
+ \defineR{\rng@LEP}{\rng@LEP\RNG@Dec}%
+ \or % rational
+ \rng@dima=\nOf{#3}pt
+ \divide\rng@dima by\dOf{#3}%
+ \defineR{\rng@LEP}{\strip@pt\rng@dima}%
+ \or % real
+ \defineR{\rng@LEP}{\rng@LEP}%
+ \fi
+ \else
+ \defineR{\rng@LEP}{#3}%
+ \fi
+ \fi
+ \rng@existStar{#4}\rng@NameEndpoint{\rng@UEP}%
+ \if\rng@isStariii*\edef\tmp@exp{\noexpand%
+ \rng@isControl{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \if\rng@isC@ntrol1% a control sequence
+ \let\rng@CtrlUEP=1\let\rng@makeUEPStrict=1%
+ \rng@cnta=\rng@lcg@last\advance\rng@cnta-1\relax
+ \edef\rng@lcg@last{\the\rng@cnta}%
+ \edef\tmp@exp{\noexpand%
+ \@getVarType{\expandafter\noexpand\rng@UEP}}\tmp@exp
+ \ifcase\varType % integer
+ \defineR{\rng@UEP}{\rng@UEP\RNG@Dec}%
+ \or % rational
+ \rng@dima=\expandafter\nOf\rng@UEP pt
+ \divide\rng@dima by\expandafter\dOf\rng@UEP
+ \defineR{\rng@UEP}{\strip@pt\rng@dima}%
+ \or % real
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \fi
+ \else
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \fi
+ \else
+ \rng@isControl{#4}%
+ \if\rng@isC@ntrol1% control sequence
+ \let\rng@CtrlUEP=1\def\rng@UEP{#4}%
+ \@getVarType{#4}%
+ \ifcase\varType % integer
+ \defineR{\rng@UEP}{\rng@UEP\RNG@Dec}%
+ \or % rational
+ \rng@dima=\nOf{#4}pt
+ \divide\rng@dima by\dOf{#4}%
+ \defineR{\rng@UEP}{\strip@pt\rng@dima}%
+ \or % real
+ \defineR{\rng@UEP}{\rng@UEP}%
+ \fi
+ \else
+ \defineR{\rng@UEP}{#4}%
+ \fi
+ \fi
+ \def\@currentName{#2}\@getVarName{#2}%
+ \expandafter\edef\csname first@\@varName\endcsname{\rng@LEP}%
+ \expandafter\edef\csname last@\@varName\endcsname{\rng@UEP}%
+ \rng@getRandomR
+ \defineR{#2}{\strip@pt\rng@dima}%
+ \ifx\rangen@round\@empty\else
+ \RNGround{#2}{#2}{\rangen@round}%
+ \rng@dima=#2pt\relax
+ \defineR{#2}{\strip@pt\rng@dima}%
+ \fi
+ \ifx\rangen@ne\@empty\else\loopCnt=0\relax
+ \@whilenum\loopCnt<\maxLoopLimit\do{%
+ \rng@cnta=1\relax
+ \@for\ne@@tmp:=\rangen@ne\do{%
+ \rng@dima=#2pt
+ \ifdim\rng@dima=\ne@@tmp pt\relax
+ \multiply\rng@cnta0\relax\else
+ \multiply\rng@cnta1\relax\fi
+ }%
+ \ifnum\rng@cnta=1\relax % all conditions met
+ \loopCnt=\maxLoopLimit
+ \else % if \rng@cnta \ne 1, try again
+ \advance\loopCnt1\relax
+ \ifnum\loopCnt=\maxLoopLimit
+ \PackageWarning{rangen}{Not all conditions met
+ after \maxLoopLimit\space tries}%
+ \else
+ \rng@getRandomR
+ \defineR{#2}{\strip@pt\rng@dima}%
+ \ifx\rangen@round\@empty\else
+ \RNGround{#2}{#2}{\rangen@round}%
+ \rng@dima=#2pt\relax
+ \defineR{#2}{\strip@pt\rng@dima}%
+ \fi
+ \fi
+ \fi
+ }%
+ \fi
+ \rnd@ProcessRealFormat{#2}%
+ \def\@currentName{#2}%
+ \defineR{#2}{#2}%
+}
+\def\rng@getRandomR{%
+ \rng@dima=\rng@LEP pt
+ \rng@dimb=\rng@UEP pt
+ \advance\rng@dimb-\rng@dima
+ \rng@chgrand[first=\rng@lcg@first,last=\rng@lcg@last]\rand
+ \divide\rng@dimb by\RNGpowerOfTen\relax
+ \rng@dimb=\arabic{rand}\rng@dimb
+ \advance\rng@dima by\rng@dimb
+}
+\def\rnd@ProcessRealFormat#1{%
+ \ifx\rangen@round\@empty
+ \rng@dima=#1pt\relax
+ \defineR{#1}{\strip@pt\rng@dima}%
+ \else
+ \RNGround{#1}{#1}{\rangen@round}%
+ \rng@dima=#1pt\relax
+ \defineR{#1}{\strip@pt\rng@dima}%
+ \iftrailingzeros
+ {\RNGparseDec{#1}\count0=\decPls\relax
+ \advance\count0-\rndnDec\relax
+ \ifnum\count0>0\relax\xdef#1{%
+ \rng@intpart\RNG@Dec\rng@fracpart%
+\@nameuse{rng@tz\the\count0}}%
+ \fi}%
+ \defineR{#1}{#1}%
+ \fi
+ \fi
+}
+\newcommand{\RandomS}[2][1/2]{%
+ \RNGparseRat{#1}%
+ \ifnum\rng@num<0\relax
+ \PackageError{rangen}{A positive numerator is required}%
+ {The rational number must be between 0 and 1}\fi
+ \ifnum\rng@denom<0\relax
+ \PackageError{rangen}{A positive denominator is required}%
+ {The rational number must be between 0 and 1}\fi
+ \ifnum\rng@num>\rng@denom\relax
+ \PackageError{rangen}{The rational must be between 0 and 1}%
+ {The rational number must be between 0 and 1}\fi
+ \rng@chgrand[first=1,last=\rng@denom]\rand
+ \@getVarName{#2}%
+ \ifnum\value{rand}>\rng@num\relax\def#2{-}%
+ \rng@makeMinusOneFmtDefns
+ \def\display@TeXfmt{-}\def\inline@TeXfmt{-}%
+ \else\def#2{+}\rng@makeOneFmtDefns
+ \def\display@TeXfmt{}\def\inline@TeXfmt{}\fi
+ \expandafter\let\csname\@varName*\endcsname\display@TeXfmt
+ \expandafter\let\csname\@varName!\endcsname\inline@TeXfmt
+}
+\newcommand{\RandomL}[3][]{%
+ \let\rangen@index\@empty
+ \setkeys{rangen}{#1}%
+ \rng@cnta=0\relax\@for\@@tmp:=#3\do{%
+ \advance\rng@cnta1\relax}\edef\n@rng@listItems{\the\rng@cnta}%
+ \ifx\rangen@index\@empty
+ \rng@chgrand[first=1,last=\n@rng@listItems]\rand
+ \else
+ \rng@cnta=\rangen@index
+ \advance\rng@cnta-1\relax
+ \amodb{\rng@cnta}{\n@rng@listItems}%
+ \rng@cnta=\retnmod
+ \advance\rng@cnta1\relax
+ \value{rand}=\rng@cnta
+ \fi
+ \@getVarName{#2}%
+ \expandafter\edef\csname i@\@varName\endcsname{\arabic{rand}}%
+ \rng@cnta=0\relax\@for\@@tmp:=#3\do{%
+ \advance\rng@cnta1\relax\ifnum\rng@cnta=\arabic{rand}%
+ \edef\rng@choice{\@@tmp}\fi}%
+ \def\@currentName{#2}%
+ \RNGparseDec{\rng@choice}%
+ \if\rng@parseR@iii\RNG@Dec\defineR{#2}{\rng@choice}%
+ \else\RNGparseRat{\rng@choice}%
+ \if\rng@parseQ@iii/\defineQ{#2}{\rng@num}{\rng@denom}%
+ \else\defineZ{#2}{\rng@choice}\fi\fi
+}
+
+\newcommand{\RandomP}[3][]{%
+ \let\rangen@index\@empty
+ \setkeys{rangen}{#1}%
+ \rng@cnta=0\relax\@for\@@tmp:=#3\do{%
+ \advance\rng@cnta1\relax}\edef\n@rng@listItems{\the\rng@cnta}%
+ \ifx\rangen@index\@empty
+ \rng@chgrand[first=1,last=\n@rng@listItems]\rand
+ \else
+ \rng@cnta=\rangen@index
+ \advance\rng@cnta-1\relax
+ \amodb{\rng@cnta}{\n@rng@listItems}%
+ \rng@cnta=\retnmod
+ \advance\rng@cnta1\relax
+ \value{rand}=\rng@cnta
+ \fi
+ \@getVarName{#2}%
+ \expandafter\edef\csname i@\@varName\endcsname{\arabic{rand}}%
+ \rng@cnta=0\relax\@for\@@tmp:=#3\do{%
+ \advance\rng@cnta1\relax\ifnum\rng@cnta=\arabic{rand}%
+ \rng@toks=\expandafter{\@@tmp}\edef#2{\the\rng@toks}%
+ \expandafter\def\csname typeof@\@varName\endcsname{3}\fi}%
+}
+\newcommand{\RandomI}[2]{%
+ \rng@chgrand[first=1,last=#2]\rand
+ \defineZ{#1}{\arabic{rand}}%
+ \expandafter\edef\csname i@\@varName\endcsname{\arabic{rand}}%
+}
+\defineZ{\zZero}{0}
+\defineZ{\zOne}{1}
+\defineZ{\zMinusOne}{-1}
+\defineR{\rPI}{3.1415927}
+\defineR{\rE}{2.7182818}
+\def\syncronizeQs#1{\edef\sync@arg{#1}%
+ \lcm{\csname d@\sync@arg\endcsname}{\d@cmp@Name}%
+ \edef\@thelcm{\thelcm}%
+ \convertRatTo{\n@cmp@Name}{\d@cmp@Name}{\@thelcm}%
+ \updateQ\cmp@Name{\rng@retn@num}{\@thelcm}%
+ \convertRatTo{\csname n@\sync@arg\endcsname}%
+ {\csname d@\sync@arg\endcsname}{\@thelcm}\expandafter
+ \defineQ\csname\sync@arg\endcsname{\rng@retn@num}{\@thelcm}%
+}
+\newcommand\ds[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1*\endcsname
+}
+\newcommand\eds[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1*e\endcsname
+}
+\newcommand\cds[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1*c\endcsname
+}
+\newcommand\fmt[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1!\endcsname
+}
+\newcommand\efmt[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1!e\endcsname
+}
+\newcommand\cfmt[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1!c\endcsname
+}
+\newcommand\js[1]{%
+ \expandafter\csname\expandafter\@gobble\string#1!*\endcsname
+}
+
+\def\RNGround#1#2#3{%
+ \begingroup
+ \def\rng@ctrlName{#1}%
+ \def\rng@sourceName{#2}%
+ \def\rng@nDecPl{#3}%
+ \RNGparseDec{#2}%
+ \ifnum\rndnDec<#3\relax
+ \xdef\theseDigits{\rng@fracpart}%
+ \let\rng@next\relax
+ \else
+ \count0=0\relax
+ \gdef\theseDigits{}%
+ \def\rng@next{\expandafter\@rng@round\rng@fracpart\end}%
+ \fi
+ \rng@next
+ \xdef\decPls{\@ifundefined{save@rng@nDecPl}%
+ {\rng@nDecPl}{\save@rng@nDecPl}}%
+ \ifx\theseDigits\@empty
+ \xdef#1{\rng@intpart}\else
+ \xdef#1{\rng@intpart\RNG@Dec\theseDigits}\fi
+ \endgroup
+}
+\def\@rng@round#1{%
+ \ifx#1\end\let\rng@next\relax
+ \else
+ \ifnum\rng@nDecPl=0\relax
+ \ifnum#1>4\relax
+ \count0=\rng@intpart\relax
+ \ifnum\rng@intpart<0\relax
+ \advance\count0by-1\relax
+ \else
+ \advance\count0by1\relax
+ \fi
+ \xdef\rng@intpart{\the\count0}%
+ \fi
+ \gdef\theseDigits{}%
+ \let\rng@next\rng@gobbletoend
+ \else
+ \advance\count0by1\relax
+ \ifnum\count0=\rng@nDecPl\relax
+ \def\rng@next{\@@rng@round#1}%
+ \else
+ \xdef\theseDigits{\theseDigits#1}%
+ \let\rng@next\@rng@round
+ \fi
+ \fi
+ \fi
+ \rng@next
+}
+\def\rng@gobbletoend#1\end{}
+\def\@@rng@round#1#2{%
+ \ifx#2\end%
+ \xdef\theseDigits{\theseDigits#1}%
+ \let\rng@next\relax
+ \else
+ \ifnum#2>4\relax\count2=#1\relax
+ \ifnum\count2=9\relax
+ \count0=\rng@nDecPl\relax
+ \ifnum\count0=1\relax
+ \count0=\rng@intpart\relax
+ \ifnum\rng@intpart<0\relax
+ \advance\count0by-1\relax
+ \else
+ \advance\count0by1\relax
+ \fi
+ \xdef\rng@intpart{\the\count0}%
+ \let\rng@next\rng@gobbletoend
+ \else
+ \advance\count0by-1\relax\expandafter
+ \xdef\rng@sourceName{%
+ \rng@intpart\RNG@Dec\theseDigits#1}%
+ \edef\save@rng@nDecPl{\rng@nDecPl}%
+ \edef\rng@next{\noexpand\RNGround{%
+ \expandafter\noexpand\rng@ctrlName}%
+ {\expandafter\noexpand\rng@sourceName}%
+ {\the\count0}\noexpand\rng@gobbletoend}%
+ \fi
+ \else
+ \advance\count2by1\relax
+ \xdef\theseDigits{\theseDigits\the\count2}%
+ \let\rng@next\rng@gobbletoend
+ \fi
+ \else % \ifnum#2<=4
+ \xdef\theseDigits{\theseDigits#1}%
+ \let\rng@next\rng@gobbletoend
+ \fi
+ \fi
+ \rng@next
+}
+\def\RNGprintf#1{("#1",\@gobble}
+\newcommand\defineDepQJS[4]{%
+ \@getVarName#1
+ \expandafter\edef\csname\@varName\endcsname{(#2)/(#3)}%
+ \expandafter\edef\csname n@\@varName\endcsname{(#2)}%
+ \expandafter\edef\csname d@\@varName\endcsname{(#3)}%
+ \edef\display@TeXfmt{\csname\@varName\endcsname}%
+ \edef\inline@TeXfmt{\csname\@varName\endcsname}%
+ \def\dv@argiv{#4}\ifx\dv@argiv\@empty
+ \edef\eval@JSfmt{\csname\@varName\endcsname}\else
+ \edef\eval@JSfmt{#4}\fi
+ \expandafter\let\csname\@varName!*\endcsname\eval@JSfmt
+}
+\def\rng@writeCurrentSeed#1{\immediate\write#1{\string\makeatletter
+ \string\global\string\cr@nd=\the\cr@nd\string\relax
+ \string\makeatother}}
+\newtoks\rng@toks
+\def\wrv@ex@solns{exercises}%
+\def\wrv@ex@quiz{quizzes}%
+\newenvironment{writeRVsTo}[2][]
+{%
+ \def\wrv@argii{#2}%
+ \ifx\wrv@argii\wrv@ex@quiz\let\wrv@out\quiz@solns
+ \else\ifx\wrv@argii\wrv@ex@solns\let\wrv@out\ex@solns\else
+ \let\wrv@out#2\fi\fi
+ \rng@writeCurrentSeed\wrv@out
+ \rng@toks={}%
+ \def\verbatim@processline{%
+ \xdef\rng@temp{\the\rng@toks\the\verbatim@line}%
+ \global\rng@toks=\expandafter{\rng@temp}}%
+ \let\do\@makeother\dospecials\catcode`\^^M\active
+ #1%
+ \verbatim@start
+}{ \immediate\write\wrv@out{\the\rng@toks}%
+ \newwrite\rng@writeRVs
+ \immediate\openout\rng@writeRVs\jobname_rvs.cut
+ \immediate\write\rng@writeRVs{\the\rng@toks}%
+ \immediate\closeout\rng@writeRVs
+ \aftergroup\rng@Input@RVs
+}
+\def\rng@Input@RVs{\InputIfFileExists{\jobname_rvs.cut}{}{}}
+\def\rng@p@stkeysr@nd{%
+ \@rderr@nd% last < first -> swap
+ \cutr@nger@nd% range too big -> cut
+} % end of \def\p@stkeysr@nd
+\def\rng@chgrand{\@ifnextchar[\rng@chgr@nd{\rng@chgr@nd[]}}
+\def\rng@chgr@nd[#1]{%
+ \@tempcnta=\z@
+ \@tempcntb=\z@
+ \setkeys{Init}{#1}%
+ \rng@p@stkeysr@nd%
+ \@utputr@nd%
+} % end of \def\rng@chgrand
+\begin{insDLJS}[partialExpand]{partial}{Rangen}
+var partre = /rEval|rFrac/;
+function rngCorrAnsButton()
+{
+ var theprecision,fieldname,theanswer;
+ if (arguments.length==4) {
+ var theformat=arguments[0];
+ var fieldname=arguments[1];
+ var theanswer=arguments[2];
+ var thequiz=arguments[3];
+ } else {
+ var fieldname=arguments[0];
+ var theanswer=arguments[1];
+ var thequiz=arguments[2];
+ }
+ theanswer = partialExpand(0,theanswer);
+ if (arguments.length==4)
+ theanswer=util.printf(theformat,eval(theanswer));
+ DisplayAnswer(fieldname,theanswer,thequiz);
+}
+function partialExpand(level,Ans)
+{
+ Ans = correctPlusMinus(Ans)
+ level += 1;
+\db console.println("Enter level = " + level +": Ans: " + Ans);\db%
+ var n=0, m, bP, eP, subExp;
+ while ( true ) {
+\db console.println("Searching a level " + level);\db%
+ try { m = Ans.match(partre); }
+ catch (e) { break; }
+ if ( m != null ) {
+ bP = m.index + m[0].length;
+ eP = FindBalP(Ans, bP, true);
+\db console.println("bP = " + bP + " : eP = " + eP);\db%
+ var subExp = Ans.substring(bP+1, eP);
+\db console.println("Found \'" + subExp%
+ + "\' at level = " + level);\db%
+ // n = beginning of "rEval",
+ // eP = beginning of balanced parens,
+ // bP = end of balanced parens
+ Ans = Ans.substring(0, m.index)
+ + eval(m[0]+"(level,subExp)") + Ans.substring(eP+1);
+\db console.println("level = " + level%
+ +": New Ans: " + Ans);\db %
+ } else {
+ if ( level == 1 ) {
+\db console.println("Level 1 break");\db %
+ break;
+ }
+ }
+ }
+\db console.println("Return Ans: " + Ans);\db%
+ Ans = correctPlusMinus(Ans);
+ return Ans;
+}
+function rEval(level, Ans)
+{
+ level += 1;
+\db console.println("Enter rEval: level = "%
+ + level +": Ans: " + Ans);\db%
+ var n=0, m, bP, eP, subExp;
+ while ( true )
+ {
+\db console.println("Searching a level " + level);\db%
+ try { m = Ans.match(partre); }
+ catch (e) { break; }
+ if ( m != null ) {
+ bP = m.index + m[0].length;
+ eP = FindBalP(Ans, bP, true);
+\db console.println("bP = " + bP + " : eP = " + eP);\db%
+ var subExp = Ans.substring(bP+1, eP);
+\db console.println("Found \'" + subExp%
+ + "\' at level = " + level);\db%
+ // n = beginning of "rEval",
+ // eP = beginning of balanced parens,
+ // bP = end of balanced parens
+ Ans = Ans.substring(0, m.index)
+ +eval(m[0]+"(level,subExp)")+Ans.substring(eP+1);
+\db console.println("level = "%
+ + level +": New Ans: " + Ans);\db %
+ } else {
+ Ans = ParseInput(Ans);
+\db console.println("Ready to eval at level = "%
+ + level + ": Ans = " + Ans);\db%
+ with(Math) { Ans = eval( Ans ) };
+\db console.println("After eval at level = "%
+ + level + ": Ans = " + Ans);\db%
+ break;
+ }
+ }
+\db console.println("Return Ans: " + Ans);\db%
+ return Ans;
+}
+function rFrac(level, Ans)
+{
+ level += 1;
+\db console.println("Enter rFrac level = "%
+ + level +": Ans: " + Ans);\db%
+ var n=0, m, bP, eP, subExp;
+ while ( true ) {
+\db console.println("Searching a level " + level);\db%
+ try { m = Ans.match(partre); }
+ catch (e) { break; }
+ if ( m != null ) {
+ bP = m.index + m[0].length;
+ eP = FindBalP(Ans, bP, true);
+\db console.println("bP = "%
+ + bP + " : eP = " + eP);\db%
+ var subExp = Ans.substring(bP+1, eP);
+\db console.println("Found \'" + subExp%
+ + "\' at level = " + level);\db%
+ // n = beginning of "rEval",
+ // eP = beginning of balanced parens,
+ // bP = end of balanced parens
+ Ans = Ans.substring(0, m.index)
+ + eval(m[0]+"(level,subExp)") + Ans.substring(eP+1);
+\db console.println("level = " + level%
+ +": New Ans: " + Ans);\db %
+ } else {
+ var numDenom = Ans.split("/");
+ numDenom[0] = eval(numDenom[0]);
+ numDenom[1] = eval(numDenom[1]);
+ var g = gcd(numDenom[0], numDenom[1]);
+ numDenom[0] /= g;
+ numDenom[1] /= g;
+ if ( numDenom[1] == 1)
+ Ans = numDenom[0];
+ else
+ Ans = numDenom.join("/");
+\db console.println("Reduce: " + numDenom.join("/"));\db%
+ break;
+ }
+ }
+\db console.println("Return Ans: " + Ans);\db%
+ return Ans;
+}
+function correctPlusMinus(Ans)
+{
+ Ans = "" + Ans;
+ Ans = Ans.replace(/\s*([\+-])\s*\1\s*/g, " + ");
+ Ans = Ans.replace(/\s*\+\s*-\s*/g, " - ");
+ Ans = Ans.replace(/\s*-\s*\+\s*/g, " - ");
+ return Ans;
+}
+function gcd(a,b)
+{
+ var x = a, y = b, r;
+ while (true)
+ {
+ r = x \% y;
+ if ( r == 0 ) break;
+ x = y;
+ y = r;
+ }
+ return Math.abs(y);
+}
+function lcm (a,b) { return (a*b)/gcd(a,b); }
+\end{insDLJS}
+\endinput
+%%
+%% End of file `rangen.sty'.
diff --git a/texmf-dist/tex/latex/renditions/renditions.sty b/texmf-dist/tex/latex/renditions/renditions.sty new file mode 100644 index 00000000..12522f13 --- /dev/null +++ b/texmf-dist/tex/latex/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/texmf-dist/tex/latex/richtext/richtext.sty b/texmf-dist/tex/latex/richtext/richtext.sty new file mode 100644 index 00000000..3541612b --- /dev/null +++ b/texmf-dist/tex/latex/richtext/richtext.sty @@ -0,0 +1,366 @@ +%%
+%% This is file `richtext.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% richtext.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% richtext package, %%
+%% Copyright (C) 2016 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{richtext}
+ [2016/10/03 v1.0c richtext: create rich text strings (dps)]
+\RequirePackage{xkeyval}
+\RequirePackage{ifxetex}[2006/08/21]
+\newif\ifrt@formfield \rt@formfieldtrue
+\newif\ifrt@needsbody\rt@needsbodyfalse
+\@ifpackageloaded{eforms}%
+ {\ifxetex\let\@eqV\@eqnuV\fi}{\rt@needsbodytrue}
+\providecommand\eq@RV@Body{<?xml version="1.0"?><body %
+ xfa:APIVersion="Acroform:2.7.0.0" %
+ xfa:contentType="text/html" %
+ xfa:spec="2.1" xmlns="http://www.w3.org/1999/xhtml" %
+ xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">}
+\providecommand\eq@RV@endBody{</body>}
+\def\rt@bBody{\ifrt@needsbody\eq@RV@Body\fi}
+\def\rt@eBody{\ifrt@needsbody\eq@RV@endBody\fi}
+\newif\ifrtfontstyle\rtfontstylefalse
+\define@key{rtFont}{font}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@font\@empty\else\rtfontstyletrue
+ \def\rf@font{font-family:#1}\fi}
+\define@key{rtFont}{size}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@size\@empty\else\rtfontstyletrue\def\rf@size@num{#1}%
+ \def\rf@size@pt{#1pt}\def\rf@size{font-size:#1pt}\fi}
+\def\rf@size@num{12}\def\rf@size@pt{12pt}
+\define@key{rtFont}{raise}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@raise\@empty\else\rtfontstyletrue
+ \def\rf@raise{vertical-align:#1pt}\fi}
+\define@choicekey+{rtFont}{ulstyle}[\val\nr]%
+ {none,ul,2ul,wul,2wul}[none]{%
+ \ifcase\nr\relax
+ \def\rf@ul{none}\or
+ \def\rf@ul{underline}\or
+ \def\rf@ul{double}\or
+ \def\rf@ul{word}\or
+ \def\rf@ul{double word}\fi
+ \rtfontstyletrue
+}{}
+\def\rt@r{r}\let\rt@One=1 \let\rt@Zero=0
+\def\rt@parseColor#1(#2\@nil{\def\rt@argi{#2}\ifx\rt@argi\@empty
+\let\rt@rgbdec\rt@Zero\else\let\rt@rgbdec\rt@One\fi}
+\def\rt@gobbletonil#1\@nil{}
+\bgroup\@makeother\#\@makeother\&%
+\gdef\rt@hashtag{#}\gdef\rt@amp{&}\egroup
+\define@key{rtFont}{color}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@color\@empty\else\rtfontstyletrue
+ \rt@parseColor#1(\@nil
+ \if\rt@rgbdec\rt@One
+ \def\rf@color{color:#1}\else
+ \def\rf@color{color:\rt@hashtag#1}\fi
+\fi}
+\let\rf@color\@empty
+\define@key{rtFont}{url}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rt@url\@empty\else\rtfontstyletrue\def\rt@url{#1}\fi}
+\define@choicekey+{rtFontStyle}{bold}[\val\nr]{normal,bold}[bold]%
+ {\edef\rfS@bold{\val}}{}
+\define@choicekey+{rtFontStyle}{italic}[\val\nr]{normal,italic}[italic]%
+ {\edef\rfS@italic{\val}}{}
+\define@key{rtFontStyle}{strikeit}[]{\def\rfS@strikeit{line-through}}
+\let\rfS@normal\@empty\let\rfS@bold\@empty
+\let\rfS@italic\@empty\let\rfS@strikeit\@empty
+\define@key{rtFont}{style}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@style\@empty\else\rtfontstyletrue\def\rf@style{#1}\fi}
+\define@key{rtFont}{raw}[]{\def\rt@argi{#1}\ifx\rt@argi\@empty
+ \let\rf@raw\@empty\else\rtfontstyletrue\def\rf@raw{#1}\fi}
+\def\resetRtFontKeys{% rtFont family
+ \let\rf@font\@empty\let\rf@size\@empty
+ \let\rf@raise\@empty\let\rf@ul\@empty
+ \let\rf@color\@empty\let\rf@style\@empty\let\rt@url\@empty
+ \let\rf@raw\@empty
+ % rtFontStyle family
+ \let\rfS@normal\@empty\let\rfS@bold\@empty
+ \let\rfS@italic\@empty\let\rfS@strikeit\@empty
+ \rtfontstylefalse}
+\resetRtFontKeys
+\newcommand{\@AddToRichText}{\g@addto@macro\rt@RichText}
+\newcommand{\@AddToPlainText}{\g@addto@macro\rt@PlainText}
+\def\rt@excl{!}
+\def\rt@csarg#1#2{\expandafter#1\csname#2\endcsname}
+\newcommand{\useRV}[1]{\@nameuse{#1-ri}}
+\newcommand{\useV}[1]{\@nameuse{#1-pl}}
+\newif\if@rvstring \@rvstringfalse
+\def\rvorvstring{\if@rvstring
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\rt@sub#1{\rvorvstring{<sub>#1</sub>}{#1}}
+\def\rt@sup#1{\rvorvstring{<sup>#1</sup>}{#1}}
+\def\rt@br{\rvorvstring{<br />}{\string\r}}
+\def\rt@bf#1{\rvorvstring{<b>#1</b>}{#1}}
+\def\rt@it#1{\rvorvstring{<i>#1</i>}{#1}}
+\def\rt@spc{\rvorvstring{<span style="xfa-spacerun:yes">\rt@amp
+ \rt@hashtag160\rt@SC</span>}{ }}
+\def\rt@SC{;}\def\rt@CN{:}\def\rt@fs{font-style}\def\rt@fw{font-weight}
+\def\rt@td{text-decoration}
+\def\rt@remove@span#1#2{#2}
+\def\rt@StyleAttr{\ifx\rf@font\@empty\else\rf@font\rt@SC\fi
+ \ifx\rf@size\@empty\else\rf@size\rt@SC\fi
+ \ifrt@formfield\ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi\fi
+ \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else
+ \rt@td\rt@CN\rfS@strikeit\rt@SC\fi
+ \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space
+ \rfS@strikeit\fi\rt@SC\fi
+ \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi
+ \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi
+ \ifx\rf@color\@empty\else\rf@color\rt@SC\fi
+ \ifx\rf@raw\@empty\else\rf@raw\fi}
+\let\rt@afterFont\relax
+\newcommand\rt@span[2]{\resetRtFontKeys
+ \edef\x{\noexpand\setkeys{rtFont}{#1}}\x\rt@afterFont
+ \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x
+ \edef\rt@Style@ttr{\rt@StyleAttr}%
+ \ifx\rt@url\@empty
+ \ifx\rt@StyleAttr\@empty\def\x{#2}\else
+ \edef\x{<span\ifrtfontstyle\space
+ style="\rt@Style@ttr"\fi>#2</span>}\fi
+ \else
+ \ifx\rt@StyleAttr\@empty\edef\x{<a href="\rt@url">#2</a>}\else
+ \edef\x{<a href="\rt@url"
+ \ifrtfontstyle style="\rt@Style@ttr">#2</a>\fi}\fi
+ \fi
+}
+\define@choicekey+{rtPara}{halign}[\val\nr]%
+ {left,center,right,justify}[left]{%
+ \ifcase\nr\relax
+ \def\rt@halign{text-align:left}\or
+ \def\rt@halign{text-align:center}\or
+ \def\rt@halign{text-align:right}\or
+ \def\rt@halign{text-align:justify}\fi
+ \rtfontstyletrue
+}{}
+\define@choicekey+{rtPara}{valign}[\val\nr]{top,middle,bottom}[top]{%
+ \ifcase\nr\relax
+ \def\rt@valign{text-valign:top}\or
+ \def\rt@valign{text-valign:middle}\or
+ \def\rt@valign{text-valign:bottom}\fi
+ \rtfontstyletrue
+}{}
+\let\rt@halign\@empty\let\rt@valign\@empty
+\define@key{rtPara}{margleft}{\def\rt@margleft{margin-left:#1pt}}
+\define@key{rtPara}{margright}{\def\rt@margright{margin-right:#1pt}}
+\define@choicekey+{rtPara}{indent}[\val\nr]{none,first,hanging}[none]{%
+ \edef\rt@indenttype{\nr}%
+}{}
+\define@key{rtPara}{indentby}[12]{\def\rt@indentby{#1pt}}
+\let\rt@margleft\@empty\let\rt@margright\@empty
+\def\rt@indenttype{0}\def\rt@indentby{12pt}
+\define@key{rtPara}{margtop}[0]{\def\rt@margtop{#1pt}}
+\define@key{rtPara}{margbottom}[0]{\def\rt@margbottom{#1pt}}
+\def\rt@margtop{0pt}\def\rt@margbottom{0pt}
+\define@choicekey{rtPara}{linespacing}[\val\nr]%
+ {single,oneandhalf,double,exact}[single]{%line-height
+ \edef\rt@linespacingtype{\nr}%
+ \ifcase\nr
+ \let\rt@linesp\@empty\or
+ \setlength{\@tempdima}{1.8pt*\rf@size@num}%
+ \edef\rt@linesp{\the\@tempdima}\or
+ \setlength{\@tempdima}{2.4pt*\rf@size@num}%
+ \edef\rt@linesp{\the\@tempdima}\or
+ \def\rt@linesp{\rf@size@pt}\fi
+}{}
+\let\rt@linesp\@empty\def\rt@linespacingtype{0}
+\define@key{rtPara}{lineheight}[]{\def\rt@lineheight{#1pt}}
+\let\rt@lineheight\@empty
+\def\rtp@ti{text-indent}\def\rtp@mt{margin-top}
+\def\rtp@mb{margin-bottom}\def\rtp@lh{line-height}
+\def\rt@ParaAttr{%
+ \ifx\rt@halign\@empty\else\rt@halign\rt@SC\fi
+\ifrt@formfield
+ \ifx\rt@valign\@empty\else\rt@valign\rt@SC\fi
+ \ifx\rt@margleft\@empty\else\rt@margleft\rt@SC\fi
+ \ifx\rt@margright\@empty\else\rt@margright\rt@SC\fi
+ \ifcase\rt@indenttype\space\or
+ \rtp@ti\rt@CN\rt@indentby\rt@SC\or
+ \rtp@ti\rt@CN-\rt@indentby\rt@SC\fi
+ \rtp@mt\rt@CN\rt@margtop\rt@SC\rtp@mb\rt@CN\rt@margbottom\rt@SC
+ \ifx\rt@linesp\@empty\else
+ \if\rt@linespacingtype3%
+ \ifx\rt@lineheight\@empty
+ \rtp@lh\rt@CN\rt@linesp\rt@SC
+ \else
+ \rtp@lh\rt@CN\rt@lineheight\rt@SC
+ \fi
+ \else
+ \rtp@lh\rt@CN\rt@linesp\rt@SC
+ \fi
+ \fi
+\fi
+}
+\begingroup
+\catcode`\@=0 @catcode`@\=12
+@gdef@rtbs{\}
+@endgroup
+\def\rt@cs#1{\rvorvstring{\rtbs\rtbs#1}{\string\134#1}}
+\let\rt@afterParaFont\relax
+\def\rt@dir{ dir="ltr"}
+\newcommand\rtpara[2][]{\begingroup
+ \setkeys{rtPara,rtFont}{#1}\rt@afterParaFont
+ \edef\rt@Para@ttr{\rt@ParaAttr\rt@StyleAttr}%
+ \global\let\rt@RichText\@empty
+ \global\let\rt@PlainText\@empty
+ \def\rt@ctrlName{#2}%
+ \def\{{\string\{}\def\}{\string\}}%
+ \def\1{\string\1}\def\2{\string\2}\def\3{\string\3}%
+ \@makeother\$\@makeother\#\@makeother\^\@makeother\_\@makeother\~%
+ \@makeother\&\def\&{\rvorvstring{\string&}{\string&}}% req
+ \@makeother\<\def\<{\rvorvstring{\string<}{\string<}}% req
+ \@makeother\>\def\>{\rvorvstring{\string>}{\string>}}%
+ \@makeother\'\def\'{\rvorvstring{\string'}{\string'}}%
+ \@makeother\"\def\"{\rvorvstring{\string"}{\string"}}%
+ \let\cs\rt@cs
+ \rtpara@cont}
+\def\rtpara@cont#1{%
+ \let\sup\rt@sup\let\sub\rt@sub
+ \let\br\rt@br\let\bf\rt@bf\let\it\rt@it
+ \let\spc\rt@spc
+ \let\span\rt@remove@span
+ \@rvstringfalse
+ \edef\x{#1}\expandafter\@AddToPlainText\expandafter{\x}%
+ \let\span\relax
+ \@rvstringtrue
+ \rtpara@i#1\span!;\endgroup}
+\def\rtpara@i#1\span#2;{\def\argii{#2}%
+ \g@addto@macro\rt@RichText{#1}%
+ \ifx\argii\rt@excl
+ \rt@csarg\xdef{\rt@ctrlName-ri}%
+ {%
+ <p\rt@dir\ifx\rt@Para@ttr\@empty\else\space
+ style="\rt@Para@ttr"\fi>\rt@RichText</p>%
+ }%
+ \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}%
+ \let\rt@next\relax
+ \else
+ \def\rt@next{\rtpara@ii#2;}%
+ \fi
+\rt@next}
+\def\rtpara@ii#1#2#3;{\def\argii{#2}%
+ \ifx\argii\rt@excl
+ \let\rt@next\relax
+ \else
+ \let\span\rt@span
+ \let\br\rt@br\let\bf\rt@bf\let\it\rt@it
+ \@rvstringtrue
+ \span{#1}{#2}\edef\rt@tmp{\noexpand\g@addto@macro
+ \noexpand\rt@RichText{\x}}\rt@tmp
+ \rt@csarg\xdef{\rt@ctrlName-ri}%
+ {%
+ <p\rt@dir\ifx\rt@Para@ttr\@empty\else\space
+ style="\rt@Para@ttr"\fi>\rt@RichText</p>%
+ }%
+ \rt@csarg\xdef{\rt@ctrlName-pl}{\rt@PlainText}%
+ \let\span\relax
+ \def\rt@next{\rtpara@i#3;}%
+ \fi\rt@next}
+\rt@csarg\def{par-ri}{}\rt@csarg\def{par-pl}{\string\r}
+\rt@csarg\def{skipline-ri}%
+ {<p><span style="xfa-spacerun:yes">\rt@amp
+ \rt@hashtag160;</span></p>}
+\rt@csarg\def{skipline-pl}{\string\r\space}
+\def\rt@skipline{skipline}
+\rt@csarg\def{br-ri}{}\rt@csarg\def{br-pl}{\string\r}
+\def\rt@DSAttr{\ifx\rf@font\@empty\else\rf@font\rt@SC\fi
+ \ifx\rf@size\@empty\else\rf@size\rt@SC\fi
+ \ifx\rf@raise\@empty\else\rf@raise\rt@SC\fi
+ \ifx\rf@ul\@empty\ifx\rfS@strikeit\@empty\else
+ \rt@td\rt@CN\rfS@strikeit\rt@SC\fi
+ \else\rt@td\rt@CN\rf@ul\ifx\rfS@strikeit\@empty\else\space
+ \rfS@strikeit\fi\rt@SC\fi
+ \ifx\rfS@bold\@empty\else\rt@fw\rt@CN\rfS@bold\rt@SC\fi
+ \ifx\rfS@italic\@empty\else\rt@fs\rt@CN\rfS@italic\rt@SC\fi
+ \ifx\rf@color\@empty\else\rf@color\rt@SC\fi}
+\newcommand\useDefaultDS{font-family:Helvetica,sans-serif;%
+ font-size:12.0pt;font-style:normal;font-weight:normal;%
+ text-align:left;color:\rt@hashtag000000}
+\newcommand{\setDefaultStyle}[2]{\begingroup
+ \edef\x{\noexpand\setkeys{rtFont}{#2}}\x
+ \edef\x{\noexpand\setkeys{rtFontStyle}{\rf@style}}\x
+ \ifx\rf@ul\@empty\else
+ \let\rt@ul\@empty\PackageWarning{richtext}{%
+ The ul key is not supported within\MessageBreak
+ \string\setDefaultStyle. Ignoring it}\fi
+ \ifx\rf@raise\@empty\else
+ \let\rt@raise\@empty\PackageWarning{richtext}{%
+ The raise key is not supported within\MessageBreak
+ \string\setDefaultStyle. Ignoring it}\fi
+ \ifx\rt@url\@empty\else\let\rf@url\@empty
+ \PackageWarning{richtext}{%
+ The url key is not supported within\MessageBreak
+ \string\setDefaultStyle. Ignoring it}\fi
+ \ifx\rf@font\@empty
+ \def\rf@font{font-family:Helvetica,sans-serif}\fi
+ \ifx\rf@size\@empty\def\rf@size{font-size:\rf@size@pt}\fi
+ \ifx\rf@color\@empty\def\rf@color{color:\rt@hashtag000000}\fi
+ \rt@csarg\xdef{#1-DS}{\rt@DSAttr}%
+\endgroup}
+\newcommand{\useDS}[1]{\@nameuse{#1-DS}}
+\newif\ifrt@firsttok \rt@firsttoktrue
+\newif\ifrt@itsskipline \rt@itsskiplinefalse
+\def\rt@addtoRVV#1{%
+ \toks4={\useRV{#1}}\edef\rt@tmpRV{\the\toks0\the\toks4}%
+ \toks4={\useV{#1}}\edef\rt@tmpV{\the\toks2\the\toks4}%
+ \toks0=\expandafter{\rt@tmpRV}\toks2=\expandafter{\rt@tmpV}%
+}
+\def\rt@testifbgroup{\@ifnextchar\bgroup
+ {\let\rt@nultiargs=1\rt@gobbletonil}
+ {\let\rt@nultiargs=0\rt@gobbletonil}}
+\newcommand{\setRVVContent}[2]{\begingroup
+ \rt@firsttoktrue \rt@itsskiplinefalse
+ \rt@testifbgroup#2\@nil
+ \def\contName{#1}\toks0={}\toks2={}\toks4={}%
+ \if\rt@nultiargs1\def\rt@next{\setRVVContent@i#2;}\else
+ \def\rt@next{\setRVVContent@i{#2};}\fi\rt@next}
+\def\setRVVContent@i#1{\def\rt@argi{#1}%
+ \ifx\rt@argi\rt@SC
+ \rt@csarg\xdef{\contName-vcont}{\the\toks0}%
+ \rt@csarg\xdef{\contName-pcont}{\the\toks2}%
+ \let\rt@next\endgroup
+ \else
+ \expandafter\ifx\csname #1-ri\endcsname\relax
+ \PackageWarning{richtext}
+ {The name '#1' is not declared,\MessageBreak
+ will ignore it. Check the spelling}%
+ \def\rt@next{\setRVVContent@i}%
+ \else
+ \ifrt@firsttok\rt@firsttokfalse\else
+ \ifx\rt@argi\rt@skipline
+ \rt@itsskiplinetrue
+ \else
+ \ifrt@itsskipline
+ \rt@addtoRVV{br}\rt@itsskiplinefalse
+ \else
+ \rt@addtoRVV{par}%
+ \fi
+ \fi
+ \fi
+ \rt@addtoRVV{#1}%
+ \def\rt@next{\setRVVContent@i}%
+ \fi
+ \fi\rt@next
+}
+\def\useRVContent#1{\@nameuse{#1-vcont}}
+\def\useVContent#1{\@nameuse{#1-pcont}}
+\endinput
+%%
+%% End of file `richtext.sty'.
diff --git a/texmf-dist/tex/latex/yt4pdf/yt4pdf.cfg b/texmf-dist/tex/latex/yt4pdf/yt4pdf.cfg new file mode 100644 index 00000000..7a8e5de8 --- /dev/null +++ b/texmf-dist/tex/latex/yt4pdf/yt4pdf.cfg @@ -0,0 +1,10 @@ +% +% yt4pdf config file. Delete the \endinput below and replace the path +% provided with the path to the swf folder of your yt4pdf installation. This +% path is used to locate the pdf_tube_basic.swf file, used to play YouTube +% videos. +% +\endinput +\renewcommand{\ytFolder}{C:/Users/Public/Documents/My TeX Files/% +tex/latex/aeb/aebpro/yt4pdf/swf} +\endinput diff --git a/texmf-dist/tex/latex/yt4pdf/yt4pdf.sty b/texmf-dist/tex/latex/yt4pdf/yt4pdf.sty new file mode 100644 index 00000000..7aef683a --- /dev/null +++ b/texmf-dist/tex/latex/yt4pdf/yt4pdf.sty @@ -0,0 +1,346 @@ +%%
+%% This is file `yt4pdf.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% yt4pdf.dtx (with options: `copyright,package')
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% yt4pdf.sty package, %%
+%% Copyright (C) 2010--2016 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. %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\NeedsTeXFormat{LaTeX2e}[1997/12/01]
+\ProvidesPackage{yt4pdf}
+ [2016/10/04 v1.1 yt4pdf: Play You Tube videos in PDF, Acrobat Distiller only (dps)]
+\RequirePackage{xkeyval}
+\ProcessOptions
+\RequirePackage{rmannot}
+\RequirePackage{popupmenu}[2010/09/18]
+\newcommand{\ytFolder}{C:/Users/Public/Documents/My TeX Files/%
+tex/latex/aeb/aebpro/yt4pdf/swf}
+\saveNamedPath{ytSWF}{\ytFolder/pdf_tube_basic.swf}
+\InputIfFileExists{yt4pdf.cfg}{}{}
+\def\yt@namegdef#1{\expandafter\gdef\csname #1\endcsname}
+\def\yt@namexdef#1{\expandafter\xdef\csname #1\endcsname}
+\def\thisNamedRMA(#1){this.getAnnotRichMedia(this.pageNum,"#1")}
+\define@key{ytRmAnnot}{play}[]{\def\ytrmannot@play{#1}}
+\define@key{ytRmAnnot}{load}[]{\def\ytrmannot@load{#1}}
+\setkeys{ytRmAnnot}{play,load}
+\let\ytCurrRMAName\@empty
+\newcommand{\ytRmAnnot}[4][]{\begingroup
+ \@ifundefined{#2@ytrmname}{\yt@namegdef{#2@ytrmname}{#1}}%
+ {\PackageError{yt2pdf}{The name `#2' is already defined
+ for\MessageBreak this \string\ytRmAnnot}{Choose a unique
+ name for this \string\ytRmAnnot, one different from `#2'.}}%
+ \setkeys*{ytRmAnnot}{#1}\gdef\ytCurrRMAName{#2}%
+ \ifx\ytrmannot@play\@empty\else
+ \makebox[0pt][l]{\pushButton[\BC{}\BG{}\S{S}
+ \AA{\AAPageOpen{aebStartPlayer(\thisNamedRMA(#2),%
+ "\ytrmannot@play",true);}\AAPageClose{aebCancelWait(false);}}
+ ]{btnRmAnnot#2}{1bp}{1bp}}\let\ytrmannot@load\@empty\fi
+ \ifx\ytrmannot@load\@empty
+ \else\makebox[0pt][l]{\pushButton[\BC{}\BG{}\S{S}
+ \AA{\AAPageOpen{aebStartPlayer(\thisNamedRMA(#2),%
+ "\ytrmannot@load",false);}\AAPageClose{aebCancelWait(false);}}
+ ]{btnRmAnnot#2}{1bp}{1bp}}\fi
+ \rmAnnot[\XKV@rm,name=#2,enabled=onclick]{#3}{#4}{ytSWF}%
+ \endgroup
+}
+\newcommand{\DeclareYTName}[2][]{\def\argi{#1}%
+ \ifx\argi\@empty\gdef\ytCurrRMAName{#2}\else
+ \gdef\ytCurrRMAName{[#1]#2}\fi
+}
+\newcommand{\ytBtnPresets}[1]{\def\yt@Presets{#1}}
+\ytBtnPresets{\BC{.5 0 0}\S{S}\textFont{HeBo}\autoCenter{n}}
+\newcommand{\oyt@RMA}[1][this.pageNum]{\oyt@@RMA[#1]}
+\def\oyt@@RMA[#1]#2\@nil{\gdef\yt@CurrRMAName{#2}%
+ \def\yt@rm{this.getAnnotRichMedia(#1,"#2")}}
+\newcommand{\ytPlayToggle}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrPAUSE}\presets{\yt@Presets}#1
+ \A{\JS{ytPlayToggle(\yt@rm);}}]{playToggle}{#2}{#3}%
+}
+\newcommand{\ytStopLoading}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrStopLoading}\presets{\yt@Presets}#1
+ \A{\JS{\yt@rm.callAS("stopVideo");}}]{vidStop}{#2}{#3}%
+}
+\newcommand{\ytMuteToggle}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrMUTE}\presets{\yt@Presets}#1
+ \A{\JS{ytMuteToggle(\yt@rm);}}]{muteToggle}{#2}{#3}%
+}
+\newcommand{\ytRewind}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrREWIND}\presets{\yt@Presets}#1
+ \A{\JS{ytRewind(\yt@rm);}}]{ytRewind}{#2}{#3}%
+}
+\newcommand{\ytSelect}[4][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrLoadVideo}\presets{\yt@Presets}#1
+ \A{\JS{ytSelect(\yt@rm,"#2");}}]{selectVid}{#3}{#4}%
+}
+\newcommand{\ytOpenWeb}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrWatchOnWeb}\presets{\yt@Presets}#1
+ \A{\JS{ytOpenWeb(\yt@rm);}}]{playOnWeb}{#2}{#3}%
+}
+\newcommand{\ytvIdPresets}[1]{\def\yt@vIdPresets{#1}}
+\ytvIdPresets{\linktxtcolor{webbrown}}
+\newcommand{\ytvId}{\@ifstar{\def\yt@lnk@play{false}\yt@@vId}
+ {\def\yt@lnk@play{true}\yt@@vId}}
+\newcommand{\yt@@vId}[3][\ytCurrRMAName]{%
+ \oyt@RMA#1\@nil\setLink[\presets{\yt@vIdPresets}
+ \A{\JS{aebStartPlayer(\yt@rm,"#2",\yt@lnk@play);}}]{#3}}
+\newcommand{\ytComboListPresets}[1]{\def\yt@ComboListPresets{#1}}
+\newcommand{\ytComboBtnPresets}[1]{\def\yt@ComboBtnPresets{#1}}
+\let\yt@ComboListPresets\@empty
+\let\yt@ComboBtnPresets\@empty
+\newcommand{\ytPlayList}{\begingroup\@makeother\_\@makeother\'
+ \ytPlayList@i}
+\def\ytPlayList@i#1#2{\gdef\yt@pl@def{#1}\xdef\yt@pl@pl{#2}\endgroup}
+\newcommand{\declarePlayList}{\bgroup
+ \@makeother\_\@makeother\-
+ \yt@declarePlayList}
+\def\yt@declarePlayList#1#2{%
+ \gdef#1{#2}\egroup}
+\newcommand{\ytIdTitle}[2]{[(#2)(#1)]}
+\newcount\ytListCnt \ytListCnt=0
+\newcommand{\ytNewBaseName}[1][]{%
+ \def\yt@argi{#1}\ifx\yt@argi\@empty\global\advance\ytListCnt1\relax
+ \gdef\yt@BaseName{\yt@CurrRMAName\the\ytListCnt}\else
+ \gdef\yt@BaseName{\yt@CurrRMAName#1}\fi
+}
+\newcommand{\ytResetBaseName}{\gdef\yt@BaseName{\yt@CurrRMAName}}
+\ytResetBaseName
+\newcommand{\ytComboList}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \comboBox[\DV{\yt@pl@def}\V{\yt@pl@def}
+ \presets{\yt@ComboListPresets}#1]{ytSelect\yt@BaseName}
+ {#2}{#3}{\yt@pl@pl}%
+}
+\newcommand{\ytComboBtn}[3][]{%
+ \expandafter\oyt@RMA\ytCurrRMAName\@nil%
+ \pushButton[\CA{\ytStrPLAY}\presets{\yt@ComboBtnPresets}#1
+ \A{\JS{var f=this.getField("ytSelect\yt@BaseName");\r
+ aebStartPlayer(\yt@rm,f.value,!event.shift);
+ }}]{ytSelectBtn\yt@BaseName}{#2}{#3}%
+}
+\newcommand{\ytPopupMenuData}[1]{{\toks0={// yt4pdf: Begin popup menu data^^J}%
+ \@tfor\yt@menu:=#1\do{%
+ \toks2=\expandafter{\yt@menu}%
+ \edef\@tmp@exp{\the\toks0\the\toks2^^J}%
+ \toks0=\expandafter{\@tmp@exp}%
+ }\xdef\ytPopupData{\the\toks0// End of popup menu data}%
+}}
+\def\ytPopupData{// No popup menu data defined}%
+\newcommand{\puIdTitle}[2]{\item{title={#1},return={[\itemindex,'#2']}}}
+\newcommand{\ytStrPLAY}{PLAY}
+\newcommand{\ytStrREPLAY}{REPLAY}
+\newcommand{\ytStrPAUSE}{PAUSE}
+\newcommand{\ytStrBuffering}{Buffering...}
+\newcommand{\ytStrStopLoading}{Stop Loading}
+\newcommand{\ytStrMUTE}{MUTE}
+\newcommand{\ytStrUNMUTE}{UNMUTE}
+\newcommand{\ytStrREWIND}{REWIND}
+\newcommand{\ytStrLoadVideo}{Load Video}
+\newcommand{\ytStrWatchOnWeb}{Watch on YouTube}
+\newcommand{\ytRespQues}{Enter the YouTube Video ID}
+\newcommand{\ytRespTitle}{Load a Video}
+\newcommand{\ytRespLabel}{ID:}
+\newcommand{\ytStrErrorVideoNotFound}{Error: Video not found}
+\newcommand{\ytStrErrorNoEmbed}{Error: This video does not allow
+ embedded playback \r\r Would you like to view this video
+ on the web?}
+\newcommand{\ytStrConnecTimedOut}{Connection timed out, try again.}
+\begin{insDLJS*}[ytPlayToggle]{yt}
+\begin{newsegment}{yt4PDF: YouTube for PDF JavaScript}
+/*
+ Document-level script for YouTube player
+ Document-level script for the PDFtube embedded YouTube player
+ ***************************************************************
+ Functions to be called by buttons or links on the PDF
+ in each case, "rm" is the RichMedia annot containing the player
+ All these are optional and can be renamed or edited as required
+ ***********************************************************
+*/
+// toggle play/pause (button labels updated by event functions)
+function ytPlayToggle(rm) {
+ var ps = rm.callAS("getPlayerState");
+ rm.callAS((ps == 1)? "pauseVideo" : "playVideo");
+}
+// toggle mute (have to update button labels ourselves)
+function ytMuteToggle(rm) {
+ var im = rm.callAS("isMuted");
+ if (im) {
+ event.target.buttonSetCaption("\ytStrMUTE");
+ rm.callAS("unMute");
+ } else {
+ event.target.buttonSetCaption("\ytStrUNMUTE");
+ rm.callAS("mute");
+ }
+}
+// Ask the user for the ID number of a new video, and play it
+function ytSelect(rm,vID) {
+ var rsp = app.response({
+ cQuestion: "\ytRespQues",
+ cTitle: "\ytRespTitle",
+ cDefault: vID,
+ cLabel: "\ytRespLabel"});
+ if (rsp !=null && rsp != "")
+ aebStartPlayer(rm,rsp,true); // dps
+}
+// open the video's YouTube page in the web browser
+function ytOpenWeb(rm) {
+ var link = rm.callAS("getVideoUrl");
+ if (link != null) {
+ app.launchURL(link,true);
+ rm.activated = false;
+ }
+}
+// rewind (seek to zero)
+function ytRewind(rm) { rm.callAS("seekTo",0); }
+/*
+ ************************************************************
+ Functions called by the player itself, in response to events
+ as the events are "external", the annot is not the target.
+ These functions must exist and match the names in the SWF.
+ ***********************************************************
+*/
+function ytPlayerReady() {
+
+ // this is the place to load your default video - for example...
+ console.println("<YT> Player loaded and ready");
+ // this.getAnnotsRichMedia(this.pageNum)[0].callAS("loadVideoById",
+ // "eNzrn8-JFSE",0);
+ aebStartPlayer.isPlayerReady=true; // dps
+}
+function ytStateChange(st) {
+ // Possible values are unstarted (-1), ended (0), playing (1),
+ // paused (2), buffering (3), video cued (5)
+ var lbl = "";
+ console.println("<YT> State changed to " + st);
+ if (st == 0) lbl = "\ytStrREPLAY";
+ else if (st == 1) lbl = "\ytStrPAUSE";
+ else if (st == 3) lbl = "\ytStrBuffering";
+ else if (st == 2 || st == 5) lbl = "\ytStrPLAY";
+ if (lbl) this.getField("playToggle").buttonSetCaption(lbl);
+}
+function ytPlaybackQualityChange(str) {
+ // Possible values are "small", "medium", "large" and "hd720"
+ console.println("<YT> Quality changed to " + str);
+}
+function ytProgress(q) {
+ // q has four properties that you can use to update form fields,
+ // such as...
+ //this.getField("currentTime").value = q.CurrentTime;
+ //this.getField("Duration").value = q.Duration;
+ //this.getField("BytesLoaded").value = q.BytesLoaded;
+ //this.getField("BytesTotal").value = q.BytesTotal;
+}
+function ytError(err) {
+ // Video cannot be played
+ console.println("<YT> ERROR code " + err + " received");
+ if (err == 100)
+ app.alert("\ytStrErrorVideoNotFound", 0, 0, "YouTube");
+ else {
+ var resp=app.alert("\ytStrErrorNoEmbed", 1, 3, "YouTube");
+ if (resp==4) {
+ aebCancelWait(false);
+ ytOpenWeb(aebStartPlayer.annot);
+ }
+ }
+}
+/*
+ We start the player if the annot is activated, if not,
+ we set annot.activated=true, and wait for the widget to say it
+ is ready. When ready, ytPlayerReady() sets
+ aebStartPlayer.isPlayerReady=true
+*/
+function aebStartPlayer(rm,Id,bPlay) {
+ aebStartPlayer.annot=rm;
+ if (aebStartPlayer.annot.activated)
+ aebStartPlayer.annot.callAS(%
+(bPlay)?"loadVideoById":"cueVideoById",Id,0);
+ else {
+ aebCancelWait(false);
+ aebStartPlayer.annot.activated=true;
+ aebStartPlayer.isPlayerReady=false;
+ aebStartPlayer.twait=app.setInterval(%
+'aebWait4Ready(\"'+Id+'\",'+bPlay+');',250);
+ aebStartPlayer.to=app.setTimeOut("aebCancelWait(true)", 10000);
+ }
+}
+aebStartPlayer.isPlayerReady=false;
+aebStartPlayer.twait=null;
+aebStartPlayer.to=null;
+/*
+ If the player is ready, we start the video, and clear
+ the setInterval, otherwise, we wait.
+*/
+function aebWait4Ready(Id,bPlay) {
+ if (aebStartPlayer.isPlayerReady) {
+ aebCancelWait(false);
+ aebStartPlayer.annot.callAS(%
+(bPlay)?"loadVideoById":"cueVideoById",Id,0);
+ }
+}
+function aebCancelWait(bNotify) {
+ var twait=aebStartPlayer.twait;
+ if (aebStartPlayer.to!=null)
+ try { app.clearTimeOut(aebStartPlayer.to); } catch(e) {};
+ aebStartPlayer.to=null;
+ if (aebStartPlayer.twait!=null)
+ try { app.clearInterval(aebStartPlayer.twait); } catch(e) {}
+ aebStartPlayer.twait=null;
+ if ( bNotify && twait!=null ) app.alert("\ytStrConnecTimedOut");
+}
+\end{newsegment}
+\begin{newsegment}{Popup Menu Data and JS}
+\ytPopupData
+var aChoice;
+function ytProcessMenu(aMenu) {
+ var cChoice = \popUpMenu(aMenu);
+ if ( cChoice != null ) {
+ aChoice=eval(cChoice);
+ if (aChoice[1]=="") return null;
+ var thisChoice=aChoice[0];
+ if (ytProcessMenu.nChoice==undefined) {
+ ytProcessMenu.nChoice=thisChoice;
+ eval("aMenu"+ytProcessMenu.nChoice).bMarked=true;
+ } else {
+ eval("aMenu"+ytProcessMenu.nChoice).bMarked=false;
+ var oldnChoice=ytProcessMenu.nChoice;
+ ytProcessMenu.nChoice=thisChoice;
+ eval("aMenu"+ytProcessMenu.nChoice).bMarked=(oldnChoice==ytProcessMenu.nChoice)?false:true;
+ }
+ return aChoice;
+ } else return null;
+}
+function ytPopupMenu(rmaName,ytmenu) {
+ var aChoice=ytProcessMenu(ytmenu);
+ var rm=this.getAnnotRichMedia(this.pageNum,rmaName);
+ if (aChoice!=null) {
+ if (ytProcessMenu.lastDescrip==undefined) {
+ aebStartPlayer(rm,aChoice[1],!event.shift);
+ } else {
+ if (ytProcessMenu.lastDescrip!=aChoice[1]) {
+ aebStartPlayer(rm,aChoice[1],!event.shift);
+ }
+ }
+ ytProcessMenu.lastDescrip=aChoice[1];
+ }
+}
+\end{newsegment}
+\end{insDLJS*}
+\endinput
+%%
+%% End of file `yt4pdf.sty'.
|