diff --git a/src/packages.dtx b/src/packages.dtx index f1aa14a..61f7cda 100644 --- a/src/packages.dtx +++ b/src/packages.dtx @@ -39,9 +39,10 @@ \RequirePackage{listings} %% is this required??? \RequirePackage{xkeyval} - +\RequirePackage{tcolorbox} \RequirePackage{currfile} \RequirePackage{comment} + % % \end{macrocode} % Various packages must be loaded early to avoid polluting the |.jax| @@ -51,5 +52,6 @@ \RequirePackage{gettitlestring} \RequirePackage{nameref} \RequirePackage{epstopdf} + % % \end{macrocode} diff --git a/src/pdfstyling.dtx b/src/pdfstyling.dtx new file mode 100644 index 0000000..c8e7cb5 --- /dev/null +++ b/src/pdfstyling.dtx @@ -0,0 +1,69 @@ +% \begin{macrocode} +%<*classXimera> +% \end{macrocode} +% \begin{macrocode} +%%% Now we colorbox-ize nested theorems and problems. +% Define default color for colorized boxes now, so they can be edited by user in preamble if desired. +\definecolor{xmNestingColorLevelI}{RGB}{102, 255, 178}% Default top level color is Light Green +\definecolor{xmNestingColorLevelII}{RGB}{102, 178, 255}% Default first nested layer color is Light Blue +\definecolor{xmNestingColorLevelIII}{RGB}{255, 102, 178}% Default second nested layer color is Light Pink +\definecolor{xmNestingColorLevelIV}{RGB}{178, 255, 102}% Default third nested layer color is Bright Green +\definecolor{xmBackground}{RGB}{255,255,255}% Default background color is white. + +\newif\ifdispNest%% Flag for displaying any kind of nesting indicator via tcolorbox +\dispNesttrue% Default to showing nesting behavior via tcolorbox. + +\newif\ifdispNestColors%% Flag to opt for colored nesting indicators +\dispNestColorsfalse% Default to all black boxes, rather than colored by level + +\AtBeginDocument{ + \pdfOnly{ + \ifdispNestColors + \else% If we want non-colored boxes, overwrite the previous color definitions with variations on black. + \definecolor{xmNestingColorLevelI}{RGB}{0,0,0}% Black + \definecolor{xmNestingColorLevelII}{RGB}{35, 35, 35}% Light Blue + \definecolor{xmNestingColorLevelIII}{RGB}{70, 70, 70}% Light Pink + \definecolor{xmNestingColorLevelIV}{RGB}{105, 105, 105}% Bright Green + \fi + + %% Apply colorboxes around theorem-like environments in pdfs only to help see nesting. + \ifdispNest%% If you want to display nesting behavior via tcolorframebox frames, we now apply them. + \tcolorboxenvironment{algorithm}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=transparent} + \tcolorboxenvironment{axiom}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{claim}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{conclusion}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{condition}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{conjecture}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{corollary}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{criterion}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{definition}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{example}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{explanation}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{fact}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{formula}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{idea}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{lemma}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{model}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{notation}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{observation}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{proposition}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{paradox}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{procedure}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{remark}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{summary}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{template}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{warning}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + + %% Apply colorboboxes around problem-like environments in pdfs only to help see nesting. + \tcolorboxenvironment{problem}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{question}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{exploration}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + \tcolorboxenvironment{exercise}{colframe=xmNestingColorLevel\Roman{tcblayer},colback=xmBackground} + + \fi + } +} +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} \ No newline at end of file diff --git a/src/problem.dtx b/src/problem.dtx index c015ec2..66e990f 100644 --- a/src/problem.dtx +++ b/src/problem.dtx @@ -41,12 +41,13 @@ % % Configure environment configuration commands % -% The command \verb|\problemNumber| contains all the format code to determine the number (and the format of the number) for any of the problem environments. +% The command \verb|\probNumber| contains all the format code to determine the number (and the format of the number) for any of the problem environments. % % \begin{macrocode} \MakeCounter{Iteration@probCnt} \MakeCounter{problem} -\newcommand{\problemNumber}{ +\newif\ifnoNumberedProblems +\newcommand{\probNumber}{ % First we determine if we have a counter for this question depth level. \ifcsname c@depth\Roman{problem@Depth}Count\endcsname% Check to see if counter exists %If so, do nothing. @@ -69,11 +70,13 @@ \newcommand{\problemEnvironmentStart}[2]{% \stepcounter{problem@Depth}% Started a problem, so we've sunk another problem layer. \def\spaceatend{#1}% +%\edef\probNumDisp{\probNumber} \begin{trivlist}% -\item[\hskip\labelsep\sffamily\bfseries\GetTranslation{#2} \problemNumber% Determine the correct number of the problem, and the format of that number. +\item[\hskip\labelsep\sffamily\bfseries\GetTranslation{#2} \probNumber% Determine the correct number of the problem, and the format of that number. ]% \slshape } + %%%%% Configure environments end content %%%%%% \newcommand{\problemEnvironmentEnd}{%This configures all the end content for a problem. \stepcounter{problem@Depth} @@ -122,38 +125,41 @@ % \begin{macrocode} \newcounter{identification} \setcounter{identification}{0} +\def\probNumDisp{}% Otherwise don't display a problem number. \newcommand{\ConfigureQuestionEnv}[2]{% -\renewenvironment{#1}{ - } - { - }% +\renewenvironment{#1}{}{} \ConfigureEnv{#1} { -% \ifnumberedProblems% The code below is all to generate online problem numbering if option is set. -% \stepcounter{problem@Depth}% Started a problem, so we've sunk another problem layer. -% \ifcsname c@depth\Roman{problem@Depth}Count\endcsname -% \else -% \expandafter\newcounter{depth\Roman{problem@Depth}Count} -% \expandafter\setcounter{depth\Roman{problem@Depth}Count}{0} -% \fi -% \expandafter\stepcounter{depth\Roman{problem@Depth}Count} -% \def\problemNumDisp{ -% \arabic{depthICount}% Top Level Problem Number: X.1.1.1.1 Number. -% \ifcsname c@depthIICount\endcsname\ifnum\value{problem@Depth}>1 .\arabic{depthIICount}\fi% Problem 1.X.1.1.1 Number. -% \ifcsname c@depthIIICount\endcsname\ifnum\value{problem@Depth}>2 .\arabic{depthIIICount}\fi% Problem 1.1.X.1.1 Number. -% \ifcsname c@depthIVCount\endcsname\ifnum\value{problem@Depth}>3 .\arabic{depthIVCount}\fi% Problem 1.1.1.X.1 Number. -% \ifcsname c@depthVCount\endcsname\ifnum\value{problem@Depth}>4 .\arabic{depthVCount}\fi% Problem 1.1.1.1.X Number. -% \fi\fi\fi\fi -% } -% \else - \def\problemNumDisp{}% Otherwise don't display a problem number. -% \fi + \stepcounter{problem@Depth}% Started a problem, so we've sunk another problem layer. + \ifcsname c@depth\Roman{problem@Depth}Count\endcsname + \else + \expandafter\newcounter{depth\Roman{problem@Depth}Count} + \expandafter\setcounter{depth\Roman{problem@Depth}Count}{0} + \fi + \expandafter\stepcounter{depth\Roman{problem@Depth}Count} + \ifnumberedProblems% Because of how conditional syntax works, we need to make sure that the problem numbers are in the else branch so we do this goofy nonsense. + \noNumberedProblemsfalse + \else + \noNumberedProblemstrue + \fi + \ifnoNumberedProblems% The code below is all to generate online problem numbering if option is set. + \def\probNumDisp{} + \else + \def\probNumDisp{ + \space\arabic{depthICount}% Top Level Problem Number: X.1.1.1.1 Number. + \ifcsname c@depthIICount\endcsname\ifnum\value{problem@Depth}>1 .\arabic{depthIICount}\fi% Problem 1.X.1.1.1 Number. + \ifcsname c@depthIIICount\endcsname\ifnum\value{problem@Depth}>2 .\arabic{depthIIICount}\fi% Problem 1.1.X.1.1 Number. + \ifcsname c@depthIVCount\endcsname\ifnum\value{problem@Depth}>3 .\arabic{depthIVCount}\fi% Problem 1.1.1.X.1 Number. + \ifcsname c@depthVCount\endcsname\ifnum\value{problem@Depth}>4 .\arabic{depthVCount}\fi% Problem 1.1.1.1.X Number. + \fi\fi\fi\fi + } + \fi \stepcounter{identification} \ifvmode \IgnorePar \fi \EndP -\HCode{