texlive[60141] Master: scrambledenvs (1aug21)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 1 22:37:51 CEST 2021


Revision: 60141
          http://tug.org/svn/texlive?view=revision&revision=60141
Author:   karl
Date:     2021-08-01 22:37:51 +0200 (Sun, 01 Aug 2021)
Log Message:
-----------
scrambledenvs (1aug21)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/scrambledenvs/
    trunk/Master/texmf-dist/doc/latex/scrambledenvs/README.md
    trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf
    trunk/Master/texmf-dist/source/latex/scrambledenvs/
    trunk/Master/texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx
    trunk/Master/texmf-dist/tex/latex/scrambledenvs/
    trunk/Master/texmf-dist/tex/latex/scrambledenvs/scrambledenvs.sty
    trunk/Master/tlpkg/tlpsrc/scrambledenvs.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/scrambledenvs/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scrambledenvs/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/scrambledenvs/README.md	2021-08-01 20:37:51 UTC (rev 60141)
@@ -0,0 +1,15 @@
+# The LaTeX package scrambledenvs - version 1.0.0 (2021/07/31)
+
+**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.
+
+


Property changes on: trunk/Master/texmf-dist/doc/latex/scrambledenvs/README.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf	2021-08-01 20:37:16 UTC (rev 60140)
+++ trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf	2021-08-01 20:37:51 UTC (rev 60141)

Property changes on: trunk/Master/texmf-dist/doc/latex/scrambledenvs/scrambledenvs.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx	2021-08-01 20:37:51 UTC (rev 60141)
@@ -0,0 +1,472 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2021 Dennis Chen <proofprogram at 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.0.0 (2021/07/31)
+
+**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 at 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/07/31 v1.0.0 Create and print scrambled environments]
+\RequirePackage{forloop}
+\RequirePackage{pgfmath}
+\pgfmathsetseed{2407}
+%</main>
+%<*driver>
+\ProvidesFile{\jobname.dtx}[2021/07/31 v1.0.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.0}{2021/07/31}{Initial version}
+%
+% \renewcommand{\emph}[1]{\textbf{#1}}
+%
+% \title{\textsf{scrambledenvs} -- Create and print scrambled environments}
+% \author{Dennis Chen \\ proofprogram at 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 at scramble\scrambledenvs at scrambletrue
+\DeclareOption{noscramble}{\scrambledenvs at 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 at check@macrodefined{print#1}
+    \scrambledenvs at check@envdefined{#1s}
+    \scrambledenvs at check@envdefined{#1}
+    \newcounter{scrambledenvs@#1 at count}
+    \newcounter{scrambledenvs@#1 at tempcount}
+%</main>
+%<*helper>
+\newcommand\scrambledenvs at 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 at 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}
+% 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 at active{}
+%</helper>
+%<*main>
+\newenvironment{#1s}{%
+    \setcounter{scrambledenvs@#1 at tempcount}{0}%
+    \def\scrambledenvs at active{#1}%
+    \unskip\ignorespaces%
+}
+{
+\ifnum\value{scrambledenvs@#1 at tempcount}=0\relax
+\else
+    \ifnum\value{scrambledenvs@#1 at tempcount}=1\relax
+        {\csname scrambledenvs@#1 at labelfont\endcsname\csname scrambledenvs@#1 at label\endcsname :}
+        {\csname scrambledenvs@#1 at reffont\endcsname\ref{#1:\value{scrambledenvs@#1 at count}}}%
+    \else
+        {\csname scrambledenvs@#1 at labelfont\endcsname\csname scrambledenvs@#1 at label\endcsname s:}%
+        \forloop{scrambledenvs at loopcount}{\the\numexpr\value{scrambledenvs@#1 at count}-\value{scrambledenvs@#1 at tempcount}+1\relax}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax} {
+            {\csname scrambledenvs@#1 at reffont\endcsname\ref{#1:\thescrambledenvs at loopcount}}%
+        }
+    \fi
+\fi
+\setcounter{scrambledenvs@#1 at 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 at tempcount}%
+    \stepcounter{scrambledenvs@#1 at count}%
+    \ifnum\pdfstrcmp{#1}{\scrambledenvs at 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 at count}.#1}%
+}
+{%
+    \endfilecontents
+}
+%</main>
+% \fi
+%
+% \DescribeMacro{\printhint}
+%
+% To print out the hints (either in a random or fixed order, depending on whether the option |noscramble| is passed in), just write |\printhint|.
+%
+% \iffalse
+%<*helper>
+\newcounter{scrambledenvs at loopcount}
+\newcounter{scrambledenvs at innerloopcount}
+%</helper>
+%<*main>
+\expandafter\newcommand\csname print#1\endcsname{%
+    \ifscrambledenvs at scramble %\if
+        \ifcsname thescrambledenvs@#1 at count\endcsname
+            \ifnum\value{scrambledenvs@#1 at count}>0\relax
+                \expandafter\edef\csname pgfmath at randomlist@#1\endcsname{\value{scrambledenvs@#1 at count}}%
+                \forloop{scrambledenvs at loopcount}{1}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax}{\expandafter\edef\csname pgfmath at randomlist@#1@\thescrambledenvs at loopcount\endcsname{\thescrambledenvs at loopcount}}%
+                \begin{scrambledenvs@#1 at printenv}%
+                    \forloop{scrambledenvs at loopcount}{0}{\value{scrambledenvs at loopcount}<\value{scrambledenvs@#1 at count}}{%
+                        \pgfmathrandomitem\scrambledenvs at tempindex{#1}%
+                        \csname scrambledenvs@#1 at printitem\endcsname\label{#1:\scrambledenvs at tempindex}%
+                        \input{\jobname-\scrambledenvs at tempindex.#1}%
+                        \forloop{scrambledenvs at innerloopcount}{\scrambledenvs at tempindex}{\value{scrambledenvs at innerloopcount}<\csname pgfmath at randomlist@#1\endcsname}{%
+                            \global\expandafter\let\csname pgfmath at randomlist@#1@\thescrambledenvs at innerloopcount\expandafter\endcsname\csname pgfmath at randomlist@#1@\the\numexpr\thescrambledenvs at innerloopcount+1\relax\endcsname%
+                        }%
+                        \expandafter\xdef\csname pgfmath at randomlist@#1\endcsname{\the\numexpr\csname pgfmath at randomlist@#1\endcsname-1\relax}%
+                    }%
+                \end{scrambledenvs@#1 at printenv}
+            \fi
+        \fi
+    \else
+        \ifcsname thescrambledenvs@#1 at count\endcsname
+            \ifnum\value{scrambledenvs@#1 at count}>0\relax
+                \begin{scrambledenvs@#1 at printenv}%
+                    \forloop{scrambledenvs at loopcount}{1}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax}{\csname scrambledenvs@#1 at printitem\endcsname\label{#1:\thescrambledenvs at loopcount}\input{\jobname-\thescrambledenvs at loopcount.#1}}%
+                \end{scrambledenvs@#1 at printenv}
+            \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 at label\endcsname{\MakeUppercase #1}
+\scrambledenvs at check@macrodefined{#1label}
+\expandafter\newcommand\csname #1label\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at 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 at labelfont\endcsname{\scrambledenvs at labelfont}
+\scrambledenvs at check@macrodefined{#1labelfont}
+\expandafter\newcommand\csname #1labelfont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at labelfont\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.
+%
+% \iffalse
+%<*main>
+\expandafter\def\csname scrambledenvs@#1 at reffont\endcsname{\scrambledenvs at reffont}
+\scrambledenvs at check@macrodefined{#1reffont}
+\expandafter\newcommand\csname #1reffont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at 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 at printenv}{\begin{scrambledenvs at printenv}}{\end{scrambledenvs at printenv}}
+\scrambledenvs at check@envdefined{#1printenv}
+\expandafter\newcommand\csname #1printenv\endcsname[2]{\renewenvironment{scrambledenvs@#1 at 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 at printitem\endcsname{\scrambledenvs at printitem}
+\scrambledenvs at check@macrodefined{#1printitem}
+\expandafter\newcommand\csname #1printitem\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at 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 at labelfont{\bfseries}
+\def\defaultlabelfont#1{\def\scrambledenvs at lineformat{#1}}
+%</helper>
+% \fi
+%
+% \DescribeMacro{\defaultreffont}
+% Changes the default reference font.
+% \iffalse
+%<*helper>
+\def\scrambledenvs at reffont{}
+\def\defaultreffont#1{\def\scrambledenvs at reffont{#1}}
+%</helper>
+% \fi
+%
+% \DescribeMacro{\defaultprintenv}
+% Changes the default print environment.
+% \iffalse
+%<*helper>
+\newenvironment{scrambledenvs at printenv}{\begin{enumerate}}{\end{enumerate}}
+\def\defaultprintenv#1#2{\renewenvironment{scrambledenvs at printenv}{#1}{#2}}
+%</helper>
+%\fi
+%
+% \DescribeMacro{\defaultprintitem}
+% Changes the formatting of the default print item.
+% \iffalse
+%<*helper>
+\def\scrambledenvs at printitem{\item}
+\def\defaultprintitem#1{\def\scrambledenvs at 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: hpyerrefs 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}
+% ^^A At the end, close brace
+%\iffalse
+%<*main>
+}
+%</main>
+%\fi
+% \Finale
+\endinput
\ No newline at end of file


Property changes on: trunk/Master/texmf-dist/source/latex/scrambledenvs/scrambledenvs.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/scrambledenvs/scrambledenvs.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/scrambledenvs/scrambledenvs.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/scrambledenvs/scrambledenvs.sty	2021-08-01 20:37:51 UTC (rev 60141)
@@ -0,0 +1,153 @@
+%%
+%% This is file `scrambledenvs.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% scrambledenvs.dtx  (with options: `main')
+%% scrambledenvs.dtx  (with options: `helper')
+%% 
+%% This is a generated file.
+%% 
+%% Copyright (C) 2021 Dennis Chen <proofprogram at 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.
+%% 
+
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{scrambledenvs}[2021/07/31 v1.0.0 Create and print scrambled environments]
+\RequirePackage{forloop}
+\RequirePackage{pgfmath}
+\pgfmathsetseed{2407}
+\newif\ifscrambledenvs at scramble\scrambledenvs at scrambletrue
+\DeclareOption{noscramble}{\scrambledenvs at scramblefalse}
+\ProcessOptions\relax
+\newcommand\newscrambledenv[1]{
+    \scrambledenvs at check@macrodefined{print#1}
+    \scrambledenvs at check@envdefined{#1s}
+    \scrambledenvs at check@envdefined{#1}
+    \newcounter{scrambledenvs@#1 at count}
+    \newcounter{scrambledenvs@#1 at tempcount}
+\newenvironment{#1s}{%
+    \setcounter{scrambledenvs@#1 at tempcount}{0}%
+    \def\scrambledenvs at active{#1}%
+    \unskip\ignorespaces%
+}
+{
+\ifnum\value{scrambledenvs@#1 at tempcount}=0\relax
+\else
+    \ifnum\value{scrambledenvs@#1 at tempcount}=1\relax
+        {\csname scrambledenvs@#1 at labelfont\endcsname\csname scrambledenvs@#1 at label\endcsname :}
+        {\csname scrambledenvs@#1 at reffont\endcsname\ref{#1:\value{scrambledenvs@#1 at count}}}%
+    \else
+        {\csname scrambledenvs@#1 at labelfont\endcsname\csname scrambledenvs@#1 at label\endcsname s:}%
+        \forloop{scrambledenvs at loopcount}{\the\numexpr\value{scrambledenvs@#1 at count}-\value{scrambledenvs@#1 at tempcount}+1\relax}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax} {
+            {\csname scrambledenvs@#1 at reffont\endcsname\ref{#1:\thescrambledenvs at loopcount}}%
+        }
+    \fi
+\fi
+\setcounter{scrambledenvs@#1 at tempcount}{0}%
+}
+\newenvironment{#1}{%
+    \stepcounter{scrambledenvs@#1 at tempcount}%
+    \stepcounter{scrambledenvs@#1 at count}%
+    \ifnum\pdfstrcmp{#1}{\scrambledenvs at 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 at count}.#1}%
+}
+{%
+    \endfilecontents
+}
+\expandafter\newcommand\csname print#1\endcsname{%
+    \ifscrambledenvs at scramble %\if
+        \ifcsname thescrambledenvs@#1 at count\endcsname
+            \ifnum\value{scrambledenvs@#1 at count}>0\relax
+                \expandafter\edef\csname pgfmath at randomlist@#1\endcsname{\value{scrambledenvs@#1 at count}}%
+                \forloop{scrambledenvs at loopcount}{1}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax}{\expandafter\edef\csname pgfmath at randomlist@#1@\thescrambledenvs at loopcount\endcsname{\thescrambledenvs at loopcount}}%
+                \begin{scrambledenvs@#1 at printenv}%
+                    \forloop{scrambledenvs at loopcount}{0}{\value{scrambledenvs at loopcount}<\value{scrambledenvs@#1 at count}}{%
+                        \pgfmathrandomitem\scrambledenvs at tempindex{#1}%
+                        \csname scrambledenvs@#1 at printitem\endcsname\label{#1:\scrambledenvs at tempindex}%
+                        \input{\jobname-\scrambledenvs at tempindex.#1}%
+                        \forloop{scrambledenvs at innerloopcount}{\scrambledenvs at tempindex}{\value{scrambledenvs at innerloopcount}<\csname pgfmath at randomlist@#1\endcsname}{%
+                            \global\expandafter\let\csname pgfmath at randomlist@#1@\thescrambledenvs at innerloopcount\expandafter\endcsname\csname pgfmath at randomlist@#1@\the\numexpr\thescrambledenvs at innerloopcount+1\relax\endcsname%
+                        }%
+                        \expandafter\xdef\csname pgfmath at randomlist@#1\endcsname{\the\numexpr\csname pgfmath at randomlist@#1\endcsname-1\relax}%
+                    }%
+                \end{scrambledenvs@#1 at printenv}
+            \fi
+        \fi
+    \else
+        \ifcsname thescrambledenvs@#1 at count\endcsname
+            \ifnum\value{scrambledenvs@#1 at count}>0\relax
+                \begin{scrambledenvs@#1 at printenv}%
+                    \forloop{scrambledenvs at loopcount}{1}{\value{scrambledenvs at loopcount}<\the\numexpr\value{scrambledenvs@#1 at count}+1\relax}{\csname scrambledenvs@#1 at printitem\endcsname\label{#1:\thescrambledenvs at loopcount}\input{\jobname-\thescrambledenvs at loopcount.#1}}%
+                \end{scrambledenvs@#1 at printenv}
+            \fi
+        \fi
+    \fi
+}
+\expandafter\def\csname scrambledenvs@#1 at label\endcsname{\MakeUppercase #1}
+\scrambledenvs at check@macrodefined{#1label}
+\expandafter\newcommand\csname #1label\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at label\endcsname{\MakeUppercase ##1}}
+\expandafter\def\csname scrambledenvs@#1 at labelfont\endcsname{\scrambledenvs at labelfont}
+\scrambledenvs at check@macrodefined{#1labelfont}
+\expandafter\newcommand\csname #1labelfont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at labelfont\endcsname{##1}}
+\expandafter\def\csname scrambledenvs@#1 at reffont\endcsname{\scrambledenvs at reffont}
+\scrambledenvs at check@macrodefined{#1reffont}
+\expandafter\newcommand\csname #1reffont\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at reffont\endcsname{##1}}
+\newenvironment{scrambledenvs@#1 at printenv}{\begin{scrambledenvs at printenv}}{\end{scrambledenvs at printenv}}
+\scrambledenvs at check@envdefined{#1printenv}
+\expandafter\newcommand\csname #1printenv\endcsname[2]{\renewenvironment{scrambledenvs@#1 at printenv}{##1}{##2}}
+\expandafter\def\csname scrambledenvs@#1 at printitem\endcsname{\scrambledenvs at printitem}
+\scrambledenvs at check@macrodefined{#1printitem}
+\expandafter\newcommand\csname #1printitem\endcsname[1]{\expandafter\def\csname scrambledenvs@#1 at printitem\endcsname{##1}}
+}
+
+
+\newcommand\scrambledenvs at 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 at 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
+}
+\def\scrambledenvs at active{}
+\newcounter{scrambledenvs at loopcount}
+\newcounter{scrambledenvs at innerloopcount}
+\def\scrambledenvs at labelfont{\bfseries}
+\def\defaultlabelfont#1{\def\scrambledenvs at lineformat{#1}}
+\def\scrambledenvs at reffont{}
+\def\defaultreffont#1{\def\scrambledenvs at reffont{#1}}
+\newenvironment{scrambledenvs at printenv}{\begin{enumerate}}{\end{enumerate}}
+\def\defaultprintenv#1#2{\renewenvironment{scrambledenvs at printenv}{#1}{#2}}
+\def\scrambledenvs at printitem{\item}
+\def\defaultprintitem#1{\def\scrambledenvs at printitem{#1}}
+%% 
+%% This package consists of the file scrambledenvs.dtx,
+%%           and the generated files scrambledenvs.sty,
+%%                                   scrambledenvs.pdf.
+%%
+%% End of file `scrambledenvs.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/scrambledenvs/scrambledenvs.sty
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-08-01 20:37:16 UTC (rev 60140)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2021-08-01 20:37:51 UTC (rev 60141)
@@ -687,7 +687,7 @@
     schulmathematik sclang-prettifier
     schule schulschriften schwalbe-chess
     sciposter scientific-thesis-cover scontents
-    scratch scratch3 scratchx screenplay screenplay-pkg
+    scrambledenvs scratch scratch3 scratchx screenplay screenplay-pkg
     scrjrnl scrlayer-fancyhdr scrlttr2copy scsnowman
     sdaps sdrt sduthesis
     secdot secnum section sectionbox sectionbreak sectsty seealso

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2021-08-01 20:37:16 UTC (rev 60140)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2021-08-01 20:37:51 UTC (rev 60141)
@@ -1081,6 +1081,7 @@
 depend schedule
 depend schooldocs
 depend scontents
+depend scrambledenvs
 depend scrlayer-fancyhdr
 depend scrlttr2copy
 depend sdaps

Added: trunk/Master/tlpkg/tlpsrc/scrambledenvs.tlpsrc
===================================================================


More information about the tex-live-commits mailing list.