texlive[55877] Master/texmf-dist: nimsticks (19jul20)
commits+karl at tug.org
commits+karl at tug.org
Sun Jul 19 23:25:40 CEST 2020
Revision: 55877
http://tug.org/svn/texlive?view=revision&revision=55877
Author: karl
Date: 2020-07-19 23:25:40 +0200 (Sun, 19 Jul 2020)
Log Message:
-----------
nimsticks (19jul20)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/nimsticks/README.md
trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf
trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx
trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty
Modified: trunk/Master/texmf-dist/doc/latex/nimsticks/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nimsticks/README.md 2020-07-19 21:25:23 UTC (rev 55876)
+++ trunk/Master/texmf-dist/doc/latex/nimsticks/README.md 2020-07-19 21:25:40 UTC (rev 55877)
@@ -20,6 +20,11 @@
## 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.
Modified: trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx 2020-07-19 21:25:23 UTC (rev 55876)
+++ trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx 2020-07-19 21:25:40 UTC (rev 55877)
@@ -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:
%
-%\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):
-%
%\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,9 +114,9 @@
\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}%
@@ -116,7 +123,7 @@
}%
\hspace{10mm}%
}%
- \end{center}%
+ \ifthenelse{\equal{#1}{inline}}{}{\end{center}}%
}
%</nimsticks>
%\fi
Modified: trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty 2020-07-19 21:25:23 UTC (rev 55876)
+++ trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty 2020-07-19 21:25:40 UTC (rev 55877)
@@ -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,9 +59,9 @@
\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}%
@@ -67,7 +68,7 @@
}%
\hspace{10mm}%
}%
- \end{center}%
+ \ifthenelse{\equal{#1}{inline}}{}{\end{center}}%
}
\endinput
%%
More information about the tex-live-commits
mailing list.