Debian Codegraph @

texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2021 Dennis Chen <[email protected]>
4 %
5 % This work may be distributed and/or modified under
6 % the conditions the LaTeX Project Public License (LPPL),
7 % either version 1.3 of this license or (at your option)
8 % any later version. The latest version of this license
9 % can be found in
10 % http://www.latex-project.org/lppl.txt
11 % and version 1.3 or later is part of all distributions of LaTeX
12 % version 2005/12/01 or later.
13 %
14 %<*internal>
15 \iffalse
16 %</internal>
17 %<*readme>
18 # The LaTeX package scrambledenvs - version 1.1.0 (2021/09/26)
19
20 > Copyright (C) 2021 Dennis Chen [email protected]
21 >
22 > 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.
23
24 **scrambledenvs** allows you to arbitrarily create and print scrambled environments (like scrambled hints in a book) and customize the output.
25
26 ## Installation instructions
27
28 A working TeX installation is required.
29
30 This is a self-extracting dtx file, so run
31
32 pdflatex scrambledenvs.dtx
33
34 to generate the README, documentation, and packages.
35 %</readme>
36 % \fi
37
38 % \iffalse
39
40 %<*internal>
41 \fi
42 \def\nameofplainTeX{plain}
43 \ifx\fmtname\nameofplainTeX\else
44 \expandafter\begingroup
45 \fi
46 %</internal>
47 %<*install>
48
49 \input docstrip.tex
50 \keepsilent
51 \askforoverwritefalse
52 \preamble
53
54 This is a generated file.
55
56 Copyright (C) 2021 Dennis Chen <[email protected]>
57
58 This work may be distributed and/or modified under
59 the conditions the LaTeX Project Public License (LPPL),
60 either version 1.3 of this license or (at your option)
61 any later version. The latest version of this license
62 can be found in
63
64 http://www.latex-project.org/lppl.txt
65
66 and version 1.3 or later is part of all distributions of LaTeX
67 version 2005/12/01 or later.
68
69 To produce the documentation, run palette.dtx through pdflatex.
70
71 \endpreamble
72 \postamble
73
74 This package consists of the file scrambledenvs.dtx,
75 and the generated files scrambledenvs.sty,
76 scrambledenvs.pdf.
77 \endpostamble
78
79 \usedir{tex/latex/scrambledenvs}
80 \generate{
81 \file{scrambledenvs.sty}{\from{\jobname.dtx}{main}\from{\jobname.dtx}{helper}}
82 }
83
84 \obeyspaces
85 \Msg{*************************************************************}
86 \Msg{* *}
87 \Msg{* To finish the installation you have to move the following *}
88 \Msg{* files into a directory searched by TeX: *}
89 \Msg{* *}
90 \Msg{* scrambledenvs.sty *}
91 \Msg{* *}
92 \Msg{* To produce the documentation, run the file *}
93 \Msg{* scrambledenvs.dtx through LaTeX. *}
94 \Msg{* *}
95 \Msg{* Happy TeXing! *}
96 \Msg{* *}
97 \Msg{*************************************************************}
98
99 %</install>
100 %<install>\endbatchfile
101 %<*internal>
102
103 \usedir{source/latex/scrambledenvs}
104 \generate{
105 \file{\jobname.ins}{\from{\jobname.dtx}{install}}
106 }
107 \nopreamble\nopostamble
108
109 \usedir{doc/latex/scrambledenvs}
110 \generate{
111 \file{README.md}{\from{\jobname.dtx}{readme}}
112 }
113
114 \ifx\fmtname\nameofplainTeX
115 \expandafter\endbatchfile
116 \else
117 \expandafter\endgroup
118 \fi
119 %</internal>
120 %<*main>
121 \NeedsTeXFormat{LaTeX2e}
122 \ProvidesPackage{scrambledenvs}[2021/09/26 v1.1.0 Create and print scrambled environments]
123 \RequirePackage{ifthen}
124 \RequirePackage{forloop}
125 \RequirePackage{pgfmath}
126 \pgfmathsetseed{2407}
127 %</main>
128 %<*driver>
129 \ProvidesFile{\jobname.dtx}[2021/09/26 v1.1.0 Create and print scrambled environments]
130 \documentclass{ltxdoc}
131
132 \EnableCrossrefs
133 \CodelineIndex
134 \RecordChanges
135
136 \begin{document}
137 \DocInput{\jobname.dtx}
138 \PrintIndex
139 \PrintChanges
140 \end{document}
141 %</driver>
142 % \fi
143 % \GetFileInfo{\jobname.dtx}
144 % \changes{v1.0.1}{2021/08/03}{Add info about author and license to README}
145 % \changes{v1.0.0}{2021/07/31}{Initial version}
146 %
147 % \renewcommand{\emph}[1]{\textbf{#1}}
148 %
149 % \title{\textsf{scrambledenvs} -- Create and print scrambled environments}
150 % \author{Dennis Chen \\ [email protected]}
151 % \date{\fileversion{} (\filedate)}
152 %
153 % \maketitle
154 %
155 % \begin{abstract}
156 % The \textsf{scrambledenvs} package allows you to create scrambled environments and print them out later, such as scrambled hints or solutions.
157 % \end{abstract}
158 %
159 % \section{Overview}
160 %
161 % 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.}
162 %
163 % 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.
164 %
165 % \section{Usage}
166 %
167 % If you want your solutions to be scrambled, call
168 % \begin{verbatim}
169 %\usepackage{scrambledenvs}
170 % \end{verbatim}
171 %
172 % If you want to disable all scrambling for any reason, call
173 % \begin{verbatim}
174 %\usepackage[noscramble]{scrambledenvs}
175 % \end{verbatim}
176 % \iffalse
177 %<*main>
178 \newif\ifscrambledenvs@scramble\scrambledenvs@scrambletrue
179 \DeclareOption{noscramble}{\scrambledenvs@scramblefalse}
180 \ProcessOptions\relax
181 %</main>
182 % \fi
183 %
184 % \DescribeMacro{\newscrambledenv}
185 % 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.
186 %
187 % 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.
188 %
189 % Thus in this example, the environments |hints| and |hint| are defined, and the macro |\printhint| is defined.
190 %
191 % If any of these macros or counters are defined, the package will throw a custom error.
192 %
193 % ^^A At the start, surround everything in newscrambledenv (since everything in main goes there)
194 % \iffalse
195 %<*main>
196 \newcommand\newscrambledenv[1]{
197 \scrambledenvs@check@macrodefined{print#1}
198 \scrambledenvs@check@envdefined{#1s}
199 \scrambledenvs@check@envdefined{#1}
200 \newcounter{scrambledenvs@#1@count}
201 \newcounter{scrambledenvs@#1@tempcount}
202 %</main>
203 %<*helper>
204 \newcommand\scrambledenvs@check@macrodefined[1]{%
205 \ifcsname #1\endcsname
206 \PackageError{scrambledenvs}{The macro \@backslashchar #1\space cannot be defined,\MessageBreak
207 as the macro \@backslashchar #1 is already defined}{Remove any packages that define \@backslashchar #1,\MessageBreak
208 or choose a different name for your scrambled environment.}%
209 \fi
210 }
211 \newcommand\scrambledenvs@check@envdefined[1]{%
212 \ifcsname #1\endcsname
213 \PackageError{scrambledenvs}{The environment `#1' cannot be defined,\MessageBreak
214 as the macro \@backslashchar #1 is already defined}{Remove any packages that define `#1',\MessageBreak
215 or choose a different name for your scrambled environment.}%
216 \fi
217 }
218 %</helper>
219 % \fi
220 % \DescribeEnv{hints}
221 % \changes{v1.1.0}{2021/09/26}{Fix internal bug when referencing counters}
222 % \changes{v1.0.1}{2021/08/03}{Adjust spacing to make two scrambled envs look prettier together}
223 % 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.
224 % You should put in nothing but the inner environment |hint|. (See the examples for a correct usage.)
225 % \iffalse
226 %<*helper>
227 \def\scrambledenvs@active{}
228 %</helper>
229 %<*main>
230 \newenvironment{#1s}{%
231 \setcounter{scrambledenvs@#1@tempcount}{0}%
232 \def\scrambledenvs@active{#1}%
233 }
234 {
235 \ifnum\value{scrambledenvs@#1@tempcount}=0\relax
236 \else
237 \ifnum\value{scrambledenvs@#1@tempcount}=1\relax
238 {\csname scrambledenvs@#1@labelfont\endcsname\csname scrambledenvs@#1@label\endcsname :}
239 {\csname scrambledenvs@#1@reffont\endcsname\csname scrambledenvs@#1@refprefix\endcsname\ref{#1:\the\numexpr\value{scrambledenvs@#1@count}}}%
240 \else
241 {\csname scrambledenvs@#1@labelfont\endcsname\csname scrambledenvs@#1@label\endcsname s:}
242 \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} {%
243 {\csname scrambledenvs@#1@reffont\endcsname\csname scrambledenvs@#1@refprefix\endcsname\ref{#1:\thescrambledenvs@loopcount}}
244 }
245 \fi
246 \fi
247 \setcounter{scrambledenvs@#1@tempcount}{0}%
248 }
249 %</main>
250 % \fi
251 %
252 % \DescribeEnv{hint}
253 % This is the inner environment. The inner environment |hint| \emph{must} be inside the outer environment |hints|.
254 % \iffalse
255 %<*main>
256 \newenvironment{#1}{%
257 \stepcounter{scrambledenvs@#1@tempcount}%
258 \stepcounter{scrambledenvs@#1@count}%
259 \ifnum\pdfstrcmp{#1}{\scrambledenvs@active}=0\relax
260 \else
261 \PackageError{scrambledenvs}{The inner environment `#1' must be inside the outer environment `#1s'}{}
262 \fi
263 \unskip%
264 \filecontents[overwrite]{\jobname-\the\value{scrambledenvs@#1@count}.#1}%
265 }
266 {%
267 \endfilecontents
268 }
269 %</main>
270 % \fi
271 %
272 % \DescribeMacro{\printhint}
273 % \changes{v1.1.0}{2021/09/26}{Feature: printhint only outputs unprinted hints (allows for printhint in each chapter, etc)}
274 % \changes{v1.1.0}{2021/09/26}{Bugfix: switch from forloop to TeX loops}
275 % To print out the hints (either in a random or fixed order, depending on whether the option |noscramble| is passed in), just write |\printhint|.
276 %
277 % 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.
278 %
279 % 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:
280 %\begin{verbatim}
281 %\hintprintenv{\begin{enumerate}\setcounter{enumi}{\the\numexpr\csname scrambledenvs@hint@start\endcsname-1\relax}}{\end{enumerate}}
282 %\end{verbatim}
283 % Wrap this with a |\makeatletter| |\makeatother| pair if appropriate (i.e. in TeX files).
284 % \iffalse
285 %<*helper>
286 \newcounter{scrambledenvs@loopcount}
287 \newcounter{scrambledenvs@innerloopcount}
288 %</helper>
289 %<*main>
290 \expandafter\def\csname scrambledenvs@#1@start\endcsname{1}
291 \expandafter\newcommand\csname print#1\endcsname{%
292 \ifscrambledenvs@scramble %\if
293 \ifcsname thescrambledenvs@#1@count\endcsname
294 \ifnum\value{scrambledenvs@#1@count}<\csname scrambledenvs@#1@start\endcsname\relax
295 \else
296 \expandafter\edef\csname pgfmath@randomlist@#1\endcsname{\numexpr\value{scrambledenvs@#1@count}-\csname scrambledenvs@#1@start\endcsname+1}
297 \count@=1
298 \loop
299 \expandafter\edef\csname pgfmath@randomlist@#1@\the\count@\endcsname{\the\numexpr\count@+\csname scrambledenvs@#1@start\endcsname-1\relax}
300 \ifnum\count@<\numexpr\value{scrambledenvs@#1@count}-\csname scrambledenvs@#1@start\endcsname+1\relax
301 \advance\count@ 1
302 \repeat
303 \begin{scrambledenvs@#1@printenv}
304 \setcounter{scrambledenvs@loopcount}{\csname scrambledenvs@#1@start\endcsname}
305 \whiledo{\value{scrambledenvs@loopcount}<\the\numexpr\value{scrambledenvs@#1@count}+1\relax}{%
306 \stepcounter{scrambledenvs@loopcount}
307 \pgfmathrandomitem\scrambledenvs@tempindex{#1}
308 \csname scrambledenvs@#1@printitem\endcsname\label{#1:\scrambledenvs@tempindex}%
309 \input{\jobname-\scrambledenvs@tempindex.#1}%
310 \count@\pgfmath@randomtemp
311 \loop
312 \global\expandafter\let\csname pgfmath@randomlist@#1@\the\count@\expandafter\endcsname\csname pgfmath@randomlist@#1@\the\numexpr\the\count@+1\relax\endcsname%
313 \advance\count@ 1
314 \ifnum \count@ < \csname pgfmath@randomlist@#1\endcsname\relax
315 \repeat
316 \expandafter\xdef\csname pgfmath@randomlist@#1\endcsname{\the\numexpr\csname pgfmath@randomlist@#1\endcsname-1\relax}%
317 }
318 \end{scrambledenvs@#1@printenv}
319 \expandafter\edef\csname scrambledenvs@#1@start\endcsname{\the\numexpr\value{scrambledenvs@#1@count}+1\relax}
320 \fi
321 \fi
322 \else
323 \ifcsname thescrambledenvs@#1@count\endcsname
324 \ifnum\value{scrambledenvs@#1@count}>0\relax
325 \begin{scrambledenvs@#1@printenv}%
326 \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}}%
327 \end{scrambledenvs@#1@printenv}
328 \expandafter\edef\csname scrambledenvs@#1@start\endcsname{\the\numexpr\value{scrambledenvs@#1@count}+1\relax}
329 \fi
330 \fi
331 \fi
332 }
333 %</main>
334 % \fi
335 %
336 % \subsection{Formatting}
337 %
338 % There are five pieces of configurable formatting. They are roughly ordered by the order they would appear in a document.
339 %
340 % \DescribeMacro{\hintlabel}
341 % 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.
342 %
343 % 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.
344 %
345 % \iffalse
346 %<*main>
347 \expandafter\def\csname scrambledenvs@#1@label\endcsname{\MakeUppercase #1}
348 \scrambledenvs@check@macrodefined{#1label}
349 \expandafter\newcommand\csname #1label\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@label\endcsname{\MakeUppercase ##1}}
350 %</main>
351 % \fi
352 %
353 % \DescribeMacro{\hintlabelfont}
354 % 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|.
355 %
356 % Because this macro only takes in one argument, it is advisable to use |\bfseries| instead of |\textbf|, for instance.
357 %
358 % \iffalse
359 %<*main>
360 \expandafter\def\csname scrambledenvs@#1@labelfont\endcsname{\scrambledenvs@labelfont}
361 \scrambledenvs@check@macrodefined{#1labelfont}
362 \expandafter\newcommand\csname #1labelfont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@labelfont\endcsname{##1}}
363 %</main>
364 % \fi
365 % \changes{v1.1.0}{2021/09/26}{Added ref prefix}
366 % \DescribeMacro{\hintrefprefix}
367 % Sets the prefix before the reference. (This may be useful if you have multiple |\printhint| statements, like one at the end of each chapter.)
368 %
369 % \iffalse
370 %<*main>
371 \expandafter\def\csname scrambledenvs@#1@refprefix\endcsname{\scrambledenvs@refprefix}
372 \scrambledenvs@check@macrodefined{#1refprefix}
373 \expandafter\newcommand\csname #1refprefix\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@refprefix\endcsname{##1}}
374 %</main>
375 % \fi
376 % \DescribeMacro{\hintreffont}
377 % Sets the font of the numerical references the follows the label.
378 %
379 % 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.
380 %
381 % 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|.
382 %
383 % \iffalse
384 %<*main>
385 \expandafter\def\csname scrambledenvs@#1@reffont\endcsname{\scrambledenvs@reffont}
386 \scrambledenvs@check@macrodefined{#1reffont}
387 \expandafter\newcommand\csname #1reffont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@reffont\endcsname{##1}}
388 %</main>
389 % \fi
390 %
391 % \DescribeMacro{\hintprintenv}
392 % 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}|.
393 %
394 % To change these, write |\hintprintenv{new env beginning}{new env ending}|.
395 %
396 % \iffalse
397 %<*main>
398 \newenvironment{scrambledenvs@#1@printenv}{\begin{scrambledenvs@printenv}}{\end{scrambledenvs@printenv}}
399 \scrambledenvs@check@envdefined{#1printenv}
400 \expandafter\newcommand\csname #1printenv\endcsname[2]{\renewenvironment{scrambledenvs@#1@printenv}{##1}{##2}}
401 %</main>
402 % \fi
403 %
404 % \DescribeMacro{\hintprintitem}
405 % Each item of the randomized hints is printed with |\hintprintitem| at the beginning. By default it is |\item|.
406 %
407 % 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}|.
408 % \iffalse
409 %<*main>
410 \expandafter\def\csname scrambledenvs@#1@printitem\endcsname{\scrambledenvs@printitem}
411 \scrambledenvs@check@macrodefined{#1printitem}
412 \expandafter\newcommand\csname #1printitem\endcsname[1]{\expandafter\def\csname scrambledenvs@#1@printitem\endcsname{##1}}
413 %</main>
414 % \fi
415 %
416 % 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.)
417 %
418 % 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.
419 %
420 % Usage is identical to configuring formatting for specific scrambled environments.
421 %
422 % \DescribeMacro{\defaultlabelfont}
423 % Changes the default label font.
424 % \iffalse
425 %<*helper>
426 \def\scrambledenvs@labelfont{\bfseries}
427 \def\defaultlabelfont#1{\def\scrambledenvs@lineformat{#1}}
428 %</helper>
429 % \fi
430 %
431 % \DescribeMacro{\defaultrefprefix}
432 % Changes the default reference prefix.
433 % \iffalse
434 %<*helper>
435 \def\scrambledenvs@refprefix{}
436 \def\defaultrefprefix#1{\def\scrambledenvs@refprefix{#1}}
437 %</helper>
438 % \fi
439 %
440 % \DescribeMacro{\defaultreffont}
441 % Changes the default reference font.
442 % \iffalse
443 %<*helper>
444 \def\scrambledenvs@reffont{}
445 \def\defaultreffont#1{\def\scrambledenvs@reffont{#1}}
446 %</helper>
447 % \fi
448 %
449 % \DescribeMacro{\defaultprintenv}
450 % Changes the default print environment.
451 % \iffalse
452 %<*helper>
453 \newenvironment{scrambledenvs@printenv}{\begin{enumerate}}{\end{enumerate}}
454 \def\defaultprintenv#1#2{\renewenvironment{scrambledenvs@printenv}{#1}{#2}}
455 %</helper>
456 %\fi
457 %
458 % \DescribeMacro{\defaultprintitem}
459 % Changes the formatting of the default print item.
460 % \iffalse
461 %<*helper>
462 \def\scrambledenvs@printitem{\item}
463 \def\defaultprintitem#1{\def\scrambledenvs@printitem{#1}}
464 %</helper>
465 % \fi
466 %
467 % \section{Examples}
468 % In all of the examples, we use |hint| as our generic scrambled environment.
469 % \subsection{A barebones example}
470 %\begin{verbatim}
471 %\documentclass{article}
472 %\usepackage{scrambledenvs}
473 %\newscrambledenv{hint}
474 %
475 %\begin{document}
476 %This is a really hard problem, so we provide hints.\begin{hints}
477 %\begin{addhint}
478 %This is a helpful hint.
479 %\end{addhint}
480 %\begin{addhint}
481 %And another one!
482 %\end{addhint}
483 %\end{hints}
484 %
485 %\section{Hints printed}
486 %
487 %\printhint
488 %
489 %\end{document}
490 %\end{verbatim}
491 % \subsection{Changing hint formatting}
492 % 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.)
493 %\begin{verbatim}
494 %\documentclass{article}
495 %\usepackage{scrambledenvs}
496 %\usepackage{xcolor}
497 %\newscrambledenv{hint}
498 %\hintlabel{tip}
499 %\hintlabelfont{\textit}
500 %\hintreffont{\color{blue}\bfseries}
501 %\hintprintenv{\begin{enumerate}\small}{\end{enumerate}}
502 %\hintprintitem{\bfseries\item}
503 %\end{verbatim}
504 % \subsection{Changing hintreffont color: hyperrefs colorlink}
505 % 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.
506 %\begin{verbatim}
507 %\documentclass{article}
508 %\usepackage{scrambledenvs}
509 %\usepackage{xcolor}
510 %\usepackage{hyperref}
511 %\hypersetup{colorlinks}
512 %\newscrambledenv{hint}
513 %\hintreffont{\hypersetup{linkcolor=blue}}
514 %\end{verbatim}
515 %\subsection{Changing hint ref prefix}
516 %\begin{verbatim}
517 %\documentclass{article}
518 %\usepackage{scrambledenvs}
519 %\usepackage{xcolor}
520 %\usepackage{hyperref}
521 %\hypersetup{colorlinks}
522 %\newscrambledenv{hint}
523 %\hintrefprefix{\thesection.}
524 %\hintreffont{\color{blue}\hypersetup{linkcolor=blue}}
525 %\begin{document}
526 %\section{First Problem}
527 %This is a problem.
528 %\begin{hints}
529 %\begin{hint}
530 %This hint will be referenced as 1.1.
531 %\end{hint}
532 %\end{hints}
533 %\subsection{Hints}
534 %\printhint
535 %\section{Second Problem}
536 %This is another problem.
537 %\begin{hints}
538 %\begin{hint}
539 %This hint will be referenced as 2.1.
540 %\end{hint}
541 %\end{hints}
542 %\subsection{Hints}
543 %\printhint
544 %\end{document}
545 %\end{verbatim}
546 % ^^A At the end, close brace
547 %\iffalse
548 %<*main>
549 }
550 %</main>
551 %\fi
552 % \Finale
553 \endinput