From 36a5556804cb255b50683336f991317fd5fcbe96 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 31 Jan 2024 09:28:49 -0800 Subject: [PATCH] ORMCbox fix --- .../parts/02.00 half a qubit.tex | 4 +- resources/ormc_handout.cls | 94 ++++++++++--------- 2 files changed, 54 insertions(+), 44 deletions(-) diff --git a/Advanced/Introduction to Quantum/parts/02.00 half a qubit.tex b/Advanced/Introduction to Quantum/parts/02.00 half a qubit.tex index 2ac8aa6..aaf65df 100644 --- a/Advanced/Introduction to Quantum/parts/02.00 half a qubit.tex +++ b/Advanced/Introduction to Quantum/parts/02.00 half a qubit.tex @@ -47,7 +47,7 @@ However, \texttt{0} and \texttt{1} aren't the only states a qubit may have. We'll make sense of quantum bits by extending the \say{vectored} bit representation we developed in the previous section. First, let's look at a diagram we drew a few pages ago: -\begin{timetravel} +\begin{ORMCbox}{Time Travel (Page 2)}{black!10!white}{black!65!white} A classical bit takes states in $\{\texttt{0}, \texttt{1}\}$, picking one at a time. \par We'll represent \texttt{0} and \texttt{1} as perpendicular unit vectors $\ket{0}$ and $\ket{1}$, show below. @@ -72,7 +72,7 @@ First, let's look at a diagram we drew a few pages ago: The point marked $1$ is at $[0, 1]$. It is no parts $\ket{0}$, and all parts $\ket{1}$. \par Of course, we can say something similar about the point marked $0$: \par It is at $[1, 0] = (1 \times \ket{0}) + (0 \times \ket{1})$, and is thus all $\ket{0}$ and no $\ket{1}$. \par -\end{timetravel} +\end{ORMCbox} The diagram in the box above can also be used to describe the state of a qubit. \par Like classical bits, qubits have the \textit{basis states} $\ket{0}$ and $\ket{1}$. \par diff --git a/resources/ormc_handout.cls b/resources/ormc_handout.cls index c027368..12c7fa4 100755 --- a/resources/ormc_handout.cls +++ b/resources/ormc_handout.cls @@ -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}