From 57db2136844339b947bf0af8c518487514f8cee1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 19 Jul 2020 21:25:40 +0000 Subject: nimsticks (19jul20) git-svn-id: svn://tug.org/texlive/trunk@55877 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/nimsticks/README.md | 5 ++++ .../texmf-dist/doc/latex/nimsticks/nimsticks.pdf | Bin 75983 -> 78122 bytes .../source/latex/nimsticks/nimsticks.dtx | 27 +++++++++++++-------- .../texmf-dist/tex/latex/nimsticks/nimsticks.sty | 11 +++++---- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/Master/texmf-dist/doc/latex/nimsticks/README.md b/Master/texmf-dist/doc/latex/nimsticks/README.md index 28115c95ad5..bc1d5a50f50 100644 --- a/Master/texmf-dist/doc/latex/nimsticks/README.md +++ b/Master/texmf-dist/doc/latex/nimsticks/README.md @@ -20,6 +20,11 @@ This work may be distributed and/or modified under the conditions of the [MIT li ## Changes +### [1.1] - 2020-07-19 + +- Added option to create inline Nim game using `\nimgame[inline]{}`. +- Added this and made other minor tweaks to documentation. + ### [1.0.1] - 2020-07-12 - Fixed typo in usage example in documentation. diff --git a/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf b/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf index 34c70995cc3..b2ee41b24de 100644 Binary files a/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf and b/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf differ diff --git a/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx b/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx index cad291987e3..16e814d026a 100644 --- a/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx +++ b/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx @@ -35,18 +35,24 @@ % %\section{Usage} % -%For example, the input \lstinline!\nimgame{5,3,4}! will produce output like this (precise look affected by random wobble in the sticks): +%N.B. The precise look of example output in this section is affected by random wobble in the sticks. +% +%For example, the input \lstinline!\nimgame{5,3,4}! will produce output like this: % %\nimgame{5,3,4} % %This is designed to look like a 3-pile Nim game with 5 sticks in the first pile (or heap), 3 in the second and 4 in the third. % -%It is likely the user will want to use \lstinline{\nimgame} and not \lstinline{\drawnimstick} directly, but the input \lstinline{\drawnimstick} will produce output like this (precise look affected by random wobble in the sticks): \drawnimstick -% -%\lstinline{\nimgame} will happily work with one heap, so for example the input \lstinline!\nimgame{7}! will produce output like this (precise look affected by random wobble in the sticks): +%\lstinline{\nimgame} will happily work with one heap, so for example the input \lstinline!\nimgame{7}! will produce output like this: % %\nimgame{7} % +%The command \lstinline{\nimgame} presents the Nim game within \lstinline!\begin{center}...\end{center}!. An optional flag \lstinline{inline} can be used to produce the Nim game without the \lstinline{center} environment. For example, the command \lstinline!\nimgame[inline]{5,3,4}! will produce outline like this: \nimgame[inline]{5,3,4} +% +%One reason for this is that \lstinline{\nimgame} will not work in a \lstinline{standalone} document with the \lstinline{crop} option unless the \lstinline{inline} option is used. +% +%It is likely the user will want to use \lstinline{\nimgame} and not \lstinline{\drawnimstick} directly, but the input \lstinline{\drawnimstick} will produce output like this: \drawnimstick +% %\section{Issues} % %There is no limit in the code to the number of piles or the number in a pile, but this code doesn't do anything to cope when line breaks start happening, and presumably there is a computational limit. @@ -64,7 +70,7 @@ \usepackage{doc} \usepackage{listings} \lstset{basicstyle=\ttfamily\footnotesize,commentstyle=\color{white},language=TeX} -\title{nimsticks v1.0.1} +\title{nimsticks v1.1} \author{Peter Rowlett} \begin{document} \maketitle @@ -75,9 +81,10 @@ %\iffalse %<*nimsticks> -\ProvidesPackage{nimsticks}[2020/07/12 nimsticks 1.0.1] +\ProvidesPackage{nimsticks}[2020/07/19 nimsticks 1.1] \RequirePackage[first=-100,last=100,seed=0]{lcg} \RequirePackage{tikz} +\RequirePackage{ifthen} \@ifundefined{drawnimstick}{} {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}} \@ifundefined{nimgame}{} @@ -107,16 +114,16 @@ \draw[very thick] (\topx,0) -- (\botx,0.5);% \end{tikzpicture}% } -\newcommand{\nimgame}[1]{% - \begin{center}% - \def\listofgames{#1}% +\newcommand{\nimgame}[2][block]{% + \ifthenelse{\equal{#1}{inline}}{}{\begin{center}}% + \def\listofgames{#2}% \foreach \heap in \listofgames {% \foreach \heapindex in {1, ..., \heap} {% \drawnimstick\hspace{0.5mm}% }% \hspace{10mm}% }% - \end{center}% + \ifthenelse{\equal{#1}{inline}}{}{\end{center}}% } % %\fi diff --git a/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty b/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty index ae3241b7b24..c00c10004ae 100644 --- a/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty +++ b/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty @@ -26,9 +26,10 @@ %% SOFTWARE. %% -\ProvidesPackage{nimsticks}[2020/07/12 nimsticks 1.0.1] +\ProvidesPackage{nimsticks}[2020/07/19 nimsticks 1.1] \RequirePackage[first=-100,last=100,seed=0]{lcg} \RequirePackage{tikz} +\RequirePackage{ifthen} \@ifundefined{drawnimstick}{} {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}} \@ifundefined{nimgame}{} @@ -58,16 +59,16 @@ \draw[very thick] (\topx,0) -- (\botx,0.5);% \end{tikzpicture}% } -\newcommand{\nimgame}[1]{% - \begin{center}% - \def\listofgames{#1}% +\newcommand{\nimgame}[2][block]{% + \ifthenelse{\equal{#1}{inline}}{}{\begin{center}}% + \def\listofgames{#2}% \foreach \heap in \listofgames {% \foreach \heapindex in {1, ..., \heap} {% \drawnimstick\hspace{0.5mm}% }% \hspace{10mm}% }% - \end{center}% + \ifthenelse{\equal{#1}{inline}}{}{\end{center}}% } \endinput %% -- cgit v1.2.3