summaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-07-20 03:02:49 +0000
committerNorbert Preining <norbert@preining.info>2020-07-20 03:02:49 +0000
commit7a37d65d52056a1500d4602172582154994bea64 (patch)
tree884e4a18a0c9bcdb3fbcddd00780ff2aa6148bdd /graphics
parentcb4763b32d8bccc6791fb91ac5ce29f59163bf1a (diff)
CTAN sync 202007200302
Diffstat (limited to 'graphics')
-rw-r--r--graphics/pgf/contrib/nimsticks/README.md5
-rw-r--r--graphics/pgf/contrib/nimsticks/nimsticks.dtx27
-rw-r--r--graphics/pgf/contrib/nimsticks/nimsticks.pdfbin75983 -> 78122 bytes
3 files changed, 22 insertions, 10 deletions
diff --git a/graphics/pgf/contrib/nimsticks/README.md b/graphics/pgf/contrib/nimsticks/README.md
index 28115c95ad..bc1d5a50f5 100644
--- a/graphics/pgf/contrib/nimsticks/README.md
+++ b/graphics/pgf/contrib/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/graphics/pgf/contrib/nimsticks/nimsticks.dtx b/graphics/pgf/contrib/nimsticks/nimsticks.dtx
index cad291987e..16e814d026 100644
--- a/graphics/pgf/contrib/nimsticks/nimsticks.dtx
+++ b/graphics/pgf/contrib/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}}%
}
%</nimsticks>
%\fi
diff --git a/graphics/pgf/contrib/nimsticks/nimsticks.pdf b/graphics/pgf/contrib/nimsticks/nimsticks.pdf
index 34c70995cc..b2ee41b24d 100644
--- a/graphics/pgf/contrib/nimsticks/nimsticks.pdf
+++ b/graphics/pgf/contrib/nimsticks/nimsticks.pdf
Binary files differ