├── ProbSheet.png ├── Q1_Boat.pdf ├── SolSheet.png ├── uob_logo.pdf ├── TsangPS_Example.pdf ├── TsangPS_Example_sheet.pdf ├── .gitignore ├── TsangPS.cls ├── TsangPS_Example.tex ├── README.md └── TsangPS.sty /ProbSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/ProbSheet.png -------------------------------------------------------------------------------- /Q1_Boat.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/Q1_Boat.pdf -------------------------------------------------------------------------------- /SolSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/SolSheet.png -------------------------------------------------------------------------------- /uob_logo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/uob_logo.pdf -------------------------------------------------------------------------------- /TsangPS_Example.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/TsangPS_Example.pdf -------------------------------------------------------------------------------- /TsangPS_Example_sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davtsang/TsangPS/HEAD/TsangPS_Example_sheet.pdf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.idx 3 | *.log 4 | *.out 5 | *.gz 6 | .DS_Store 7 | *.toc 8 | *~ 9 | .ipynb_checkpoints 10 | .pyc -------------------------------------------------------------------------------- /TsangPS.cls: -------------------------------------------------------------------------------- 1 | \NeedsTeXFormat{LaTeX2e} 2 | \ProvidesClass{TsangPS}[2018/08/23 Tsang Problem Set v 1.0] 3 | \DeclareOption{problemsheet}{\def\problemsheet{}} 4 | \DeclareOption{solutions}{\let\problemsheet\undefined} 5 | \DeclareOption{FlipAns}{\def\flipanswer{}} 6 | 7 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{tufte-handout}} 8 | \ProcessOptions\relax 9 | 10 | %% Base class is the tufte-handout 11 | \LoadClass{tufte-handout} 12 | 13 | %% 14 | % Load all the problem set formatting 15 | \RequirePackage{TsangPS} 16 | 17 | 18 | 19 | \endinput 20 | -------------------------------------------------------------------------------- /TsangPS_Example.tex: -------------------------------------------------------------------------------- 1 | %\documentclass[a4paper, openany, problemsheet, FlipAns]{TsangPS} 2 | % Above option for problemsheet 3 | % Below solutions option for full solutions 4 | \documentclass[a4paper, openany, solutions, FlipAns]{TsangPS} 5 | 6 | 7 | \unittitle{Vibrations, Waves, and Optics} 8 | \unitcode{PHYS10005/53} 9 | \lecturer{D. Tsang \& A. Narduzzo} 10 | \setnumber{2} 11 | \logo[-0.5cm]{uob_logo.pdf} 12 | \semester{Semester I --- 2018/2019} 13 | \date{Due: 15 Oct 2018}% to remove date just set \date{} 14 | \begin{document} 15 | \maketitle 16 | 17 | \begin{question}{The H.M.S. S.H.M.}{2}{1}{0} 18 | \newq{A boat at anchor bobs} up and down with the waves. The boat moves 5 cm above and 5 cm below its equilibrium position, and makes one complete up-and-down cycle every 4 s. What are the amplitude, period, frequency, and angular frequency of the motion? 19 | 20 | \solution{ 21 | The amplitude is $\boxed{A = 5\,{\rm cm}}$, and the period is $\boxed{T=4\,{\rm s}}$. 22 | \marginnote{\includegraphics{Q1_Boat.pdf}} 23 | The frequency and angular frequency are given by 24 | \begin{align*} 25 | \Aboxed{f &= \frac{1}{T} = \frac{1}{4\, {\rm s}} = 0.25\, {\rm Hz}}\\ 26 | \Aboxed{\omega &= 2\pi \times f = 2\pi \times 0.25\, {\rm Hz} = 1.57\, {\rm rad}/{\rm s}} 27 | \qed 28 | \end{align*} 29 | }{5 cm, 4 s, 0.25 Hz, 1.57 rad/s} 30 | \end{question} 31 | 32 | \makeline 33 | 34 | \end{document} -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TsangPS 2 | 3 | # Dave's Problem Set LaTeX Class TsangPS v 1.0 4 | 18/08/22 - D.Tsang@soton.ac.uk 5 | David Tsang, University of Southampton/University of Bath 6 | 7 | Problem Sheet and Solution Set Template for LaTeX. 8 | Built on the tufte-handout class. 9 | 10 | To install: Place the files "TsangPS.cls" and "TsangPS.sty" in your local LaTeX directory 11 | you can then call the document class using: 12 | 13 | \documentclass[options...]{TsangPS} 14 | 15 | (See also Dave's Skeletal Course Notes Template https://github.com/davtsang/TsangNotes) 16 | 17 | # Samples 18 | ![problem sheet example](ProbSheet.png "Problem Sheet Example") 19 | ![solution set example](SolSheet.png "Solution Set Example") 20 | 21 | 22 | 23 | # Class Options: 24 | 25 | solutions : shows full worked solutions, no checkboxes, 26 | 27 | problemsheet : only the problems with revision checkboxes in margin, short answers are shown in margin 28 | 29 | FlipAns : short answers for problem sheet are rotated by 180 degrees 30 | 31 | With no options set it defaults to the solutions behaviour. 32 | 33 | Alternatively you can use definitions before \documentclass to set command line 34 | multi-file options 35 | 36 | \def\problemsheet{} in order to set problemsheet 37 | 38 | \def\flipanswer{} in order to set FlipAns 39 | Note that the class options will override these defs if they conflict. 40 | 41 | All standard tufte-handout options are also passable, (i.e. for UK problem sets I use options "a4paper, openany") 42 | 43 | 44 | 45 | # Class Commands: 46 | 47 | \unittitle{TITLE} - sets the unit title i.e. Vibrations, Waves, and Optics 48 | 49 | \unitcode{CODE} - sets the unit code i.e. PHYS10005/53 50 | 51 | \lecturer is not currently included, but could be 52 | 53 | \setnumber{NUMBER} sets the problem set number in the title/headings 54 | 55 | \logo[offset]{PATH} sets the path to the logo file to load next to the title 56 | you can use the offset in length units (cm, pts etc) in order 57 | to shift the image up or down 58 | 59 | \semester{SEMESTER} sets the semester value, i.e. Semester I, 2018-2019 60 | 61 | You can use the command \SetAnswerFlip{true} in order to change to 62 | upside down answers, or \SetAnswerFlip{false} in order to change back 63 | 64 | \makeline makes a thin horizontal line that (using \cleaders) that is not drawn if it occurs at 65 | the beginning and end of the page 66 | 67 | # The question environment 68 | 69 | \begin{question}{TITLE}{TYPE}{DIFFICULTY}{EXAM} 70 | 71 | ... 72 | 73 | \solution{}{} 74 | 75 | \end{question} 76 | 77 | Use Problem counter to label the problems, adds in checkmarks for Tried, Correct, Revised in margin next to problem 78 | title. Problem heading of the form: 79 | 80 | Problem \theProblem: TITLE [type(TYPE), $\bigstar$...(, past exam)] 81 | 82 | where TYPE is 0-5 which specify: 83 | 84 | 0 : evaluation 85 | 86 | 1 : knowledge 87 | 88 | 2 : comprehension 89 | 90 | 3 : application 91 | 92 | 4 : analysis 93 | 94 | 5 : synthesis 95 | 96 | The Difficulty is 1-3, which specifies the number of $\bigstar$ symbols to indicate difficulty 97 | 98 | If the EXAM argument is set to 1, the past exam indicator will appear. 99 | 100 | 101 | # Solutions 102 | 103 | \solution{FULL SOL}{SHORT ANS} 104 | 105 | 106 | Solutions have second argument printed [Ans: SHORT ANS] (upside down if FlipAns is set) in the 107 | margin of the problem sheet 108 | and FULL SOL only shown in the solutions set (with textcolor set to blue). 109 | 110 | If no margin answers are wanted on the problem sheet just use an empty second argument, i.e., 111 | 112 | \solution{FULL SOL}{} 113 | 114 | Multipart questions are intended to have a \solution{}{} put in for each part within the enumerate \item{}, so that the short answer will appear in the correct location. 115 | 116 | 117 | # Boxes 118 | A TikZ box is available for long asides using 119 | 120 | 121 | 122 | \begin{mybox}[width=WIDTH]{TITLE} 123 | 124 | ... 125 | 126 | \end{mybox} 127 | 128 | -------------------------------------------------------------------------------- /TsangPS.sty: -------------------------------------------------------------------------------- 1 | % 2 | % Tsang Problem Set Class/Style TsangPS v 1.0 3 | % 18/08/22 - D.Tsang@soton.ac.uk 4 | % 5 | % Built on the tufte-handout class 6 | % Copied a few functions from Peter Sloan's notess class. 7 | % 8 | % Using TsangPS.cls and TsangPS.sty 9 | % you can call a document class 10 | % 11 | % \documentclass{TsangPS} 12 | % 13 | % with options: 14 | % solutions : shows full worked solutions, no checkboxes, 15 | % problemsheet : only the problems with revision checkboxes in margin, short answers are 16 | % shown in margin 17 | % FlipAns : short answers for problem sheet are rotated by 180 degrees 18 | % accessible : switch to all sans serif fonts 19 | % 20 | % Alternatively you can use definitions before \documentclass to set command line 21 | % multi-file options 22 | % 23 | % \def\problemsheet{} in order to set problemsheet 24 | % \def\flipanswer{} in order to set FlipAns 25 | % \def\accessible{} in order to set accessible options 26 | % 27 | % all standard tufte-handout options are also passable 28 | % 29 | % 30 | % 31 | % Class Commands: 32 | % \unittitle{TITLE} - sets the unit title i.e. Vibrations, Waves, and Optics 33 | % \unitcode{CODE} - sets the unit code i.e. PHYS10005/53 34 | % \lecturer is not currently included, but could be 35 | % \setnumber{NUMBER} sets the problem set number in the title/headings 36 | % \logo[offset]{PATH} sets the path to the logo file to load next to the title 37 | % you can use the offset in length units (cm, pts etc) in order to shift the image up 38 | % or down 39 | % \semester{SEMESTER} sets the semester value, i.e. Semester I, 2018-2019 40 | % 41 | % You can use the command \SetAnswerFlip{true} in order to change to 42 | % upside down answers, or \SetAnswerFlip{false} in order to change back 43 | % 44 | % The Question environment 45 | %\begin{question}{TITLE}{TYPE}{DIFFICULTY}{EXAM} 46 | %... 47 | %\solution{}{} 48 | %\end{question} 49 | % 50 | % Adds in checkmarks for Tried, Correct, Revised in margin next to problem 51 | % title 52 | 53 | % 54 | % a TikZ box is available for long asides using 55 | % \begin{mybox}[width=WIDTH]{TITLE} 56 | % ... 57 | % \end{mybox} 58 | % 59 | %\solution{FULL SOL}{SHORT ANS} 60 | % Solutions have second argument printed [Ans: #2] upside down in the 61 | % margin of the problem sheet 62 | % and #1 only shown in the solutions set. 63 | % if no margin answers are wanted on the problem sheet just use an empty second arg 64 | % 65 | % 66 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 67 | \ProvidesPackage{TsangPS}[2018/08/23 Tsang Problem Set Sheet and Solutions] 68 | 69 | 70 | 71 | 72 | 73 | \RequirePackage{graphicx} % allow embedded images 74 | \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio} 75 | \graphicspath{{graphics/}} % set of paths to search for images 76 | \RequirePackage{amsmath, amsthm, amssymb} % extended mathematics 77 | \RequirePackage{booktabs} % book-quality tables 78 | \RequirePackage{units} % non-stacked fractions and better unit spacing 79 | \RequirePackage{multicol} % multiple column layout facilities 80 | \RequirePackage{lipsum} % filler text 81 | \RequirePackage{fancyvrb} % extended verbatim environments 82 | \fvset{fontsize=\normalsize}% default font size for fancy-verbatim environments 83 | \hypersetup{colorlinks} % Comment this line if you don't wish to have colored links 84 | 85 | \RequirePackage{microtype} % Improves character and word spacing 86 | 87 | \RequirePackage{booktabs} % Better horizontal rules in tables 88 | 89 | \RequirePackage{graphicx} % Needed to insert images into the document 90 | 91 | %\graphicspath{{figures/}} % Sets the default location of pictures 92 | \RequirePackage{lipsum} %Filler text package, only needed for typesetting examples 93 | \RequirePackage{enumitem} %some nicer features for enumerated lists 94 | \RequirePackage{subfig} %needed to horizontally stack figures 95 | \RequirePackage{cancel} %packaged needed for cancelto arrows 96 | \RequirePackage{mathtools} 97 | 98 | \RequirePackage{ifthen} 99 | \RequirePackage{ifmtarg} 100 | \RequirePackage{tikz} 101 | \RequirePackage[most]{tcolorbox} 102 | \RequirePackage{multicol} 103 | 104 | 105 | \definecolor{LightOcean}{RGB}{81, 147, 229 } 106 | \definecolor{DeepOcean}{RGB}{51, 131, 229} 107 | \newcounter{myboxcount} 108 | 109 | \newcommand{\pagewidth}{\textwidth+\marginparwidth+10mm} 110 | 111 | \newtcolorbox[auto counter, number within=chapter]{mybox}[2][]{% 112 | % float, 113 | % floatplacement=h!, 114 | enhanced, 115 | % colback=LightOcean!10, 116 | colback=white, 117 | colframe=DeepOcean, 118 | %show bounding box, 119 | notitle, 120 | %grow to right by=\marginparsep+\marginparwidth,%,-15mm, 121 | toggle enlargement=evenpage, 122 | breakable,fonttitle=\bfseries, 123 | title= \Large{\textbf{#2}}, 124 | #1 125 | } 126 | \RequirePackage{calc}% http://ctan.org/pkg/calc 127 | 128 | \newboolean{@logobool} 129 | \setboolean{@logobool}{false} 130 | \newboolean{FlipAnsBool} 131 | \newlength{\logoshift} 132 | 133 | \def\unittitle#1{\gdef\theunittitle{#1}} 134 | \def\unitcode#1{\gdef\theunitcode{#1}} 135 | \def\lecturer#1{\gdef\thelecturer{#1}} 136 | \def\setnumber#1{\gdef\thesetnumber{#1}} 137 | \newcommand{\logo}[2][0cm]{% 138 | \gdef\thelogo{#2} 139 | \setboolean{@logobool}{true} 140 | \ifthenelse{\isempty{#1}}{% 141 | \setlength{\logoshift}{-1.72cm} 142 | }% 143 | {% 144 | \setlength{\logoshift}{- 1.72cm} 145 | \addtolength{\logoshift}{#1} 146 | }% 147 | }% 148 | \def\semester#1{\gdef\thesemester{#1}} 149 | 150 | % Standardize command font styles and environments 151 | \newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}% command name -- adds backslash automatically 152 | \newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}% optional command argument 153 | \newcommand{\docarg}[1]{\textrm{\textit{#1}}}% (required) command argument 154 | \newcommand{\docenv}[1]{\textsf{#1}}% environment name 155 | \newcommand{\docpkg}[1]{\texttt{#1}}% package name 156 | \newcommand{\doccls}[1]{\texttt{#1}}% document class name 157 | \newcommand{\docclsopt}[1]{\texttt{#1}}% document class option name 158 | \newenvironment{docspec}{\begin{quote}\noindent}{\end{quote}}% command specification environment 159 | 160 | % Needed for stars 161 | \RequirePackage{wasysym} 162 | 163 | %\newcommand\insq[1]{% 164 | % \Square\ #1\quad% 165 | %} 166 | 167 | % 168 | % The main counter is Problem 169 | % solutions is a boolean we use to keep track of if this is a 170 | % a solution set or a problem sheet 171 | 172 | \newcounter{Problem} 173 | \newboolean{solutions} 174 | 175 | % This is so that you can pass the problemsheet in as a command line option 176 | % or using a dummy input file. 177 | %\def\problemsheet 178 | % Can also pass "problemsheet" option in in the document class 179 | % or "solutions" to set these explicitly 180 | \ifdefined\problemsheet 181 | \setboolean{solutions}{false} 182 | \else 183 | \setboolean{solutions}{true} 184 | \fi 185 | % 186 | % pass a defined \flipanswer for the solutions to be flipped 187 | % 188 | \ifdefined\flipanswer 189 | \setboolean{FlipAnsBool}{true} 190 | \else 191 | \setboolean{FlipAnsBool}{false} 192 | \fi 193 | 194 | \newcommand{\SetAnswerFlip}[1]{ 195 | \setboolean{FlipAnsBool}{#1} 196 | } 197 | 198 | 199 | \titlespacing\section{0pt}{-0.3cm plus 0pt minus 0pt}{0.2cm plus 2pt minus 2pt} 200 | 201 | % 202 | % Make \emph bold and italic 203 | % 204 | % 205 | \let\emph\relax % there's no \RedeclareTextFontCommand 206 | \DeclareTextFontCommand{\emph}{\bfseries\em} 207 | 208 | \newcommand{\newq}[1]{\noindent\smallcaps{#1}} 209 | 210 | % 211 | % question environment 212 | %\begin{question}{TITLE}{TYPE}{DIFFICULTY}{EXAM} 213 | %... 214 | %\solution{}{} 215 | %\end{question} 216 | % 217 | % Adds in checkmarks for Tried, Correct, Revised in margin next to problem 218 | % title 219 | % 220 | 221 | \newenvironment{question}[4]{% 222 | \ifthenelse{\boolean{solutions}}{} 223 | {\pagebreak[3] %put a pagebreak preferentially here, 224 | % so that problems tend to sit at the top of the page 225 | \marginnote[0.25cm]{\rightline{ 226 | \makebox[1.5cm][r]{$\Square$ Tried} 227 | \makebox[1.5cm][r]{$\Square$ Correct} 228 | \makebox[1.5cm][r]{$\Square$ Revised} 229 | } 230 | } 231 | } 232 | % 233 | \refstepcounter{Problem}% 234 | \section*{\textnormal{Problem \theProblem: #1 }\textnormal{[% 235 | \ifnumcomp{#2}{=}{1}{\mbox{knowledge}}{% 236 | \ifnumcomp{#2}{=}{2}{\mbox{comprehension}}{% 237 | \ifnumcomp{#2}{=}{3}{\mbox{application}}{% 238 | \ifnumcomp{#2}{=}{4}{\mbox{analysis}}{% 239 | \ifnumcomp{#2}{=}{5}{\mbox{synthesis}}{\mbox{evaluation}}% 240 | }}}}, % 241 | \ifnumcomp{#3}{=}{1}{\mbox{$\bigstar$}}{% 242 | \ifnumcomp{#3}{=}{2}{\mbox{$\bigstar\bigstar$}}{\mbox{$\bigstar\bigstar\bigstar$}}}% 243 | \ifnumcomp{#4}{=}{1}{, \mbox{past exam}]}{]} 244 | } 245 | }% 246 | }% 247 | 248 | % 249 | % Solutions have second argument printed [Ans: #2] upside down in the 250 | % margin of the problem sheet 251 | % and #1 only shown in the solutions set. 252 | % 253 | % if no margin answers are wanted on the problem sheet just use an empty second arg 254 | % 255 | \newcommand\solution[2]{% 256 | \ifthenelse{\boolean{solutions}}{ 257 | 258 | \vspace{0.25cm} 259 | \color{blue}{#1}\color{black} 260 | }{ 261 | \ifthenelse{\isempty{#2}}{}{ 262 | \ifthenelse{\boolean{FlipAnsBool}}{ 263 | \marginnote{\rotatebox[origin=c]{180}{ 264 | \begin{minipage}[t]{\linewidth}[\emph{Ans:} #2]\end{minipage}} 265 | } 266 | } 267 | {\marginnote{{\begin{minipage}[]{\linewidth}\hfill[\emph{Ans:} #2]\end{minipage}}}} 268 | } 269 | }}% 270 | 271 | 272 | % puts in a line, except at the top and bottom of the page (uses a TeX hack where 273 | % "glue" is ignored at the top and bottom of a page, so the line is hidden inside the 274 | % "glue". 275 | \def\makeline{\pagebreak[3] 276 | \vskip 0.5cm 277 | \cleaders\hrule width1.5375\hsize\vskip.4pt\vskip1em 278 | \nobreak\vskip 0.5cm \relax 279 | } 280 | 281 | 282 | %No date provided, if date desired either set explicitly or remove command for current date 283 | %\date{} 284 | % 285 | % Put in university logo if provided 286 | % 287 | \let\oldmaketitle\maketitle 288 | \renewcommand{\maketitle}{ 289 | % 290 | % if solutions then one title 291 | % if problem set then another 292 | % 293 | \ifthenelse{\boolean{solutions}}{ 294 | \title[Problem Set \thesetnumber ~Solutions---]{\theunitcode ~ \theunittitle} 295 | \author[Problem Set \thesetnumber~Solutions]{Problem Set~\thesetnumber ~Solutions,~\thesemester} 296 | }{ 297 | \title[Problem Set~\thesetnumber---]{\theunitcode~\theunittitle} 298 | \author[Problem Set~\thesetnumber]{Problem Set~\thesetnumber,~\thesemester} 299 | } 300 | \ifthenelse{\boolean{@logobool}}{ 301 | \oldmaketitle \marginnote[\logoshift]{\includegraphics{\thelogo}}}{\oldmaketitle}} 302 | 303 | % 304 | % Sets up the enumerate environment to be (a), (b)..., tighter, 305 | % also be offset by 1cm from the left margin 306 | % 307 | \setlist[enumerate]{label=(\alph*), itemsep=0.1cm, topsep=0.1cm, leftmargin=1cm, align=left, labelwidth=0.5cm} 308 | 309 | --------------------------------------------------------------------------------