summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/scrambledenvs/scrambledenvs.dtx
blob: 111bcab05711c9842c74761559c95e160b783593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
% \iffalse meta-comment
%
% Copyright (C) 2021 Dennis Chen <proofprogram@gmail.com>
%
% This work may be distributed and/or modified under
% the conditions the LaTeX Project Public License (LPPL),
% either version 1.3 of this license or (at your option)
% any later version. The latest version of this license
% can be found in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
%<*internal>
\iffalse
%</internal>
%<*readme>
# The LaTeX package scrambledenvs - version 1.1.0 (2021/09/26)

> Copyright (C) 2021 Dennis Chen proofprogram@gmail.com
> 
> This file may be distributed and/or modified under the conditions the LaTeX Project Public License (LPPL), either version 1.3 of this license or (at your option) any later version. The latest version of this license can be found in http://www.latex-project.org/lppl.txt and version 1.3 or later is part of all distributions of LaTeX version 2005/12/01 or later.

**scrambledenvs** allows you to arbitrarily create and print scrambled environments (like scrambled hints in a book) and customize the output.

## Installation instructions

A working TeX installation is required.

This is a self-extracting dtx file, so run

    pdflatex scrambledenvs.dtx

to generate the README, documentation, and packages.
%</readme>
% \fi

% \iffalse

%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
    \expandafter\begingroup
\fi
%</internal>
%<*install>

\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble

This is a generated file.

Copyright (C) 2021 Dennis Chen <proofprogram@gmail.com>

This work may be distributed and/or modified under
the conditions the LaTeX Project Public License (LPPL),
either version 1.3 of this license or (at your option)
any later version. The latest version of this license
can be found in

    http://www.latex-project.org/lppl.txt

and version 1.3 or later is part of all distributions of LaTeX
version 2005/12/01 or later.

To produce the documentation, run palette.dtx through pdflatex.

\endpreamble
\postamble

This package consists of the file scrambledenvs.dtx,
          and the generated files scrambledenvs.sty,
                                  scrambledenvs.pdf.
\endpostamble

\usedir{tex/latex/scrambledenvs}
\generate{
    \file{scrambledenvs.sty}{\from{\jobname.dtx}{main}\from{\jobname.dtx}{helper}}
}

\obeyspaces
\Msg{*************************************************************}
\Msg{*                                                           *}
\Msg{* To finish the installation you have to move the following *}
\Msg{* files into a directory searched by TeX:                   *}
\Msg{*                                                           *}
\Msg{*     scrambledenvs.sty                                     *}
\Msg{*                                                           *}
\Msg{* To produce the documentation, run the file                *}
\Msg{* scrambledenvs.dtx through LaTeX.                          *}
\Msg{*                                                           *}
\Msg{* Happy TeXing!                                             *}
\Msg{*                                                           *}
\Msg{*************************************************************}

%</install>
%<install>\endbatchfile
%<*internal>

\usedir{source/latex/scrambledenvs}
\generate{
    \file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble

\usedir{doc/latex/scrambledenvs}
\generate{
    \file{README.md}{\from{\jobname.dtx}{readme}}
}

\ifx\fmtname\nameofplainTeX
    \expandafter\endbatchfile
\else
    \expandafter\endgroup
\fi
%</internal>
%<*main>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{scrambledenvs}[2021/09/26 v1.1.0 Create and print scrambled environments]
\RequirePackage{ifthen}
\RequirePackage{forloop}
\RequirePackage{pgfmath}
\pgfmathsetseed{2407}
%</main>
%<*driver>
\ProvidesFile{\jobname.dtx}[2021/09/26 v1.1.0 Create and print scrambled environments]
\documentclass{ltxdoc}

\EnableCrossrefs
\CodelineIndex
\RecordChanges

\begin{document}
    \DocInput{\jobname.dtx}
    \PrintIndex
    \PrintChanges
\end{document}
%</driver>
% \fi
% \GetFileInfo{\jobname.dtx}
% \changes{v1.0.1}{2021/08/03}{Add info about author and license to README}
% \changes{v1.0.0}{2021/07/31}{Initial version}
%
% \renewcommand{\emph}[1]{\textbf{#1}}
%
% \title{\textsf{scrambledenvs} -- Create and print scrambled environments}
% \author{Dennis Chen \\ proofprogram@gmail.com}
% \date{\fileversion{} (\filedate)}
%
% \maketitle
%
% \begin{abstract}
% The \textsf{scrambledenvs} package allows you to create scrambled environments and print them out later, such as scrambled hints or solutions.
% \end{abstract}
%
% \section{Overview}
%
% This package was designed to mark hints at a location\footnote{It can generalize beyond hints, but I thought it best to start off with a specific example..} and print them out later in a random order.\footnote{Though you do have the ability to make the order not random: pass in |noscramble| to the package.}
%
% There is an outer environment which typesets the label. Inside it you should place the inner environment \emph{and only the inner environment}. Inside this inner environment, you write the contents of your hint. This will typeset the hint number. Finally, you may print the hints at some later location in a randomized order.
%
% \section{Usage}
%
% If you want your solutions to be scrambled, call
% \begin{verbatim}
%\usepackage{scrambledenvs}
% \end{verbatim}
%
% If you want to disable all scrambling for any reason, call
% \begin{verbatim}
%\usepackage[noscramble]{scrambledenvs}
% \end{verbatim}
% \iffalse
%<*main>
\newif\ifscrambledenvs@scramble\scrambledenvs@scrambletrue
\DeclareOption{noscramble}{\scrambledenvs@scramblefalse}
\ProcessOptions\relax
%</main>
% \fi
%
% \DescribeMacro{\newscrambledenv}
% In order to create a new scrambled environment, one should call |\newscrambledenv{envname}|. This requires that the macros |\envname| and |\envname|s be undefined, as well as the counters \textsf{envname}count and \textsf{envname}tempcount be undefined, as |\newscrambledenv| will define these.
%
% This defines the environments |`envname`s| and |`envname`|, and the macro |\print`envname`|, where |`envname'| denotes the value passed in to |\newscrambledenv|. Because this will get confusing fast, we will just assume that |`envname'| is |hint|, since this generalizes quite easily.
%
% Thus in this example, the environments |hints| and |hint| are defined, and the macro |\printhint| is defined.
%
% If any of these macros or counters are defined, the package will throw a custom error.
%
% ^^A At the start, surround everything in newscrambledenv (since everything in main goes there)
% \iffalse
%<*main>
\newcommand\newscrambledenv[1]{
    \scrambledenvs@check@macrodefined{print#1}
    \scrambledenvs@check@envdefined{#1s}
    \scrambledenvs@check@envdefined{#1}
    \newcounter{scrambledenvs@#1@count}
    \newcounter{scrambledenvs@#1@tempcount}
%</main>
%<*helper>
\newcommand\scrambledenvs@check@macrodefined[1]{%
    \ifcsname #1\endcsname
    \PackageError{scrambledenvs}{The macro \@backslashchar #1\space cannot be defined,\MessageBreak
    as the macro \@backslashchar #1 is already defined}{Remove any packages that define \@backslashchar #1,\MessageBreak
    or choose a different name for your scrambled environment.}%
    \fi
}
\newcommand\scrambledenvs@check@envdefined[1]{%
    \ifcsname #1\endcsname
    \PackageError{scrambledenvs}{The environment `#1' cannot be defined,\MessageBreak
    as the macro \@backslashchar #1 is already defined}{Remove any packages that define `#1',\MessageBreak
    or choose a different name for your scrambled environment.}%
    \fi
}
%</helper>
% \fi
% \DescribeEnv{hints}
% \changes{v1.1.0}{2021/09/26}{Fix internal bug when referencing counters}
% \changes{v1.0.1}{2021/08/03}{Adjust spacing to make two scrambled envs look prettier together}
% This is the outer environment. Depending on how many |hint| environments are put inside it, it will either typeset \emph{Hints:} or \emph{Hint:} with the numerical labels of the passed in hints following it.
% You should put in nothing but the inner environment |hint|. (See the examples for a correct usage.)
% \iffalse
%<*helper>
\def\scrambledenvs@active{}
%</helper>
%<*main>
\newenvironment{#1s}{%
    \setcounter{scrambledenvs@#1@tempcount}{0}%
    \def\scrambledenvs@active{#1}%
}
{
\ifnum\value{scrambledenvs@#1@tempcount}=0\relax
\else
    \ifnum\value{scrambledenvs@#1@tempcount}=1\relax
        {\csname scrambledenvs@#1@labelfont\endcsname\csname scrambledenvs@#1@label\endcsname :}
        {\csname scrambledenvs@#1@reffont\endcsname\csname scrambledenvs@#1@refprefix\endcsname\ref{#1:\the\numexpr\value{scrambledenvs@#1@count}}}%
    \else
        {\csname scrambledenvs@#1@labelfont\endcsname\csname scrambledenvs@#1@label\endcsname s:}
        \forloop{scrambledenvs@loopcount}{\the\numexpr\value{scrambledenvs@#1@count}-\value{scrambledenvs@#1@tempcount}+1\relax}{\value{scrambledenvs@loopcount}<\the\numexpr\value{scrambledenvs@#1@count}+1\relax} {%
            {\csname scrambledenvs@#1@reffont\endcsname\csname scrambledenvs@#1@refprefix\endcsname\ref{#1:\thescrambledenvs@loopcount}}
        }
    \fi
\fi
\setcounter{scrambledenvs@#1@tempcount}{0}%
}
%</main>
% \fi
%
% \DescribeEnv{hint}
% This is the inner environment. The inner environment |hint| \emph{must} be inside the outer environment |hints|.
% \iffalse
%<*main>
\newenvironment{#1}{%
    \stepcounter{scrambledenvs@#1@tempcount}%
    \stepcounter{scrambledenvs@#1@count}%
    \ifnum\pdfstrcmp{#1}{\scrambledenvs@active}=0\relax
    \else
        \PackageError{scrambledenvs}{The inner environment `#1' must be inside the outer environment `#1s'}{}
    \fi
    \unskip%
    \filecontents[overwrite]{\jobname-\the\value{scrambledenvs@#1@count}.#1}%
}
{%
    \endfilecontents
}
%</main>
% \fi
%
% \DescribeMacro{\printhint}
% \changes{v1.1.0}{2021/09/26}{Feature: printhint only outputs unprinted hints (allows for printhint in each chapter, etc)}
% \changes{v1.1.0}{2021/09/26}{Bugfix: switch from forloop to TeX loops}
% To print out the hints (either in a random or fixed order, depending on whether the option |noscramble| is passed in), just write |\printhint|.
%
% Only hints that have not been printed before will be printed. Therefore, in a book, you could write |\printhint| at the end of each chapter to get end-of-chapter hints.
%
% By default, the hint counter resets each time. So if you use |\printhint| twice, you will have two hint 1's, etc. If you want the counter to continue, the following code will work:
%\begin{verbatim}
%\hintprintenv{\begin{enumerate}\setcounter{enumi}{\the\numexpr\csname scrambledenvs@hint@start\endcsname-1\relax}}{\end{enumerate}}
%\end{verbatim}
% Wrap this with a |\makeatletter| |\makeatother| pair if appropriate (i.e. in TeX files).
% \iffalse
%<*helper>
\newcounter{scrambledenvs@loopcount}
\newcounter{scrambledenvs@innerloopcount}
%</helper>
%<*main>
\expandafter\def\csname scrambledenvs@#1@start\endcsname{1}
\expandafter\newcommand\csname print#1\endcsname{%
    \ifscrambledenvs@scramble %\if
        \ifcsname thescrambledenvs@#1@count\endcsname
            \ifnum\value{scrambledenvs@#1@count}<\csname scrambledenvs@#1@start\endcsname\relax
            \else
                \expandafter\edef\csname pgfmath@randomlist@#1\endcsname{\numexpr\value{scrambledenvs@#1@count}-\csname scrambledenvs@#1@start\endcsname+1}
                    \count@=1
                    \loop
                        \expandafter\edef\csname pgfmath@randomlist@#1@\the\count@\endcsname{\the\numexpr\count@+\csname scrambledenvs@#1@start\endcsname-1\relax}
                    \ifnum\count@<\numexpr\value{scrambledenvs@#1@count}-\csname scrambledenvs@#1@start\endcsname+1\relax
                    \advance\count@ 1
                    \repeat
                \begin{scrambledenvs@#1@printenv}
                    \setcounter{scrambledenvs@loopcount}{\csname scrambledenvs@#1@start\endcsname}
                    \whiledo{\value{scrambledenvs@loopcount}<\the\numexpr\value{scrambledenvs@#1@count}+1\relax}{%
                    \stepcounter{scrambledenvs@loopcount}
                    \pgfmathrandomitem\scrambledenvs@tempindex{#1}
                    \csname scrambledenvs@#1@printitem\endcsname\label{#1:\scrambledenvs@tempindex}%
                        \input{\jobname-\scrambledenvs@tempindex.#1}%
                        \count@\pgfmath@randomtemp
                        \loop
                            \global\expandafter\let\csname pgfmath@randomlist@#1@\the\count@\expandafter\endcsname\csname pgfmath@randomlist@#1@\the\numexpr\the\count@+1\relax\endcsname%
                        \advance\count@ 1
                        \ifnum \count@ < \csname pgfmath@randomlist@#1\endcsname\relax
                        \repeat
                    \expandafter\xdef\csname pgfmath@randomlist@#1\endcsname{\the\numexpr\csname pgfmath@randomlist@#1\endcsname-1\relax}%
                    }
                \end{scrambledenvs@#1@printenv}
                \expandafter\edef\csname scrambledenvs@#1@start\endcsname{\the\numexpr\value{scrambledenvs@#1@count}+1\relax}
            \fi
        \fi
    \else
        \ifcsname thescrambledenvs@#1@count\endcsname
            \ifnum\value{scrambledenvs@#1@count}>0\relax
                \begin{scrambledenvs@#1@printenv}%
                    \forloop{scrambledenvs@loopcount}{\csname scrambledenvs@#1@start\endcsname}{\value{scrambledenvs@loopcount}<\the\numexpr\value{scrambledenvs@#1@count}+1\relax}{\csname scrambledenvs@#1@printitem\endcsname\label{#1:\thescrambledenvs@loopcount}\input{\jobname-\thescrambledenvs@loopcount.#1}}%
                \end{scrambledenvs@#1@printenv}
                \expandafter\edef\csname scrambledenvs@#1@start\endcsname{\the\numexpr\value{scrambledenvs@#1@count}+1\relax}
            \fi
        \fi
    \fi
}
%</main>
% \fi
%
% \subsection{Formatting}
%
% There are five pieces of configurable formatting. They are roughly ordered by the order they would appear in a document.
%
% \DescribeMacro{\hintlabel}
% First is the label ``Hint(s)'' which gets printed by the outer environment |hints|. Capitalization and singular/plural form is automatically taken care of. To change it, write |\hintlabel{new label}| to get ``New label(s)'' as the new label.
%
% By default the label is the environment name capitalized. This may be useful if your environment names are shortened: for instance, you could change the label of |solu| to ``Solution(s)'' instead.
%
% \iffalse
%<*main>
\expandafter\def\csname scrambledenvs@#1@label\endcsname{\MakeUppercase #1}
\scrambledenvs@check@macrodefined{#1label}
\expandafter\newcommand\csname #1label\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@label\endcsname{\MakeUppercase ##1}}
%</main>
% \fi
%
% \DescribeMacro{\hintlabelfont}
% Second is the font of the label. To change it, write |\hintlabelfont{new label font}| to apply the new font. By default the font applied is |\bfseries|.
%
% Because this macro only takes in one argument, it is advisable to use |\bfseries| instead of |\textbf|, for instance.
%
% \iffalse
%<*main>
\expandafter\def\csname scrambledenvs@#1@labelfont\endcsname{\scrambledenvs@labelfont}
\scrambledenvs@check@macrodefined{#1labelfont}
\expandafter\newcommand\csname #1labelfont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@labelfont\endcsname{##1}}
%</main>
% \fi
% \changes{v1.1.0}{2021/09/26}{Added ref prefix}
% \DescribeMacro{\hintrefprefix}
% Sets the prefix before the reference. (This may be useful if you have multiple |\printhint| statements, like one at the end of each chapter.)
%
% \iffalse
%<*main>
\expandafter\def\csname scrambledenvs@#1@refprefix\endcsname{\scrambledenvs@refprefix}
\scrambledenvs@check@macrodefined{#1refprefix}
\expandafter\newcommand\csname #1refprefix\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@refprefix\endcsname{##1}}
%</main>
% \fi
% \DescribeMacro{\hintreffont}
% Sets the font of the numerical references the follows the label.
%
% If you are using hyperref and you are using the |colorlinks| option: because the references are generated with |\ref|, you must change hyperref colors in order to change the color. |\color| will not work. Otherwise |\color| will work.
%
% If you are using hyperref \emph{and} have a prefix, since the prefix is not part of the label, you must use \emph{both} |\hypersetup| and |\color|.
%
% \iffalse
%<*main>
\expandafter\def\csname scrambledenvs@#1@reffont\endcsname{\scrambledenvs@reffont}
\scrambledenvs@check@macrodefined{#1reffont}
\expandafter\newcommand\csname #1reffont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@reffont\endcsname{##1}}
%</main>
% \fi
%
% \DescribeMacro{\hintprintenv}
% When the randomized hints are printed at the end, the actual printed contents are wrapped around an environment. By default the beginning of the environment is |\begin{enumerate}| and the end is |\end{enumerate}|.
%
% To change these, write |\hintprintenv{new env beginning}{new env ending}|.
%
% \iffalse
%<*main>
\newenvironment{scrambledenvs@#1@printenv}{\begin{scrambledenvs@printenv}}{\end{scrambledenvs@printenv}}
\scrambledenvs@check@envdefined{#1printenv}
\expandafter\newcommand\csname #1printenv\endcsname[2]{\renewenvironment{scrambledenvs@#1@printenv}{##1}{##2}}
%</main>
% \fi
%
% \DescribeMacro{\hintprintitem}
% Each item of the randomized hints is printed with |\hintprintitem| at the beginning. By default it is |\item|.
%
% The way this is defined also allows for changing the font of the output. So if you want to bold the hint text, you could write |\hintprintitem{\bfseries\item}|.
% \iffalse
%<*main>
\expandafter\def\csname scrambledenvs@#1@printitem\endcsname{\scrambledenvs@printitem}
\scrambledenvs@check@macrodefined{#1printitem}
\expandafter\newcommand\csname #1printitem\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@printitem\endcsname{##1}}
%</main>
% \fi
%
% You may also change the defaults of all these pieces \emph{except the label} with the following macros. (The names of these macros make it impossible to pass in |\newscrambledenv{default}|, but there is no reason to do such a thing anyway.)
%
% If, at any point, you change the defaults, \emph{all} fonts/formats that have not been custom-set will be changed, including those of previously defined scrambled environments.
%
% Usage is identical to configuring formatting for specific scrambled environments.
%
% \DescribeMacro{\defaultlabelfont}
% Changes the default label font.
% \iffalse
%<*helper>
\def\scrambledenvs@labelfont{\bfseries}
\def\defaultlabelfont#1{\def\scrambledenvs@lineformat{#1}}
%</helper>
% \fi
%
% \DescribeMacro{\defaultrefprefix}
% Changes the default reference prefix.
% \iffalse
%<*helper>
\def\scrambledenvs@refprefix{}
\def\defaultrefprefix#1{\def\scrambledenvs@refprefix{#1}}
%</helper>
% \fi
%
% \DescribeMacro{\defaultreffont}
% Changes the default reference font.
% \iffalse
%<*helper>
\def\scrambledenvs@reffont{}
\def\defaultreffont#1{\def\scrambledenvs@reffont{#1}}
%</helper>
% \fi
%
% \DescribeMacro{\defaultprintenv}
% Changes the default print environment.
% \iffalse
%<*helper>
\newenvironment{scrambledenvs@printenv}{\begin{enumerate}}{\end{enumerate}}
\def\defaultprintenv#1#2{\renewenvironment{scrambledenvs@printenv}{#1}{#2}}
%</helper>
%\fi
%
% \DescribeMacro{\defaultprintitem}
% Changes the formatting of the default print item.
% \iffalse
%<*helper>
\def\scrambledenvs@printitem{\item}
\def\defaultprintitem#1{\def\scrambledenvs@printitem{#1}}
%</helper>
% \fi
%
% \section{Examples}
% In all of the examples, we use |hint| as our generic scrambled environment. 
% \subsection{A barebones example}
%\begin{verbatim}
%\documentclass{article}
%\usepackage{scrambledenvs}
%\newscrambledenv{hint}
%
%\begin{document}
%This is a really hard problem, so we provide hints.\begin{hints}
%\begin{addhint}
%This is a helpful hint.
%\end{addhint}
%\begin{addhint}
%And another one!
%\end{addhint}
%\end{hints}
%
%\section{Hints printed}
%
%\printhint
%
%\end{document}
%\end{verbatim}
% \subsection{Changing hint formatting}
% Changing default formatting is identical, except there is no way to change the label. (We do not include the document body since we have already shown how that works.)
%\begin{verbatim}
%\documentclass{article}
%\usepackage{scrambledenvs}
%\usepackage{xcolor}
%\newscrambledenv{hint}
%\hintlabel{tip}
%\hintlabelfont{\textit}
%\hintreffont{\color{blue}\bfseries}
%\hintprintenv{\begin{enumerate}\small}{\end{enumerate}}
%\hintprintitem{\bfseries\item}
%\end{verbatim}
% \subsection{Changing hintreffont color: hyperrefs colorlink}
% Since we are using |\ref| to typeset labels (which are set with |\label|), if we use |colorlinks| from package |hyperref| we must locally change the linkcolor in order to change the color the numbers are typeset in.
%\begin{verbatim}
%\documentclass{article}
%\usepackage{scrambledenvs}
%\usepackage{xcolor}
%\usepackage{hyperref}
%\hypersetup{colorlinks}
%\newscrambledenv{hint}
%\hintreffont{\hypersetup{linkcolor=blue}}
%\end{verbatim}
%\subsection{Changing hint ref prefix}
%\begin{verbatim}
%\documentclass{article}
%\usepackage{scrambledenvs}
%\usepackage{xcolor}
%\usepackage{hyperref}
%\hypersetup{colorlinks}
%\newscrambledenv{hint}
%\hintrefprefix{\thesection.}
%\hintreffont{\color{blue}\hypersetup{linkcolor=blue}}
%\begin{document}
%\section{First Problem}
%This is a problem.
%\begin{hints}
%\begin{hint}
%This hint will be referenced as 1.1.
%\end{hint}
%\end{hints}
%\subsection{Hints}
%\printhint
%\section{Second Problem}
%This is another problem.
%\begin{hints}
%\begin{hint}
%This hint will be referenced as 2.1.
%\end{hint}
%\end{hints}
%\subsection{Hints}
%\printhint
%\end{document}
%\end{verbatim}
% ^^A At the end, close brace
%\iffalse
%<*main>
}
%</main>
%\fi
% \Finale
\endinput