%% %% This is file `pmdb.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% pmdb.dtx (with options: `copyright,package') %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% pmdb.sty package,, %% %% Copyright (C) 2019-2021 D. P. Story %% %% dpstory@uakron.edu dpstory@acrotex.net %% %% %% %% 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.2 of the %% %% License, or (at your option) any later version. %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{pmdb} \ProvidesPackage{pmdb}[2021/06/07 v1.0 Mark for input files] \edef\th@dquoteCat{\the\catcode`\"} \catcode`\"=12\relax \newif\ifpmdbmode \pmdbmodetrue \DeclareOption{dbmode}{\pmdbmodetrue} \DeclareOption{!dbmode}{\pmdbmodefalse} \newif\ifpmdbtight \pmdbtightfalse \DeclareOption{tight}{\pmdbtighttrue} \DeclareOption{!tight}{\pmdbtightfalse} \ProcessOptions \RequirePackage{eforms} \def\pmdb@ckThor{\@ifundefined{essayQ}{\let\essayQ\@gobble}{}} \AtBeginDocument{\pmdb@ckThor} \newif\ifpmdbFP \pmdbFPfalse \newif\ifpmdbDQs \pmdbDQsfalse \newif\ifeditSource \editSourcefalse \def\editSourceOn{\editSourcetrue} \def\editSourceOff{\editSourcefalse} \newcount\pmdb@Cnt \newcommand{\editSourceBtn}[3][]{\def\@editSourceBtn##1{% \pushButton[\A{/S/Launch/F(##1)}\protect\A#1 ]{editPb.\the\pmdb@Cnt}{#2}{#3}}} \newcommand{\editSourceLnk}[4][]{\def\@editSourceLnk##1{% \raisebox{1bp}{\setLinkBbox[\A{/S/Launch/F(##1)} \protect\A#1]{#2}{#3}[c]{\makebox[#2][l]{\thinspace#4}}}}} \editSourceBtn[\TU{View in default editor}\S{S}]{11bp}{11bp} \editSourceLnk[\linktxtcolor{red}\H{N}]{11bp}{11bp}{E} \def\useEditBtn{\def\@editSourceBorL{\@editSourceBtn}} \def\useEditLnk{\def\@editSourceBorL{\@editSourceLnk}} \useEditBtn \def\pmCBPresets#1{\def\pm@CBPresets{#1}} \pmCBPresets{} \def\cbSelectInput#1{\mbox{\checkBox[\TU{#1}\presets{\pm@CBPresets} \cmd{\bParams{#1}{\the\pmdb@Cnt}\eParams} \AAmouseup{\ccBoxMU}]{pmdbCkBx.\the\pmdb@Cnt}{11bp}{11bp}{On}% \ifeditSource\olBdry\@editSourceBorL{#1}\fi}\global \advance\pmdb@Cnt\@ne } \def\insertCkBx#1{\def\@insertCkBx##1{#1}} \def\setCBsMarg{% \ifpmdbtight \if@reversemargin \def\pmAlignCBAlt{\ifodd\value{page}\leavevmode \hfill\else\fi}\else \def\pmAlignCBAlt{\ifodd\value{page}\else\hfill\fi}\fi \else \if@reversemargin \def\pmAlignCBAlt{\ifodd\value{page}\hfil\else\hfil\fi}\else \def\pmAlignCBAlt{\ifodd\value{page}\hfill\else\fi}\fi \fi } \def\altCBMargins{\let\pmAlignCB\pmAlignCBAlt} \def\pmAlignCB{% \if@reversemargin \ifpmdbtight\hfill\else\fi \else \ifpmdbtight\else\hfill\fi \fi } \@ifundefined{chapter}{}{\AtBeginDocument{\setCBsMarg\altCBMargins}} \newif\ifqzInput \qzInputfalse \def\InputParas{\global\qzInputfalse \insertCkBx{\ifpmdbmode \everypar{\marginpar{\pmAlignCB \cbSelectInput{##1}}\global\everypar{}}\fi}} \InputParas \def\InputProbs{\global\qzInputfalse \insertCkBx{\ifpmdbmode \def\prior@questionsHook{\marginpar {\pmAlignCB\cbSelectInput{##1}}}\fi}} \newcount\saveQNo \saveQNo\z@ \def\pmHook@qzItems{% \let\item@pmOld\item \def\item@pmNew{\item@pmOld\itemhook\let\item\item@pmOld}% \let\item\item@pmNew} \def\InputQuizItems{\global\qzInputtrue \let\pmHook\pmHook@qzItems \saveQNo\z@ \insertCkBx{\def\cbInQzMargin{\cbSelectInput{##1}}}% \ItemHook{\leavevmode\ifpmdbmode \ifnum\saveQNo<\value{eqquestionnoi}% \marginpar{\pmAlignCB\cbInQzMargin}\fi \saveQNo=\arabic{eqquestionnoi}\fi}} \def\pmHook@item{\let\item@pmOld\item \def\item@pmNew{% \ifx\pmiarg\@empty \ifx\pm@Brk\ef@YES \def\pm@next{\item@pmOld[]}\else \let\pm@next\item@pmOld \fi \else \def\pm@next{\item@pmOld[\pmiarg]}% \fi\pm@next\itemhook\let\item\item@pmOld}% \let\item\item@pmNew } \def\ItemHook#1{\def\itemhook{#1}} \def\InputItems{\global\qzInputfalse \let\pmHook\pmHook@item \insertCkBx{\def\cbInQzMargin{\cbSelectInput{##1}}}% \ItemHook{\leavevmode\ifpmdbmode \marginpar{\pmAlignCB\cbInQzMargin}\fi}} \let\pmHook\relax \def\ckBxInput#1{\@insertCkBx{#1}% \ifpmdbDQs\def\donext{\pmHook\input{"#1"}}\else \def\donext{\pmHook\input{#1}}\fi \donext} \newcommand{\displayChoices}[3][]{\pushButton[\TU{\displayChoice@TU} \CA{\displayChoice@CA}#1\AAmouseup{\sldInputs}\protect\AA ]{sldInputs}{#2}{#3}} \def\displayChoiceCA#1{\def\displayChoice@CA{#1}} \def\displayChoiceTU#1{\def\displayChoice@TU{#1}} \displayChoiceCA{Display Choices} \displayChoiceTU{Display all choices in the console window} \newcommand{\clrChoices}[3][]{\pushButton[\TU{\clrChoices@TU} \CA{\clrChoices@CA}#1\AAmouseup{\clrAction}\protect\AA ]{Inputs}{#2}{#3}} \def\clrChoicesCA#1{\def\clrChoices@CA{#1}} \def\clrChoicesTU#1{\def\clrChoices@TU{#1}} \clrChoicesCA{Clear Choices} \clrChoicesTU{Clear all check boxes created by pmdb} \newcommand\@gobbleOR[2][]{} \def\pmInput{\@ifstar{\@gobbleOR}{\pmInput@i}} \def\pmInput@i{\@ifnextchar[%] {\let\pm@Brk\ef@YES\inputConta} {\let\pm@Brk\ef@NO\inputConta}} \let\pm@Brk\ef@NO \def\inputConta{\bgroup\@makeother\"\inputContb} \newcommand\inputContb[2][]{\egroup\def\pmiarg{#1}\inputConti#2;;} \def\inputConti{\@ifnextchar"% {\global\pmdbDQstrue\removedqs} {\global\pmdbDQsfalse\removesemis}} \def\removedqs"#1";;{\inputContii{#1}} \def\removesemis#1;;{\inputContii{#1}} \def\inputContii#1{\isItFullPath#1:\@nil\doinput{#1}} \def\isItFullPath#1:#2\@nil{% \def\@rgii{#2}\ifx\@rgii\@empty \global\pmdbFPfalse\else \global\pmdbFPtrue\fi} \def\doinput#1{\ifpmdbmode\def\donext{\ckBxInput{#1}}\else \ifpmdbDQs\def\donext{\input{"#1"}}\else \def\donext{\input{#1}}\fi\fi \donext} \def\pmInputWarni{\PackageWarningNoLine{pmdb}{The command \string\Input\space is already defined.\MessageBreak The checkboxes may not appear in the margins.\MessageBreak Use the supported command \string\pmInput\space instead}} \def\pmInputWarnii{\PackageWarningNoLine{pmdb}{Letting \string\Input\space to \string\pmInput. You are \MessageBreak encouraged to use the supported\MessageBreak command \string\pmInput\space instead}} \def\pmInputChk{% \@ifundefined{Input}{% \gdef\Input{\pmInputWarnii \global\let\pmInputWarnii\relax \global\let\pmInputWarni\relax \pmInput}}{\pmInputWarni}} \AtBeginDocument{\pmInputChk} \begin{defineJS}[\makeesc\@\makecmt\%]{\ccBoxMU} @ifpmdbFP% event.target.userName=("@p(1)"); @else% // device independent path var pos=this.path.lastIndexOf("/"); var thispath=this.path.substring(0,pos+1); pos=thispath.indexOf("/",1); var drive=thispath.substring(1,pos); var platform=app.platform; if (platform=="WIN") thispath=drive+":/"+thispath.substring(pos+1); if (platform=="MAC") thispath=drive+"/"+thispath.substring(pos+1); event.target.userName=thispath+("@p(1)");@fi if (event.modifier){ event.target.checkThisBox(0,!event.target.isBoxChecked(0)); try { aebTrustedFunctions(this,aebLaunchURL,% {cURL: "file:///"+event.target.userName}); } catch(e) { console.show(); console.println("The Ctrl+Click action is not supported, % installation of aeb\_pro.js or aeb-reader.js is required."); } } if (event.shift) { event.target.checkThisBox(0,!event.target.isBoxChecked(0));% @ifqzInput this.gotoNamedDest("@currQuiz."+(@p(2)+1));@fi } else { if (event.target.isBoxChecked(0)){ _oSPaths["pmdbCkBx.@p(2)"]=% [("@p(1)"),@ifpmdbDQs true@else false@fi]; _aInputs[@p(2)]=true; _numInputs++; }else{ _oSPaths["pmdbCkBx.@p(2)"]=null; _aInputs[@p(2)]=false; _numInputs--; } event.target["_boxState"]=!!event.target.isBoxChecked(0); } \end{defineJS} \begin{defineJS}[\makecmt\%]{\sldInputs} console.clear();console.show(); if (_numInputs==0) console.println("No inputs selected"); else { for(var i=0;i<_aInputs.length;i++){ if (!!_aInputs[i]){ if(_oSPaths["pmdbCkBx."+i][1]) console.println('\\\\input\{\\"'+(_oSPaths["pmdbCkBx."+i][0])% +'\\"\}'); else console.println('\\\\input\{'+(_oSPaths["pmdbCkBx."+i][0])% +'\}'); } } } \end{defineJS} \begin{defineJS}{\clrAction} var _oSPaths=new Object; var _aInputs=new Array; var _numInputs=0; this.resetForm("pmdbCkBx"); \end{defineJS} \begin{insDLJS}{mrki}{Supporting JavaScript for pmdb} var _oSPaths=new Object; var _aInputs=new Array; var _numInputs=0; \end{insDLJS} \catcode`\"=\th@dquoteCat \endinput %% %% End of file `pmdb.sty'.