summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-07 22:25:45 +0000
committerKarl Berry <karl@freefriends.org>2019-03-07 22:25:45 +0000
commit2915b13b4b4cd9a3c35eae7122d2b8604cd8b494 (patch)
tree47ed6313605b8c6927c7ca8a5e76863de22bd849 /Master
parentac3543b34cf8626d011a6befdc4c9a9ffaefda5c (diff)
brandeis-problemset (7mar19)
git-svn-id: svn://tug.org/texlive/trunk@50279 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/brandeis-problemset/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.pdfbin64099 -> 81699 bytes
-rw-r--r--Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.tex475
-rw-r--r--Master/texmf-dist/doc/latex/brandeis-problemset/example.pdfbin49206 -> 49709 bytes
-rw-r--r--Master/texmf-dist/doc/latex/brandeis-problemset/example.tex37
-rw-r--r--Master/texmf-dist/tex/latex/brandeis-problemset/brandeis-problemset.cls519
6 files changed, 498 insertions, 535 deletions
diff --git a/Master/texmf-dist/doc/latex/brandeis-problemset/README.md b/Master/texmf-dist/doc/latex/brandeis-problemset/README.md
index 1c8c654713e..00af4ab0311 100644
--- a/Master/texmf-dist/doc/latex/brandeis-problemset/README.md
+++ b/Master/texmf-dist/doc/latex/brandeis-problemset/README.md
@@ -13,4 +13,4 @@ brandeis-problemset.tex | Documentation source
example.tex | Example problem set
example.pdf | Example problem set
README.md | This file
-LICENSE.txt | LPPL v1.3c
+LICENSE.txt | LPPL 1.3c
diff --git a/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.pdf b/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.pdf
index bc5bcfa7cc1..d3893baaafa 100644
--- a/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.pdf
+++ b/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.tex b/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.tex
index 433dfb83c5a..e17ac3e4028 100644
--- a/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.tex
+++ b/Master/texmf-dist/doc/latex/brandeis-problemset/brandeis-problemset.tex
@@ -1,16 +1,58 @@
+\PassOptionsToPackage{inline}{enumitem}
\documentclass{ltxguidex}
+\usepackage{fontspec}
+\usepackage[pseudocode, solution, assembly, tabu]{brandeis-problemset}
+
+\usepackage{xkeyval}
+\usepackage{xparse}
\usepackage{textcomp} % needed for listings
\usepackage{hologo} % xetex, etc. logos
\usepackage{changelog}
\newcommand{\bps}{\ltxclass{brandeis-problemset}}
\newcommand{\fontspecok}{\hologo{XeLaTeX} or \hologo{LuaTeX}}
-\newcommand{\cosi}[1]{\textsc{cosi}~#1}
+\newcommand{\unicode}[1]{\textsc{u+#1}}
+\NewDocumentCommand{\cosi}{o m}{\textsc{cosi}~#2\IfValueT{#1}{ (#1)}}
\newnotice{todo}{To-do}
-\usepackage{fontspec}
+\newcommand{\reqopt}[1]{Requires the \texttt{\color{magenta}#1} option.\par}
+\newcommand{\dep}[1]{{\noticestyle Warning:} deprecated since #1.\par}
+\newcommand{\withopt}[1]{\fbox{With the \option{#1} option:}}
+
+\makeatletter
+\renewcommand{\SX@explpreset}{
+ language=[LaTeX]TeX,
+ numbers=none,
+}
+\define@cmdkeys{joinlist}{sep, wrapper}
+\define@cmdkey{joinlist}{last}{\KV@joinlist@oxfordfalse}
+\define@boolkey{joinlist}{oxford}[true]{}
+\define@boolkey{joinlist}{and}[true]{\ifKV@joinlist@and\def\cmdKV@joinlist@last{and}\fi}
+\define@boolkey{joinlist}{or} [true]{\ifKV@joinlist@or \def\cmdKV@joinlist@last{or}\fi}
+\presetkeys{joinlist}{sep={,}, last=and, oxford, wrapper=\relax}{}
+\NewDocumentCommand{\joinlist}{O{} >{\SplitList{,}} m}
+ {{\setkeys{joinlist}{#1}%
+ \newcommand{\joinlist@wrapper}[1]{\item\cmdKV@joinlist@wrapper{##1}}%
+ \begin{itemize*}[
+ label={},
+ itemjoin={\cmdKV@joinlist@sep},
+ itemjoin*={\ifKV@joinlist@oxford\cmdKV@joinlist@sep\ \fi
+ \cmdKV@joinlist@last}]%
+ \ProcessList{#2}{\joinlist@wrapper}%
+ \end{itemize*}}}
+\makeatother
+
+\makeatletter
+\NewDocumentCommand{\withopts}{m}
+ {\fbox{With any of the \joinlist[or, wrapper=\option]{#1} options:}}
+\makeatother
+\newcommand{\onlyclass}{Only available in the \bps\ document class.}
+\newcommand{\optenables}[2]{If \option{#1} is set, then \option{#2} is
+automatically enabled.}
+
\setmainfont{Tiempos Text}
\usepackage{FiraSans}
\usepackage{FiraMono}
+\lstset{basewidth=0.6em}
\lstnewenvironment{latexfile}[1]
{\lstset{
@@ -21,7 +63,7 @@
\author{Rebecca Turner\thanks{Brandeis University; \email{rebeccaturner@brandeis.edu}}}
\title{The \bps\ Document Class}
-\date{2019/02/14 0.4.4}
+\date{2019/03/06 0.5.0}
\begin{document}
\maketitle
\begin{abstract}
@@ -47,12 +89,19 @@
\https{github.com/9999years/brandeis-problemset}
\end{note}
+\begin{note}
+ In roughly May 2021 I will graduate from Brandeis University and
+ this package will become unmaintained. Although I'd like the
+ computer science department to adopt this package, I'm not sure any
+ professors have an interest in that maintenance. If you care about
+ the extended future of this package, send some emails!
+\end{note}
+
\tableofcontents
\vfill
\pagebreak
\section{Default behavior}
-
\bps\ provides packages and well-formatted constructs (notably the
|problem| environment) for problem-set writers. \bps\ will always render
its body copy as a Times variant (\ctan{stix} for plain \LaTeX\ or
@@ -61,18 +110,25 @@ contains the page number, author's name, course, instructor, and assignment
due date).
\subsection{Default packages loaded}
+In general, \bps\ will only load a feature if it's useful in more than one
+class; features like Gantt charts, Scheme code, assembly code, and so on,
+are loaded on demand.
\begin{enumerate}
\item \ctan{hyperref}, for a nicely-linked table of contents;
|\href||{url}{label}|.
-\item \ctan{listings}, for verbatim code listings (including the
- |assembly|, |java|, and |pseudocode| environments).
-\item \ctan{xcolor}, for gray line numbers in code listings (and perhaps
- colored listings in the future); e.g.\ |\color||{gray}|.
+\item \ctan{geometry} for page size and margins.
\item \ctan{enumitem} for better control over the margins and spacing of
the |enumerate|, |itemize|, and |description|
environments.
-\item Math packages: \begin{enumerate}
+\item \withopts{listings, scheme, pseudocode, assembly}
+\begin{enumerate}
+ \item \ctan{listings}, for verbatim code listings (including the
+ |assembly|, |java|, and |pseudocode| environments).
+ \item \ctan{xcolor}, for colored identifiers, strings, comments, and
+ line numbers in listings; e.g.\ |\color||{gray}|.
+\end{enumerate}
+\item \withopt{math} \begin{enumerate}
\item \ctan{amsmath} for tons of useful math commands, including
|\text|, |\intertext|, and |\boxed| as well as the |bmatrix|,
|multiline|, |gather|, |align|, and
@@ -81,11 +137,14 @@ due date).
Guide for the \package{amsmath} Package''} for a more
complete listing.
\item \ctan{mathtools} for other useful/utilitarian commands.
+ \item With \fontspecok, \ctan{unicode-math} to allow equations to be
+ copy-pasted.
+ \item The \ctan{stix2-otf} math fonts.
\end{enumerate}
-\item Table packages: \begin{enumerate}
+\item \withopt{tabu} \begin{enumerate}
\item \ctan{multirow} for cells spanning multiple rows.
- \item \ctan{booktabs} for good-by-default tables and the |\cline|
- macro.
+ \item \ctan{booktabs} for beautiful-by-default tables and the
+ |\cline| macro.
\item \ctan{tabu}, the best table package with dynamically resizable
columns, easy creation of new column types, and more.
\end{enumerate}
@@ -97,25 +156,78 @@ due date).
Class options are limited to configuration options which require the loading
of fonts or other packages; ``string'' settings like the assignment's due
-date are configured either with the |\problemsetsetup| command or the
-commands described in section~\ref{sss:configcommands}.
+date are configured with the |\bpsset| command.
+
+All class options can be negated with |no<option>|; e.g.\ \option{scheme}
+can be disabled with \option{noscheme}. Later options override previous
+ones.
\begin{keys}
- \key{gantt} Load packages for the |ganttschedule| environment.
- \key{scheme} Define the |scheme| language for the \ctan{listings}
- package as well as the |scheme| shorthand environment.
- \key{antonella} Use Dr.\ Antonella DiLillio's preferred styles (Courier
- for code)
- \key{solutions} Include |solution| environments in compiled
- document.
+ \key{antonella} \onlyclass\ Use Dr.\ Antonella DiLillio's preferred
+ styles (Courier for code)
+ \key{tabu} \onlyclass\ Loads useful packages and defines commands for
+ typesetting tables.
+ \key{math} \onlyclass\ Loads utilities for typesetting mathematics.
+ Because mathematics requires specialized fonts\footnote{The
+ \textsc{stix2} math font that this package loads weighs in
+ at 740kb!} as well as several other specialized
+ packages,\footnote{Including \ctan{amsmath},
+ \ctan{mathtools}, and, with \fontspecok,
+ \ctan{unicode-math}.} this is disabled by default. Although
+ I find myself needing mathematics fonts frequently, I know
+ many students do not.
+ \key[default=true]{listings} Enables code listings and enables
+ default styles for colored keywords, pretty line numbers,
+ and so on. While only this option enables the |java|
+ environment, the \option{scheme}, \option{assembly}, and
+ \option{pseudocode} options also load and style the
+ \ctan{listings} package.
+ \key{scheme} Enable Scheme language support, in particular for the
+ \textsc{r5rs} dialect. Additionally, provides the |scheme|
+ environment.
+ \key{pseudocode} Enables the |pseudocode| environment, notably
+ useful for \cosi[data structures]{21b}.
+ \key{assembly} Enables the |assembly| environment, notably useful
+ for \cosi[operating systems]{131a}.
+ \key{solution} Show the content of |solution| environments; by
+ default, they are excluded from compilation using the
+ \ctan{comment} package.
+ \key{gantt} Loads the |ganttschedule| environment.
+ \key[default=true]{maketitle} Redefines |\maketitle| and defines
+ |\maketitlepage| to include information about the course,
+ instructor, assignment, and due date.
+ \optenables{maketitle}{option}.
+ \key[default=true]{header} Adds a header to the top of every page including
+ information about the author, assignment, due date, and
+ instructor. \optenables{header}{option}.
+ \key[default=true]{config} Enables document metadata like the
+ assignment's due date, name/number, instructor, and course
+ through the |\bpsset| command, which supports |\maketitle|,
+ page headers, and so on.
\end{keys}
-\subsection{Setting options after loading \bps}
+\subsubsection{Class options or keyval options?}
+There's trade-offs to be made either way; class options greatly simplify the
+code (we don't have to worry about loading packages and defining commands in
+more than one place, for the most part), but are much less flexible and
+difficult to interface with when the package loading is hidden. At the
+moment, package/class options provide commands and keyval options define
+document-configuration data (like names, due dates, and the like; see
+section~\ref{s:config} for more information).
+\subsection{Configuring \bps\ after loading}\label{s:config}
\begin{desc}
-|\problemsetsetup{<options>}|
+|\bpsset{<options>}|
\end{desc}
-Sets global \bps\ options.
+Sets global \bps\ options. Mnemonic: \textbf{B}randeis \textbf{p}roblem
+\textbf{s}et \textbf{set}up (this should feel familiar to users of the
+\ctan{listings} package).
+
+\begin{note}
+ |\bpsset| was renamed from |\problemsetsetup| in version 0.5.0. The
+ |\problemsetsetup| command is deprecated and will be removed in a
+ future release.
+\end{note}
\begin{keys}
\key{course}[\m{course name}]
@@ -131,7 +243,8 @@ Sets global \bps\ options.
\href{https://en.wikipedia.org/wiki/ISO_8601}{\textsc{iso} 8601
dates} are highly recommended.
\key{instructor}[\m{course instructor}]
- Course instructor.
+ Course instructor. With the \option{antonella} class-option, this is
+ automatically set to |Dr.~Antonella DiLillio|.
\key{author}[\m{your name}]
Alternate interface for the |\author| command.
\key{date}[\m{document date}]
@@ -140,37 +253,13 @@ Sets global \bps\ options.
With \fontspecok, pass the given font to |\setmonofont| and enable
Unicode shortcuts for the |pseudocode| environment. (If you need to
specify options to |\setmonofont|, use |\setcodefont|.)
-\key{gantt}[\bool][false]
- Load packages for the |ganttschedule| environment.
-\key{antonella}[\bool][false]
- Use Dr.\ Antonella DiLillio's preferred styles (Courier for code)
-\key{solutions}[\bool][false]
- Include |solution| environments in compiled document.
\end{keys}
-\subsubsection{Configuration commands}%
-\label{sss:configcommands}
-
-\bps\ additionally provides a number of configuration commands for setting a
-single opption with similar interfaces as the \TeX\ macros |\author|,
-|\title|, and |\date|.
-
-\begin{desc}|\duedate{<date>}|\end{desc} Sets the due date in full.
-\begin{desc}|\instructor{<name>}|\end{desc} Sets the instructor name.
-\begin{desc}|\course{<name>}|\end{desc} Sets the course name in full.
-\begin{desc}|\coursenumber{<number>}|\end{desc} Sets the course name by
- number; e.g. |\coursenumber{21a}| gives a course of ``\cosi{21a}''.
-\begin{desc}|\assignment{<name>}|\end{desc} Sets the assignment name in
- full.
-\begin{desc}|\problemsetnumber{<number>}|\end{desc} Sets the assignment name
- by number; e.g. |\problemsetnumber{3}| gives an assignment of
- ``Problem Set 3''.
-
\begin{desc}
|\setcodefont[<fontspec options>]{<fontspec font name>}|
\end{desc}
-Sets the monospaced font to \meta{font name} and uses it for shortcuts in
-the |pseudocode| environment.
+Sets the monospaced font to \meta{fontspec font name} and uses it for
+shortcuts in the |pseudocode| environment.
\subsection{Practical usage}
@@ -180,14 +269,18 @@ makes sense for them to live in the same directory as the problem set source
files. For instance, \filename{cosi21a.cls} might read:
\begin{latexfile}{cosi21a.cls}
-\LoadClass[antonella]{brandeis-problemset}
+\LoadClass[antonella, pseudocode]{brandeis-problemset}
+
+% pass all unknown options to brandeis-problemset
+\DeclareOption*{\PassOptionsToClass
+ {\CurrentOption}{brandeis-problemset}}
+\ProcessOptions\relax
% set course/author data
-\problemsetsetup{
- instructor=Dr.\ Antonella DiLillio,
+\bpsset{
coursenumber=21a,
+ author=Rebecca Turner,
}
-\author{Rebecca Turner}
% get a prettier code font -- these can be pretty big so they're not
% loaded by default
@@ -203,14 +296,18 @@ and then \filename{ps1.tex} might read:
\begin{latexfile}{ps1.tex}
\documentclass{cosi21a}
% stuff specific to this assignment
-\problemsetnumber{1}
-\duedate{2018-10-29}
+\bpsset{
+ number=1,
+ duedate=2018-10-29,
+}
\begin{document}
% etc.
\end{document}
\end{latexfile}
-See section~\ref{sec:example} for a more complete example.
+Note that you could use e.g.~|\documentclass[math]{cosi21a}| to add a
+specific per-document option. See section~\ref{sec:example} for a more
+complete example.
\section{User commands and environments}
@@ -221,7 +318,16 @@ See section~\ref{sec:example} for a more complete example.
\end{desc}
Defines a problem. A problem is set 1~inch from the left margin (although
this amount may be customized by modifying the |\problemindent| length) and
-begins a new page. |<options>| may include:
+begins a new page.
+
+\begin{note}
+ The |problem| and |subproblem| environments are typeset using
+ |\section| and |\subsection| respectively, and as such can be
+ customized with styling packages like \ctan{titlesec}; note,
+ however, that they ignore and hide the usual section counters.
+\end{note}
+
+|<options>| may include:
\begin{keys}
\key{title}[\m{problem title}]
Displayed after ``Problem'' and the problem's number.
@@ -234,6 +340,8 @@ begins a new page. |<options>| may include:
Adds a custom label to the problem with |\label| that can be used
with |\ref|. I recommend prefixing your problem labels with |p:| as
in |p:big-o-proofs|.
+\key{toc}[\bool][true]
+ Include this problem in the table of contents?
\key{part}[\m{part name}]
Indicates that this problem starts a new ``part'' of the assignment;
actually calls |\part| under the hood.
@@ -245,6 +353,41 @@ begins a new page. |<options>| may include:
Vertical material is allowed in a~|problem|.
\begin{desc}
+|\begin{subproblem}[<options>]...\end{subproblem}|
+\end{desc}
+Defines a subproblem. A subproblem is set 1~inch from the left margin
+(although this amount may be customized by modifying the |\subproblemindent|
+length) and begins a new page. Valid |<options>| are identical to the
+|problem| environment's, with the following exceptions:
+\begin{keys}
+\key[default=false]{pagebreak}
+ False by default.
+\key{part}
+\key{partlabel}
+ Not available in the |subproblem| environment.
+\end{keys}
+
+\begin{example}
+ Note that although these examples are too short to display them,
+ vertical material --- including listings --- is allowed in the
+ |problem| and |subproblem| environments.
+\end{example}
+\begin{LTXexample}[preset={
+ \presetkeys{problem}{toc=false}{}
+ \presetkeys{subproblem}{toc=false}{}
+ }]
+\begin{problem}
+ This is a problem in an assignment.
+\end{problem}
+
+Some solution here\dots
+
+\begin{subproblem}
+ This is a subproblem.
+\end{subproblem}
+\end{LTXexample}
+
+\begin{desc}
|\begin{solution}...\end{solution}|
\end{desc}
@@ -260,18 +403,33 @@ assignment prompt and an answer key.
|\solutionstyle|; it's defined to |\color{blue}| by default.
\end{note}
-\begin{desc}
-|\subproblem[<problem description>]|
-\end{desc}
-Prints a sub-problem, i.e.\ a |\subsection|. It doesn't do very much at the
-moment.
+\begin{example}
+ The default solution style is shown below; note, however, that this
+ document is compiled with the \option{solution} option passed to
+ \bps; without it, the typeset solution is entirely blank.
+\end{example}
+\begin{LTXexample}
+\begin{solution}
+ Some solution here\dots
+\end{solution}
+\end{LTXexample}
\begin{desc}
|\Th[<column spec>]{<header text>}|
\end{desc}
Typesets a table header in bold-face. |<column spec>| defaults to |l|.
-Useful for when a column is wrapped in a math environment.
+Useful for when a column is wrapped in a math environment; if you have a
+column |>>{\ttfamily}l|, using |\Th| will not print the header in
+|\ttfamily|.
+
+\begin{LTXexample}
+\begin{tabular}{ll}
+\Th{Server} & \Th{\textsc{ip}} \\
+juice & 1.1.1.1 \\
+dogs & 2.2.2.2 \\
+\end{tabular}
+\end{LTXexample}
\begin{desc}
|\begin{pseudocode}[<keywords>]...\end{pseudocode}|
@@ -280,7 +438,7 @@ Prints pseudocode.\footnote{Designed for \cosi{21a} as taught by Dr.\
Antonella DiLillo}
Several ``shortcuts,'' which replace a source-code sequence like
-\texttt{->} with a symbol like $\rightarrow$, are shown in
+\texttt{->} with a symbol like \texttt{→}, are shown in
table~\ref{tab:pseudocode}.
These shortcuts display in |\pseudocodesymbolfont| (default:
@@ -290,53 +448,50 @@ you use the \option{antonella} option with \fontspecok, \bps\ will load
\ctan{lm-math} and display the symbols seen in table~\ref{tab:pseudocode},
which look significantly better with Courier than \ctan{stix}' symbols.
+The following words are treated as keywords in pseudocode, and will be
+bolded as appropriate: |Input|, |Output|, |Complexity|, |while|, |do|,
+|return|, |for|, |to|, |if|, |then|, |else|, |True|, |False|, |None|, |and|,
+|or|, |nil|, and |len|.
+
\begin{table}[h]
\centering
\caption{Shortcuts provided by the \texttt{pseudocode}
environment}%
\label{tab:pseudocode}
- \begin{tabular}{lll}
- \Th{Input} & \Th{Display} & \Th{Codepoint} \\
- \ttfamily <- & $\leftarrow$ & U+2190 \\
- \ttfamily -> & $\rightarrow$ & U+2192 \\
- \ttfamily (/) & $\emptyset$ & U+2205 \\
- \ttfamily inf & $\infty$ & U+221E \\
- \ttfamily != & $\ne$ & U+2260 \\
- \ttfamily >= & $\ge$ & U+2265 \\
- \ttfamily <= & $\le$ & U+2264 \\
+ \begin{tabular}{llll}
+ \Th{Input} & \Th{Command} & \Th{Display} & \Th{Codepoint} \\
+ \ttfamily <- & |\pseudocodeleftarrow| & \pseudocodeleftarrow & \unicode{2190} \\
+ \ttfamily -> & |\pseudocoderightarrow| & \pseudocoderightarrow & \unicode{2192} \\
+ \ttfamily (/) & |\pseudocodeemptyset| & \pseudocodeemptyset & \unicode{2205} \\
+ \ttfamily inf & |\pseudocodeinfty| & \pseudocodeinfty & \unicode{221e} \\
+ \ttfamily != & |\pseudocodene| & \pseudocodene & \unicode{2260} \\
+ \ttfamily >= & |\pseudocodege| & \pseudocodege & \unicode{2265} \\
+ \ttfamily <= & |\pseudocodele| & \pseudocodele & \unicode{2264} \\
\end{tabular}
\end{table}
-\begin{todo}
- Improve the font selection mechanism; maybe provide a command for
- each symbol?
-\end{todo}
-
-\begin{todo}
- If your \TeX\ engine doesn't support \textsc{utf}-8 input, the
- shortcuts might appear totally blank or garbled. Good luck! It will
- surely work with \fontspecok.
-\end{todo}
-
-\begin{latexcode}
-% the optional [Bar] makes [Bar] bold like the other keywords
+\begin{example}
+ Note how the option |[Bar]| argument makes |Bar| appear bold like
+ any other keyword in the typeset listing.
+\end{example}
+\begin{LTXexample}[rframe=]
\begin{pseudocode}[Bar]
Bar(a, n)
Input: two integers, a and n
Output: a^n
- k <- n # k is a counter
- b <- 1
+ k <- n # k is a counter
+ b <- inf
c <- a
- while k > 0 do
+ while k >= 0 do
if k mod 2 = 0 then
- k <- k/2
+ k <- k / 2
c <- c * c
else
k <- k - 1
b <- b * c
return b
\end{pseudocode}
-\end{latexcode}
+\end{LTXexample}
\begin{desc}
|\begin{assembly}[<listings options>]...\end{assembly}|
@@ -350,23 +505,27 @@ instructions are treated as keywords and styled appropriately.
|<listings options>| is passed directly to the \ctan{listings} package.
-\begin{latexcode}
+\begin{LTXexample}[rframe=, wide,
+ explpreset={basicstyle=\small\ttfamily, basewidth=0.575em,},
+ preset=\lstset{numbers=left, basicstyle=\small\ttfamily, basewidth=0.575em,},]
\begin{assembly}
- LOAD R4, $200 ; sum addr
- LOAD R1, =0 ; sum
- LOAD R2, =0 ; i
- LOAD R3, =0 ; j
- BR OUTER ; we know i < 10
-INNER: ADD R1, R3 ; sum += j
- INC R3 ; j++
-OUTER: BLT R3, R2, INNER ; while j < i goto inner
- INC R2 ; i++
- LOAD R3, =0 ; j = 0
- BLT R2, =10, OUTER ; while i < 10
- STORE R1, @R4 ; store sum into sum address
- HALT
+LOAD R4, $200 ; sum addr
+LOAD R1, =0 ; sum
+LOAD R2, =0 ; i
+LOAD R3, =0 ; j
+BR OUTER ; we know i < 10
+INNER:
+ADD R1, R3 ; sum += j
+INC R3 ; j++
+OUTER:
+BLT R3, R2, INNER ; while j < i goto inner
+INC R2 ; i++
+LOAD R3, =0 ; j = 0
+BLT R2, =10, OUTER ; while i < 10 goto outer
+STORE R1, @R4 ; store sum
+HALT
\end{assembly}
-\end{latexcode}
+\end{LTXexample}
\begin{desc}
|\begin{java}[<listings options>]...\end{java}|
@@ -407,13 +566,19 @@ active process (i.e.\ a process burst).
\end{desc}
Draw a burst for process |<pid>| of time length |<burst length>|.
+\begin{note}
+ The Gantt chart packages (notably \ctan{tikz}) don't play nicely
+ with \ctan{ltxguidex}, the package this documentation is written in;
+ for a typeset example, see section~\ref{sec:example}.
+\end{note}
+
\begin{latexcode}
\begin{ganttschedule}{19}
- \burst{2}{1}
- \burst{4}{1}
- \burst{3}{2}
- \burst{5}{5}
- \burst{1}{10}
+ \pid{2}{1}
+ \pid{4}{1}
+ \pid{3}{2}
+ \pid{5}{5}
+ \pid{1}{10}
\end{ganttschedule}
\end{latexcode}
@@ -422,7 +587,7 @@ Draw a burst for process |<pid>| of time length |<burst length>|.
\ctan{calc}, it can add significantly to document compile times. If
you intend to use the |ganttschedule| environment, make sure to use
the \option{gantt} class option or set \option{gantt} in
- |\problemsetsetup|. If you fail to include the \option{gantt}
+ |\bpsset|. If you fail to include the \option{gantt}
option, you will see an error message:
\begin{latexcode}
@@ -441,6 +606,26 @@ Did you mean to use the 'gantt' option for the brandeis-problemset document clas
\subsection{General formatting commands}
\begin{desc}
+|\newacronym[<command>]{<acronym text>}|\\
+|\newacronyms{<acronym list>}|
+\end{desc}
+
+Creates a new acronym. If |<command>| isn't given, the text of the macro
+will be used instead; |\newacronym{cfg}| would define a command |\cfg| which
+typesets as ``\ac{cfg}''. If the
+resulting command already exists, it will be redefined. For |\newacronyms|, the
+|<acronym list>| is a comma-delimited list of acronyms.
+
+\begin{LTXexample}
+\newacronym[\xyz]{cfg}
+A \xyz\ describes a context-free language\dots
+
+\newacronyms{sparc, cpu}
+The \sparc\ had a unique \cpu\dots
+\end{LTXexample}
+
+
+\begin{desc}
|\ac{<acronym>}|
\end{desc}
Typesets an acronym. The |<acronym>| should be lowercase (e.g.\ |\ac{cpu}|
@@ -463,6 +648,13 @@ An abbreviation for |\textit|.
\begin{desc}|\Tt{<text>}|\end{desc}
An abbreviation for |\texttt|.
+\section{A class and a package}
+As a user, you'll likely only need the \bps\ document class. However,
+a \emph{package} named \bps\ is also provided. The class styles an entire
+document, while the package only provides commands. This allows --- for
+example --- loading the package for the examples in this document without
+messing up our titles, headers, and so on.
+
\section{Example}\label{sec:example}
A brief example usage of \bps\ follows. For a longer, more in-depth example,
@@ -473,7 +665,7 @@ in the \bps\ repository.}
\begin{latexcode}
\documentclass[gantt]{brandeis-problemset}
\author{Rebecca Turner}
-\problemsetsetup{
+\bpsset{
coursenumber=21a,
instructor=Dr.\ Liuba Shrira,
duedate=2018-10-20,
@@ -531,16 +723,59 @@ $\Rm{Foo}(a, n)$ computes $a^n$, and will run in $O(n)$ time always.
\end{problem}
\begin{ganttschedule}{19}
- \burst{2}{1}
- \burst{4}{1}
- \burst{3}{2}
- \burst{5}{5}
- \burst{1}{10}
+ \pid{2}{1}
+ \pid{4}{1}
+ \pid{3}{2}
+ \pid{5}{5}
+ \pid{1}{10}
\end{ganttschedule}
\end{document}
\end{latexcode}
\begin{changelog}[author=Rebecca Turner]
+\begin{version}[v=Coming soon\dots]
+\added
+ \item Support for \cosi{130b}, including regular expressions and
+ context-free grammars.
+\end{version}
+
+\begin{version}[v=0.5.0, date=2019-03-06]
+\added
+ \item |\newacronym| and |\newacronyms| commands.
+ \item Added \option{toc} option to the |problem| and |subproblem|
+ environments.
+\changed
+ \item Cleaned up internals; improved option system, split \bps\ into
+ a class and a package, renamed commands and lengths to use the
+ |bps@| prefix more consistently.
+ \item \bps\ now has a modular and much more conservative approach;
+ far fewer packages are loaded and features are loaded only upon
+ request to a much greater extent.
+ \item |subproblem| is now an environment, not a command, with an
+ interface matching the |problem| environment.
+ \item The \option{assembly} and \option{pseudocode} options now
+ define languages for the \ctan{listings} package, rather than just
+ providing environments to use the languages.
+\removed
+ \item The following commands have been removed in favor of the
+ |\bpsset| command, which encompasses their functionality
+ entirely:
+ |\duedate{<date>}|,
+ |\instructor{<name>}|,
+ |\course{<name>}|,
+ |\coursenumber{<number>}|,
+ |\assignment{<name>}|, and
+ |\problemsetnumber{<number>}|.
+ \item Removed dependencies: \ctan{environ} and \ctan{titlesec}. No
+ longer unconditionally loaded: \ctan{hyperref},
+ \ctan{xcolor}, \ctan{comment}, \ctan{listings},
+ \ctan{multirow}, \ctan{booktabs}, \ctan{longtable},
+ \ctan{tabu}.
+\deprecated
+ \item The |\problemsetsetup| command, which has been renamed
+ |\bpsset|.
+\end{version}
+
\begin{version}[v=0.4.4, date=2019-02-14]
\changed
\item Changed Times body copy font from \ctan{tex-gyre}'s Termes to
diff --git a/Master/texmf-dist/doc/latex/brandeis-problemset/example.pdf b/Master/texmf-dist/doc/latex/brandeis-problemset/example.pdf
index 4a3c0913b6f..fda3fa7ad81 100644
--- a/Master/texmf-dist/doc/latex/brandeis-problemset/example.pdf
+++ b/Master/texmf-dist/doc/latex/brandeis-problemset/example.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/brandeis-problemset/example.tex b/Master/texmf-dist/doc/latex/brandeis-problemset/example.tex
index 820da555ef2..4391fa2a38e 100644
--- a/Master/texmf-dist/doc/latex/brandeis-problemset/example.tex
+++ b/Master/texmf-dist/doc/latex/brandeis-problemset/example.tex
@@ -1,23 +1,39 @@
-\documentclass[gantt, scheme]{brandeis-problemset}
-\author{Rebecca Turner}
-\problemsetsetup{
+\documentclass[
+ gantt,
+ scheme,
+ assembly,
+ math,
+ pseudocode,
+ tabu
+]{brandeis-problemset}
+\bpsset{
coursenumber=21a,
+ author=Rebecca Turner,
instructor=Dr.\ Liuba Shrira,
duedate=2018-10-20,
number=3,
}
-\newcommand{\io}{\ac{io}}
-\newcommand{\cpu}{\ac{cpu}}
+\newacronyms{io, cpu}
\begin{document}
-
\maketitle
-\Bf{Note:} This example document is provided for illustrative purposes. The
-solutions below are not guaranteed to be correct, complete, or relevant.
+\Bf{Note:} This example document is provided to demonstrate the capability
+and visual style of the
+\href{https://ctan.org/pkg/brandeis-problemset}{\Tt{brandeis-problemset}}
+document class. The solutions below are not guaranteed to be correct,
+complete, or relevant.
+
+The source code for this document is available at
+\begin{quote}
+ \href{http://mirrors.ctan.org/macros/latex/contrib/brandeis-problemset/example.tex}{\Tt{/macros/latex/contrib/brandeis-problemset/example.tex}}
+\end{quote}
+on \href{https://ctan.org/}{\textsc{ctan}} (or, if you have
+\Tt{brandeis-problemset} installed, in your \TeX\ distribution's
+documentation directory).
\tableofcontents
-\begin{problem}[part]
+\begin{problem}[part=Textbook problems]
An assembly language program implements the following loop:
\begin{lstlisting}[language=c]
@@ -104,7 +120,8 @@ LOOP: STORE R2, @R1 ; *A = i
An example equation which defines $e$:
\begin{equation}
- \exists! e \in \Re \left(\int_1^e \frac{1}{t} dt = 1\right).
+ \exists! e \in \Re \text{ such that }
+ \int_1^e \frac{1}{t} dt = 1.
\end{equation}
The definition of the Mandelbrot set:
diff --git a/Master/texmf-dist/tex/latex/brandeis-problemset/brandeis-problemset.cls b/Master/texmf-dist/tex/latex/brandeis-problemset/brandeis-problemset.cls
index 395c44e6458..3e0aaa87608 100644
--- a/Master/texmf-dist/tex/latex/brandeis-problemset/brandeis-problemset.cls
+++ b/Master/texmf-dist/tex/latex/brandeis-problemset/brandeis-problemset.cls
@@ -1,4 +1,6 @@
-\ProvidesClass{brandeis-problemset}[2019/02/14 0.4.4 COSI Problem sets at Brandeis University]
+\ProvidesClass{brandeis-problemset}[2019/03/06 0.5.0 COSI problem sets at
+ Brandeis University]
+\NeedsTeXFormat{LaTeX2e}
% Description: A document class for Brandeis University's computer science
% courses' problem sets
% Homepage: https://github.com/9999years/brandeis-problemset
@@ -8,87 +10,91 @@
% Copyright 2019 Rebecca Turner
%
% This work may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3
+% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
-% and version 1.3 or later is part of all distributions of LaTeX
+% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
-% This work has the LPPL maintenance status `maintained'.
+% This work has the LPPL maintenance status `maintained'. On 2021-05-01 (May
+% 1st), this work will have the LPPL maintenance status `unmaintained'.
%
% The Current Maintainer of this work is Rebecca Turner.
-\errorcontextlines 10
-
-\PassOptionsToClass{12pt}{article}
-\LoadClass{article}
-
\RequirePackage{xparse}
+\RequirePackage{kvoptions}
-\newif\iffontspec@ok
-\fontspec@okfalse
-\ExplSyntaxOn
-\sys_if_engine_luatex:T
-{
- \fontspec@oktrue
+\SetupKeyvalOptions{
+ family=bps,
+ prefix=bps@,
}
-\sys_if_engine_xetex:T
-{
- \fontspec@oktrue
+
+% passes an option to rebeccastyle
+\newcommand{\bps@passoption}[1]
+ {\DeclareVoidOption{#1}{%
+ \PassOptionsToPackage{\CurrentOption}{brandeis-problemset}%
+ }}
+
+% pass a comma-list of options
+\NewDocumentCommand{\bps@passoptions}{>{\SplitList{,}} m}
+ {\ProcessList{#1}{\bps@passoption}}
+
+\bps@passoptions{
+ scheme, noscheme,
+ pseudocode, nopseudocode,
+ assembly, noassembly,
+ gantt, nogantt,
+ solution, nosolution,
+ tabu, notabu,
+ maketitle, nomaketitle,
+ header, noheader,
+ listings, nolistings,
+ config, noconfig,
}
-\ExplSyntaxOff
-% pages
-\PassOptionsToPackage{
- letterpaper,
- margin=1.25in,
- tmargin=1.5in,
- bmargin=1.5in,
-}{geometry}
+\NewDocumentCommand{\bps@comploption}{O{false} m}{%
+ \DeclareBoolOption[#1]{#2}%
+ \DeclareComplementaryOption{no#2}{#2}}
-\PassOptionsToPackage{
- warnings-off={mathtools-colon,mathtools-overbracket}
-}{unicode-math}
+\bps@comploption{antonella}
+\bps@comploption{math}
-% utility
-\RequirePackage{xkeyval}
-\RequirePackage{environ}
-\RequirePackage{geometry}
-\RequirePackage{changepage} % for adjustwidth env
+\DeclareDefaultOption{\PassOptionsToClass{\CurrentOption}{article}}
+\ProcessKeyvalOptions*
-% formatting
-\RequirePackage{hyperref}
-\RequirePackage{xcolor}
-\RequirePackage{comment}
-\RequirePackage{listings}
-\RequirePackage{fancyhdr}
-\RequirePackage{enumitem}
-\RequirePackage{titlesec}
-\RequirePackage{titletoc}
+\let\bps@comploption\relax
+\let\bps@passoption\relax
+\let\bps@passoptions\relax
+
+\LoadClass[12pt]{article}
+
+\RequirePackage[
+ maketitle,
+ header,
+ listings,
+]{brandeis-problemset}
% tables
-\RequirePackage{multirow}
-\RequirePackage{booktabs}
-\RequirePackage{longtable}
-\RequirePackage{tabu}
+\ifbps@tabu
+ \RequirePackage{multirow}
+ \RequirePackage{booktabs}
+ \RequirePackage{longtable}
+ \RequirePackage{tabu}
+\fi
-% package options
-\RequirePackage{kvoptions}
-\SetupKeyvalOptions{
- family=problemset,
- prefix=problemset@,
-}
-\DeclareBoolOption{antonella}
-\DeclareBoolOption{scheme}
-\DeclareBoolOption{gantt}
-\DeclareBoolOption{solutions}
-\ProcessKeyvalOptions*
+% formatting
+\RequirePackage{enumitem}
+\RequirePackage{titletoc}
-\newif\ifpseudocode@loaded
-\newif\ifpseudocode@unicode
-% pseudocode commands
-\let\pseudocodesymbolfont\ttfamily
+% utility
+\RequirePackage{hyperref}
+\RequirePackage[
+ letterpaper,
+ margin=1.25in,
+ tmargin=1.5in,
+ bmargin=1.5in,
+]{geometry}
% fonts
% NOTE: The order these packages are loaded in is very important.
@@ -99,9 +105,15 @@
% just load the stix2 fonts without the stix2 package itself, so we load
% amsmath before unicode-math (and the stix2 fonts)
\iffontspec@ok
- \RequirePackage{amsmath}[2013/01/14]
- % unicode-math makes equations copy/pastable in pdf output
- \RequirePackage{unicode-math}
+ \ifbps@math
+ \RequirePackage{amsmath}[2013/01/14]
+ % unicode-math makes equations copy/pastable in pdf output
+ \RequirePackage[
+ warnings-off={mathtools-colon,mathtools-overbracket}
+ ]{unicode-math}
+ \else
+ \RequirePackage{fontspec}
+ \fi
\setmainfont[
Extension = .otf,
UprightFont = *-Regular,
@@ -109,234 +121,47 @@
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic,
]{STIX2Text}
- \setmathfont[
- Extension = .otf,
- StylisticSet={
- 1, % better caligraphic forms
- 8, % upright integrals
- },
- ]{STIX2Math}
+ \ifbps@math
+ \setmathfont[
+ Extension = .otf,
+ StylisticSet={
+ 1, % better caligraphic forms
+ 8, % upright integrals
+ },
+ ]{STIX2Math}
+ \fi
+ \newcommand{\setcodefont}[2][]{%
+ % don't fail if fontspec isn't loaded
+ \@ifundefined{setmonofont}{}{%
+ \let\pseudocodesymbolfont\ttfamily
+ \setmonofont[#1]{#2}%
+ }%
+ }
\else
- \RequirePackage[upint]{stix2}
- \RequirePackage{amsmath}[2013/01/14]
+ \ifbps@math
+ \RequirePackage[upint]{stix2}
+ \RequirePackage{amsmath}[2013/01/14]
+ \fi
\fi
% math
-\RequirePackage{mathtools}
-
-% for whatever reason, redefining this here has no effect
-\AtBeginDocument{\renewcommand{\Re}{\mathbb{R}}}
+\ifbps@math
+ \RequirePackage{mathtools}
-\ifproblemset@scheme
- % Language definition by Rebecca Turner and Andreas Stuhlmüller.
- \lstdefinelanguage[R5RS]{Scheme}{
- morekeywords={*,/,<=,<,=>,=,>=,>,+,-,%
- % ``These procedures are compositions of car and cdr \dots\
- % Arbitrary compositions, up to four deep, are provided. There are
- % twenty-eight of these procedures in all.'' (6.3.2)
- car,cbr,caar,cabr,cbar,cbbr,caaar,caabr,cabar,cabbr,cbaar,%
- cbabr,cbbar,cbbbr,caaaar,caaabr,caabar,caabbr,cabaar,cababr,%
- cabbar,cabbbr,cbaaar,cbaabr,cbabar,cbabbr,cbbaar,cbbabr,cbbbar,%
- cbbbbr,%
- % Define the rest of the primitives, from R5RS'
- % \href{https://schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-15.html#%_chap_Temp_11}{``Alphabetic
- % Index of Definitions of Concepts, Keywords, and Procedures''}
- abs,acos,and,angle,append,apply,asin,assoc,%
- assq,assv,atan,begin,boolean?,%
- call-with-current-continuation,call-with-input-file,%
- call-with-output-file,call-with-values,case,%
- ceiling,char->integer,char-alphabetic?,char-ci<=?,char-ci<?,%
- char-ci=?,char-ci>=?,char-ci>?,char-downcase,char-lower-case?,%
- char-numeric?,char-ready?,char-upcase,char-upper-case?,%
- char-whitespace?,char<=?,char<?,char=?,char>=?,char>?,char?,%
- close-input-port,close-output-port,complex?,cond,cons,cos,%
- current-input-port,current-output-port,define,define-syntax,delay,%
- denominator,display,do,dynamic-wind,else,eof-object?,eq?,%
- equal?,eqv?,eval,even?,exact->inexact,exact?,exp,expt,floor,%
- for-each,force,gcd,if,imag-part,inexact->exact,inexact?,%
- input-port?,integer->char,integer?,interaction-environment,lambda,%
- lcm,length,let,let*,let-syntax,letrec,letrec-syntax,list,%
- list->string,list->vector,list-ref,list-tail,list?,load,log,%
- magnitude,make-polar,make-rectangular,make-string,make-vector,%
- map,max,member,memq,memv,min,modulo,negative?,newline,not,%
- null-environment,null?,number->string,number?,numerator,odd?,%
- open-input-file,open-output-file,or,output-port?,pair?,peek-char,%
- port?,positive?,procedure?,quasiquote,quote,quotient,rational?,%
- rationalize,read,read-char,real-part,real?,remainder,reverse,%
- round,scheme-report-environment,set!,set-car!,set-cdr!,setcar,%
- sin,sqrt,string,string->list,string->number,string->symbol,%
- string-append,string-ci<=?,string-ci<?,string-ci=?,string-ci>=?,%
- string-ci>?,string-copy,string-fill!,string-length,string-ref,%
- string-set!,string<=?,string<?,string=?,string>=?,string>?,%
- string?,substring,symbol->string,symbol?,syntax-rules,tan,%
- transcript-off,transcript-on,truncate,values,vector,vector->list,%
- vector-fill!,vector-length,vector-ref,vector-set!,vector?,%
- with-input-from-file,with-output-to-file,write,write-char,zero?},
- otherkeywords={\#b,\#o,\#d,\#x,\#e,\#i,\#t,\#f,%
- ',`,{,},\,\@,...},
- alsoletter={!\$\%&*/:<=>?@^_~+-},
- alsodigit={.},
- sensitive=true,
- morecomment=[l]{;},
- morecomment=[s]{\#|}{|\#},
- morestring=[b]",
- upquote=true,
- literate=*{`}{{`}}{1}
- }[keywords,comments,strings]
- \lstset{
- defaultdialect=[R5RS]Scheme
- }
- \lstnewenvironment{scheme}[1][]
- {\lstset{language=Scheme, #1}}
- {}
+ % for whatever reason, redefining this before the \begin{document}
+ % has no effect
+ \AtBeginDocument{\renewcommand{\Re}{\mathbb{R}}}
\fi
-\newcommand{\@antonella}{%
- \ifproblemset@antonella
- \instructor{Dr.\ Antonella DiLillio}
- \iffontspec@ok
- \setmonofont{Courier New}%
- \else
- \RequirePackage{couriers}% package courier-scaled
- \fi
- \fi
-}
-\AtBeginDocument{\@antonella}
-
-% lazily loads pseudocode environment
-\newcommand{\ensure@pseudocode}{%
- \ifpseudocode@loaded
- \else
- \iffontspec@ok
- % use unicode shortcuts
- \ProvideDocumentCommand{\pseudocodeleftarrow} {}{\pseudocodesymbolfont ←}
- \ProvideDocumentCommand{\pseudocoderightarrow}{}{\pseudocodesymbolfont →}
- \ProvideDocumentCommand{\pseudocodele} {}{\pseudocodesymbolfont ≤}
- \ProvideDocumentCommand{\pseudocodege} {}{\pseudocodesymbolfont ≥}
- \ProvideDocumentCommand{\pseudocodeemptyset} {}{\pseudocodesymbolfont ∅}
- \ProvideDocumentCommand{\pseudocodene} {}{\pseudocodesymbolfont ≠}
- \ProvideDocumentCommand{\pseudocodeinfty} {}{\pseudocodesymbolfont ∞}
- \let\lmmath\undefined% ensure no '\lmmath already defined' errors
- \newfontface{\lmmath}{latinmodern-math.otf}%
- \let\pseudocodesymbolfont\lmmath
- \else
- % use math-mode fallbacks
- \ProvideDocumentCommand{\pseudocodeleftarrow} {}{\ensuremath{\leftarrow}}
- \ProvideDocumentCommand{\pseudocoderightarrow}{}{\ensuremath{\rightarrow}}
- \ProvideDocumentCommand{\pseudocodele} {}{\ensuremath{\le}}
- \ProvideDocumentCommand{\pseudocodege} {}{\ensuremath{\ge}}
- \ProvideDocumentCommand{\pseudocodeemptyset} {}{\ensuremath{\emptyset}}
- \ProvideDocumentCommand{\pseudocodene} {}{\ensuremath{\ne}}
- \ProvideDocumentCommand{\pseudocodeinfty} {}{\ensuremath{\infty}}
- \fi
- \pseudocode@loadedtrue
- \fi
-}
-
-% loads the ganttschedule environment dependencies
-\newif\ifgantt@loaded
-\newcommand{\ensure@gantt}
- {\ifgantt@loaded
+\ifbps@antonella
+ \instructor{Dr.~Antonella DiLillio}
+ \iffontspec@ok
+ \setmonofont{Courier New}%
\else
- \RequirePackage{tikz}
- \RequirePackage{fp}
- \RequirePackage{calc}
- \newcounter{@gantt@time}
- \newcounter{gantt@time@after}
- \newlength{\gantt@unit}
- \gantt@loadedtrue
- \fi}
-\newcommand{\@loadgantt}
- {\ifproblemset@gantt
- \ensure@gantt
- \fi}
-% if 'gantt' package option was given
-\@loadgantt
-
-\newcommand{\problemset@course}{\relax}
-\newcommand{\problemset@assignment}{\relax}
-% config commands
-\newcommand{\duedate}[1] {\def\problemset@duedate{#1}}
-\newcommand{\instructor}[1] {\def\problemset@instructor{#1}}
-\newcommand{\course}[1] {\def\problemset@course{#1}}
-\newcommand{\coursenumber}[1] {\def\problemset@course{\Sc{cosi} #1}}
-\newcommand{\assignment}[1] {\def\problemset@assignment{#1}}
-\newcommand{\problemsetnumber}[1]{\def\problemset@assignment{Problem Set #1}}
-\newcommand{\setcodefont}[2][]{%
- % don't fail if fontspec isn't loaded
- \ifx\setmonofont\undefined\else
- \let\pseudocodesymbolfont\texttt
- \setmonofont[#1]{#2}%
- \fi
-}
-
-\define@cmdkeys{problemset}[problemset@]{duedate, instructor, course, assignment}
-\define@key{problemset}{number}{\problemsetnumber{#1}}
-\define@key{problemset}{coursenumber}{\coursenumber{#1}}
-\define@key{problemset}{author}{\author{#1}}
-\define@key{problemset}{date}{\date{#1}}
-\define@key{problemset}{codefont}{%
- \setcodefont{#1}
-}
-\define@boolkey{problemset}{antonella}[true]{}
-\define@boolkey{problemset}{solutions}[true]{}
-\define@boolkey{problemset}{gantt}[true]{\@loadgantt}
-% carry values from package options over
-\newcommand{\@carryclasskey}[1]{%
- \csname ifproblemset@#1\endcsname
- \presetkeys{problemset}{#1}{}
+ \RequirePackage{couriers}% package courier-scaled
\fi
-}
-\@carryclasskey{antonella}
-\@carryclasskey{solutions}
-\@carryclasskey{gantt}
-\newcommand{\problemsetsetup}[1]{\setkeys{problemset}{#1}}
-
-% listings
-\lstset{
- basicstyle=\ttfamily,
- numbers=left,
- numberstyle=\color{gray}\ttfamily,
- aboveskip=1em,
- belowskip=0.5em,
- breaklines,
- breakatwhitespace=true,
- tabsize=4,
- keywordstyle={\bf\ttfamily\color[rgb]{0,.3,.7}},
- commentstyle={\color[rgb]{0.133,0.545,0.133}},
- stringstyle={\color[rgb]{0.75,0.49,0.07}},
-}
-
-\lstnewenvironment{assembly}[1][]
- {\lstset{
- keywords={LOAD,STORE,ADD,SUB,MUL,DIV,INC,SKIP,BR,BLT,BGT,BLEQ,BGEQ,
- BEQ,BNEQ,READ,WRITE,HALT},
- firstnumber=-3,
- numberstyle={\color{gray}\ttfamily\addtocounter{lstnumber}{3}x +\ },
- morecomment=[l]{;},
- #1
- }}{}
-
-\lstnewenvironment{pseudocode}[1][]
- {\ensure@pseudocode
- \lstset{
- keywords={Input,Output,Complexity,while,do,return,for,to,if,then,else,True,False,None,and,or,nil,len},
- literate={<-}{{\pseudocodeleftarrow}}2
- {->} {{\pseudocoderightarrow}}2
- {(/)}{{\pseudocodeemptyset}}2
- {inf}{{\pseudocodeinfty}}3
- {!=} {{\pseudocodene}}2
- {>=} {{\pseudocodege}}2
- {<=} {{\pseudocodele}}2,
- morecomment=[l]{\#},
- morekeywords={#1},
-}}{}
-
-\lstnewenvironment{java}[1][]
- {\lstset{language=java, #1}}
- {}
+\fi
-\errorcontextlines 10
\widowpenalties 1 10000
\raggedbottom
\setlength{\parindent}{0em}
@@ -348,7 +173,6 @@
\let\Bf\textbf
\let\It\textit
\let\Tt\texttt
-\let\ac\textsc
\renewcommand{\labelitemi}{---}
\setlist[1]{
@@ -357,34 +181,9 @@
\setlist{
partopsep=0em,
topsep=0em,
- %bottomsep=1em,
leftmargin=2em,
}
-\NewExpandableDocumentCommand{\Th}{O{l} m}
- {\multicolumn{1}{#1}{\Bf{#2}}}
-
-% page headers
-\fancyhf{}
-\lhead{\@author
- \hfill
- \if\relax\problemset@assignment\else\problemset@assignment\fi
- \if\relax\problemset@duedate\else\ (due \problemset@duedate)\fi\hfill
- \if\relax\problemset@instructor\else\problemset@instructor\hfill\fi
- \thepage}
-\setlength{\headheight}{24pt}
-\fancypagestyle{plain}{\fancyhead[L]{}}
-\AtBeginDocument{\pagestyle{fancy}}
-
-% {command}[shape]{format}{label}{sep}{before}[after]
-\titleformat{\part}{\bfseries\Large}{Part \thepart}{1em}{}[]
-\titleformat{\section}{\bfseries\large}{}{0em}{}[]
-\titleformat{\subsection}{\llap{\thesubsection.}}{}{1em}{}[]
-% {command}{left}{before}{after}[right]
-\titlespacing{\part}{0em}{-0.25in}{0em}[0em]
-\titlespacing{\section}{0em}{1em}{0em}[0em]
-\titlespacing{\subsection}{0em}{1em}{0em}[0em]
-
\titlecontents{part}
[3.8em] % left
{\large\bfseries} % above-code
@@ -405,98 +204,10 @@
{}
[]
-\newlength{\problemindent}
-\setlength{\problemindent}{1in}
-
-\newcounter{problemnumber}
-\newcommand{\problem@title}{}
-\define@key{problem}{title}{\renewcommand{\problem@title}{: #1}}
-\define@boolkey{problem}{pagebreak}[true]{\ifKV@problem@pagebreak
- \vfill\pagebreak
- \else\fi}
-\define@cmdkeys{problem}{number, label, partlabel}
-\define@cmdkey{problem}{part}[]{%
- \part{\cmdKV@problem@part}%
- \@ifundefined{cmdKV@problem@partlabel}{}{%
- \expandafter\label{\cmdKV@problem@partlabel}%
- }%
-}
-\presetkeys{problem}{pagebreak}{}
-
-\NewDocumentEnvironment{problem}{O{}}{%
- \setkeys{problem}{#1}%
- \@ifundefined{cmdKV@problem@number}{%
- \stepcounter{problemnumber}%
- \newcommand{\cmdKV@problem@number}{\arabic{problemnumber}}%
- }{}%
- \section{Problem \cmdKV@problem@number\problem@title}%
- % fix up ref commands
- \edef\@currentlabel{\cmdKV@problem@number}%
- \edef\@currentlabelname{Problem \cmdKV@problem@number\problem@title}%
- \@ifundefined{cmdKV@problem@label}{}{%
- \expandafter\label{\cmdKV@problem@label}%
- }%
- \begin{adjustwidth}{\problemindent}{0pt}}
- {\end{adjustwidth}}
-
-\newcommand{\subproblem}[1][]{\subsection{#1}}
-
-\newcommand{\solutionstyle}{\color{blue}}
-\NewEnviron{solution}{%
- \solutionstyle%
- \ifproblemset@solutions\expandafter\BODY\fi}
-
-\newcommand{\maketitlepage}{\thispagestyle{empty}%
- \vspace*{2in}%
- \begin{center}%
- \Large\begin{tabular}{r|l}
- \if\relax\problemset@assignment\else assignment & \problemset@assignment \\\fi
- by & \@author \\
- \if\relax\problemset@course\else course & \problemset@course \\\fi
- \if\relax\problemset@instructor\else instructor & \problemset@instructor \\\fi
- \if\relax\problemset@duedate\else due & \problemset@duedate \\\fi
- \end{tabular}%
- \end{center}%
- \pagebreak}
-
-\renewcommand{\maketitle}{\thispagestyle{empty}%
- %\vspace*{2in}%
- \begin{center}%
- \large\begin{tabular}{r|l}
- \@ifundefined{problemset@assignment}{}{assignment & \problemset@assignment \\}
- by & \@author \\
- \@ifundefined{problemset@course}{}{course & \problemset@course \\}
- \@ifundefined{problemset@instructor}{}{instructor & \problemset@instructor \\}
- \@ifundefined{problemset@duedate}{}{due & \problemset@duedate \\}
- \end{tabular}%
- \end{center}%
- \vspace*{2em}%
- }
-
-\NewDocumentEnvironment{ganttschedule}{m o} % total size, title
- {\ifgantt@loaded
- \else
- \PackageError{brandeis-problemset}{ganttschedule enviornment
- not loaded in preamble}{Did you mean to use the 'gantt'
- option for the brandeis-problemset document class?}
- \fi
- \setlength{\gantt@unit}{\linewidth / \real{#1}}%
- \setcounter{@gantt@time}{0}%
- \DeclareDocumentCommand{\burst}{m m} % pid, burst
- {\setcounter{gantt@time@after}{\value{@gantt@time}}%
- \addtocounter{gantt@time@after}{##2}%
- \FPeval\gantthalf{(\arabic{@gantt@time}
- + \arabic{gantt@time@after}) / 2}%
-
- \draw (\value{@gantt@time}, 0) rectangle
- (\value{gantt@time@after}, 1);
- \node at (\gantthalf, 0.5) {$P_{##1}$};
- \draw [|<->|] (\value{@gantt@time} + 0.05, 1.25)
- -- node[above=1mm] {##2}
- (\value{gantt@time@after} - 0.05, 1.25);
-
- \setcounter{@gantt@time}{\value{gantt@time@after}}}%
-
- \IfValueT{#2}{\begin{center} #2 \end{center}}%
- \begin{tikzpicture}[x=\gantt@unit]}
- {\end{tikzpicture}}
+\titlecontents{subsection}
+ [5.8em]
+ {}
+ {\hspace*{-4.8em}\contentspage\hspace*{4.8em}\small}
+ {\hspace*{-3.3em}}
+ {}
+ []