ORMCbox fix

This commit is contained in:
2024-01-31 09:28:49 -08:00
parent 4dd9645738
commit 36a5556804
2 changed files with 54 additions and 44 deletions

View File

@ -643,54 +643,64 @@
% Make a box environment.
% These can safely be nested.
% Args: name, title, back color, frame color.
\newcommand{\@makeORMCbox}[4]{
\newenvironment{#1}{
% \linehack draws a line across a tcolorbox.
% tcolorbox only supports two sections, but
% this hack allows us to have more.
\def\linehack{
\begin{tikzpicture}
\path[use as bounding box]
(0, 0) --
(\linewidth, 0);
% Args: title, back color, frame color.
\newenvironment{ORMCbox}[3]{
% \linehack draws a line across a tcolorbox.
% tcolorbox only supports two sections, but
% this hack allows us to have more.
\def\linehack{
\begin{tikzpicture}
\path[use as bounding box]
(0, 0) --
(\linewidth, 0);
\draw[color=#4, dashed, dash phase=1mm]
(0 - \kvtcb@leftlower-\kvtcb@boxsep, 0) --
(\linewidth + \kvtcb@rightlower + \kvtcb@boxsep, 0);
\end{tikzpicture} \par
\vspace{2mm}
}
% Keep track of the current background color.
% Useful for transparent tikz drawings.
\def\ORMCbgcolor{#3}
\begin{tcolorbox}[
enhanced,
breakable,
colback=#3,
colframe=#4,
colbacktitle=#4,
titlerule=0.6mm,
title={\textbf{#2}},
title after break={\textbf{#2 (continued)}},
frame style={draw=none,fill=none},
boxrule=0mm, % We need this even with hidden borders for correct spacing
arc=0mm,
outer arc=0mm
]
\raggedright
} {
\end{tcolorbox}
\draw[color=#3, dashed, dash phase=1mm]
(0 - \kvtcb@leftlower-\kvtcb@boxsep, 0) --
(\linewidth + \kvtcb@rightlower + \kvtcb@boxsep, 0);
\end{tikzpicture} \par
\vspace{2mm}
}
% Keep track of the current background color.
% Useful for transparent tikz drawings.
\def\ORMCbgcolor{#2}
\begin{tcolorbox}[
enhanced,
breakable,
colback=#2,
colframe=#3,
colbacktitle=#3,
titlerule=0.6mm,
title={\textbf{#1}},
title after break={\textbf{#1 (continued)}},
frame style={draw=none,fill=none},
boxrule=0mm, % We need this even with hidden borders for correct spacing
arc=0mm,
outer arc=0mm
]
\raggedright
} {
\end{tcolorbox}
}
\@makeORMCbox{examplesolution}{Example Solution}{black!10!white}{black!65!white}
\newenvironment{examplesolution}{
\begin{ORMCbox}{Example Solution}{black!10!white}{black!65!white}
} {
\end{ORMCbox}
}
\if@solutions
\@makeORMCbox{solution}{Solution}{ored!10!white}{ored}
\@makeORMCbox{instructornote}{Note for Instructors}{ocyan!10!white}{ocyan}
\newenvironment{solution}{
\begin{ORMCbox}{Solution}{ored!10!white}{ored}
} {
\end{ORMCbox}
}
\newenvironment{instructornote}{
\begin{ORMCbox}{Note for Instructors}{ocyan!10!white}{ocyan}
} {
\end{ORMCbox}
}
\else
\excludecomment{solution}
\excludecomment{instructornote}