Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/packages.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
\RequirePackage{listings} %% is this required???

\RequirePackage{xkeyval}

\RequirePackage{tcolorbox}
\RequirePackage{currfile}
\RequirePackage{comment}

%</classXimera>
% \end{macrocode}
% Various packages must be loaded early to avoid polluting the |.jax|
Expand All @@ -51,5 +52,6 @@
\RequirePackage{gettitlestring}
\RequirePackage{nameref}
\RequirePackage{epstopdf}

%</classXimera>
% \end{macrocode}
69 changes: 69 additions & 0 deletions src/pdfstyling.dtx
Original file line number Diff line number Diff line change
@@ -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}
%</classXimera>
% \end{macrocode}
62 changes: 34 additions & 28 deletions src/problem.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}
Expand Down Expand Up @@ -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{<div role="article" class="problem-environment #1" id="problem\arabic{identification}" numbered=" \problemNumDisp" titletext=" \GetTranslation{#2}">}
\HCode{<div role="article" class="problem-environment #1" id="problem\arabic{identification}" probnum="\probNumDisp" titletext=" \GetTranslation{#2}">}
}
{
\stepcounter{problem@Depth}
Expand All @@ -163,6 +169,7 @@
\fi
\fi
\addtocounter{problem@Depth}{-2}% Exited a problem so we've exited a problem layer. Need -2 because we steppped once at the start to check for needing a depth-level count reset.

\ifvmode
\IgnorePar
\fi
Expand All @@ -175,7 +182,6 @@
\ConfigureQuestionEnv{exercise}{Exercise}
\ConfigureQuestionEnv{question}{Question}
\ConfigureQuestionEnv{exploration}{Exploration}

\ifdefined\xmNotHintAsExpandable
\ConfigureQuestionEnv{hint}{hint} % 2024: hint is no longer a 'question-environment'.
\fi
Expand Down
38 changes: 28 additions & 10 deletions ximera.4ht
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,41 @@

\newcounter{identification}
\setcounter{identification}{0}
\def\probNumDisp{}% Otherwise don't display a problem number.
\newcommand{\ConfigureQuestionEnv}[2]{%
\renewenvironment{#1}{
}
{
}%
\renewenvironment{#1}{}{}
\ConfigureEnv{#1}
{
\def\problemNumDisp{}% Otherwise don't display a problem number.
\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{<div role="article" class="problem-environment #1" id="problem\arabic{identification}" numbered=" \problemNumDisp" titletext=" \GetTranslation{#2}">}
\HCode{<div role="article" class="problem-environment #1" id="problem\arabic{identification}" probnum="\probNumDisp" titletext=" \GetTranslation{#2}">}
}
{
\stepcounter{problem@Depth}
Expand All @@ -84,6 +105,7 @@
\fi
\fi
\addtocounter{problem@Depth}{-2}% Exited a problem so we've exited a problem layer. Need -2 because we steppped once at the start to check for needing a depth-level count reset.

\ifvmode
\IgnorePar
\fi
Expand All @@ -96,10 +118,6 @@
\ConfigureQuestionEnv{exercise}{Exercise}
\ConfigureQuestionEnv{question}{Question}
\ConfigureQuestionEnv{exploration}{Exploration}

\ifdefined\xmNotHintAsExpandable
\ConfigureQuestionEnv{hint}{hint} % 2024: hint is no longer a 'question-environment'.
\fi
\newcommand{\ConfigureTheoremEnv}[1]{%
\renewenvironment{#1}[1][]{\refstepcounter{problem}%
\ifthenelse{\equal{##1}{}}{}{%
Expand Down
Loading