texlive[55821] Master: nimsticks (12jul20)

commits+karl at tug.org commits+karl at tug.org
Sun Jul 12 22:03:02 CEST 2020


Revision: 55821
          http://tug.org/svn/texlive?view=revision&revision=55821
Author:   karl
Date:     2020-07-12 22:03:01 +0200 (Sun, 12 Jul 2020)
Log Message:
-----------
nimsticks (12jul20)

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

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/nimsticks/
    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/
    trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx
    trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.ins
    trunk/Master/texmf-dist/tex/latex/nimsticks/
    trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty
    trunk/Master/tlpkg/tlpsrc/nimsticks.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/nimsticks/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nimsticks/README.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/nimsticks/README.md	2020-07-12 20:03:01 UTC (rev 55821)
@@ -0,0 +1,19 @@
+# nimsticks: LaTeX package for drawing Nim sticks and games
+
+nimsticks is a package for LaTeX that should also work with LuaTeX and XeTeX, that draws sticks for representating games of multi-pile Nim.
+
+By [Peter Rowlett](https://github.com/prowlett/).
+
+## Background
+
+Nim objects could be anything, of course, but conventionally sticks or stones are used. There are various types of dot in LaTeX that might look like stones, but somehow a line of dots didn't seem satisfactory. There are various ways to draw a line (e.g. just typing IIIII), including some tally markers (e.g. in hhcount). My problem with these (call me picky) is that they are all identical lines, and a `heap' of them just looks very organised. Really, I want a set of lines that looks like someone just threw them into heaps (though probably without crossings for the avoidance of ambiguity).
+
+The way this works is it draws a thick vertical line in TikZ with a little wobble added so each one doesn't look extremely well-lined-up with its neighbour, achieved by adding or subtracting a small random number to the top and bottom coordinate.
+
+It does this by providing two commands:
+
+- `\drawnimstick`: draws a single Nim stick with a little random wobble;
+- `\nimgame`: takes a comma-separated list of numbers and draws a line of Nim heaps holding those number of sticks.
+
+## Licensing
+This work may be distributed and/or modified under the conditions of the [MIT license](LICENSE.txt).


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

Index: trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf	2020-07-12 20:02:01 UTC (rev 55820)
+++ trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf	2020-07-12 20:03:01 UTC (rev 55821)

Property changes on: trunk/Master/texmf-dist/doc/latex/nimsticks/nimsticks.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx	2020-07-12 20:03:01 UTC (rev 55821)
@@ -0,0 +1,122 @@
+%\iffalse meta-comment
+%Copyright (c) 2020 Peter Rowlett
+%
+%Permission is hereby granted, free of charge, to any person obtaining a copy
+%of this software and associated documentation files (the "Software"), to deal
+%in the Software without restriction, including without limitation the rights
+%to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%copies of the Software, and to permit persons to whom the Software is
+%furnished to do so, subject to the following conditions:
+%
+%The above copyright notice and this permission notice shall be included in all
+%copies or substantial portions of the Software.
+%
+%THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+%SOFTWARE.
+%\fi
+%\section{Background}
+%
+%\lstinline{nimsticks} is a package for \LaTeX{} that draws sticks for representating games of multi-pile Nim. 
+%
+%Nim objects could be anything, of course, but conventionally sticks or stones are used. There are various types of dot in LaTeX that might look like stones, but somehow a line of dots didn't seem satisfactory. There are various ways to draw a line (e.g. just typing IIIII), including some tally markers (e.g. in hhcount). My problem with these (call me picky) is that they are all identical lines, and a `heap' of them just looks very organised. Really, I want a set of lines that looks like someone just threw them into heaps (though probably without crossings for the avoidance of ambiguity).
+%
+%The way this works is it draws a thick vertical line in TikZ with a little wobble added so each one doesn't look extremely well-lined-up with its neighbour, achieved by adding or subtracting a small random number to the top and bottom coordinate. 
+%
+%It does this by providing two commands: 
+%\begin{itemize}
+%\item \lstinline{\drawnimstick}: draws a single Nim stick with a little random wobble;
+%\item \lstinline{\nimgame}: takes a comma-separated list of numbers and draws a line of Nim heaps holding those number of sticks.
+%\end{itemize}
+%
+%\section{Usage}
+%
+%For example, the input \lstinline!\nimgame{3,5,4}! will produce output like this (precise look affected by random wobble in the sticks):
+%
+%\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 the input \lstinline!\nimgame{7}! will produce output like this (precise look affected by random wobble in the sticks):
+%
+%\nimgame{7}
+%
+%\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.
+%
+%In principle, if you add lots of piles it will just wrap onto multiple lines, though it will start to look less clear. For example, the input\\
+%\lstinline!\nimgame{1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1}!\\
+%will produce the output:
+%\nimgame{1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1}
+%Similarly, if you have a lot of sticks in the same heap, it will wrap and look confusing, for example the input \lstinline!\nimgame{128}! will produce the output:
+%\nimgame{256}
+%\iffalse
+%<*documentation>
+\documentclass{article}
+\usepackage{nimsticks}
+\usepackage{doc}
+\usepackage{listings}
+\lstset{basicstyle=\ttfamily\footnotesize,commentstyle=\color{white},language=TeX}
+\title{nimsticks}
+\author{Peter Rowlett}
+\begin{document}
+\maketitle
+    \DocInput{nimsticks.dtx}
+\end{document}
+%</documentation>
+%\fi
+
+%\iffalse
+%<*nimsticks>
+\ProvidesPackage{nimsticks}[2020/07/12 nimsticks 1.0]
+\RequirePackage[first=-100,last=100,seed=0]{lcg}
+\RequirePackage{tikz}
+\@ifundefined{drawnimstick}{}
+    {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}}
+\@ifundefined{nimgame}{}
+    {\PackageWarning{nimsticks}{Command `nimgame' already defined}}
+\@ifundefined{listofgames}{}
+    {\PackageWarning{nimsticks}{Command `listofgames' already defined}}
+\@ifundefined{c at topx}{}
+    {\PackageWarning{nimsticks}{Counter `topx' already defined}}
+\@ifundefined{topx}{}
+    {\PackageWarning{nimsticks}{Existing command `topx' conflicts with counter `topx'}}
+\@ifundefined{c at botx}{}
+    {\PackageWarning{nimsticks}{Counter `botx' already defined}}
+\@ifundefined{botx}{}
+    {\PackageWarning{nimsticks}{Existing command `botx' conflicts with counter `botx'}}
+\@ifundefined{c at heap}{}
+    {\PackageWarning{nimsticks}{Counter `heap' already defined}}
+\@ifundefined{heap}{}
+    {\PackageWarning{nimsticks}{Existing command `heap' conflicts with counter `heap'}}
+\@ifundefined{c at heapindex}{}
+    {\PackageWarning{nimsticks}{Counter `heapindex' already defined}}
+\@ifundefined{heapindex}{}
+    {\PackageWarning{nimsticks}{Existing command `heapindex' conflicts with counter `heapindex'}}
+\newcommand{\drawnimstick}{%
+    \rand\pgfmathsetmacro{\topx}{(\the\value{rand})/1000}%
+    \rand\pgfmathsetmacro{\botx}{(\the\value{rand})/1000}%
+    \begin{tikzpicture}%
+         \draw[very thick] (\topx,0) -- (\botx,0.5);%
+    \end{tikzpicture}%
+}
+\newcommand{\nimgame}[1]{%
+    \begin{center}%
+        \def\listofgames{#1}%
+        \foreach \heap in \listofgames {%
+            \foreach \heapindex in {1, ..., \heap} {%
+                \drawnimstick\hspace{0.5mm}%
+            }%
+            \hspace{10mm}%
+        }%
+    \end{center}%
+}
+%</nimsticks>
+%\fi


Property changes on: trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.ins	2020-07-12 20:03:01 UTC (rev 55821)
@@ -0,0 +1,30 @@
+\input{docstrip.tex}
+\keepsilent
+\usedir{tex/latex/nimsticks}
+\preamble
+Copyright (c) 2020 Peter Rowlett
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+\endpreamble
+\askforoverwritefalse
+\generate{
+  \file{nimsticks.sty}{\from{nimsticks.dtx}{nimsticks}}
+}
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty	2020-07-12 20:03:01 UTC (rev 55821)
@@ -0,0 +1,74 @@
+%%
+%% This is file `nimsticks.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% nimsticks.dtx  (with options: `nimsticks')
+%% Copyright (c) 2020 Peter Rowlett
+%% 
+%% Permission is hereby granted, free of charge, to any person obtaining a copy
+%% of this software and associated documentation files (the "Software"), to deal
+%% in the Software without restriction, including without limitation the rights
+%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+%% copies of the Software, and to permit persons to whom the Software is
+%% furnished to do so, subject to the following conditions:
+%% 
+%% The above copyright notice and this permission notice shall be included in all
+%% copies or substantial portions of the Software.
+%% 
+%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+%% SOFTWARE.
+%% 
+
+\ProvidesPackage{nimsticks}[2020/07/12 nimsticks 1.0]
+\RequirePackage[first=-100,last=100,seed=0]{lcg}
+\RequirePackage{tikz}
+\@ifundefined{drawnimstick}{}
+    {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}}
+\@ifundefined{nimgame}{}
+    {\PackageWarning{nimsticks}{Command `nimgame' already defined}}
+\@ifundefined{listofgames}{}
+    {\PackageWarning{nimsticks}{Command `listofgames' already defined}}
+\@ifundefined{c at topx}{}
+    {\PackageWarning{nimsticks}{Counter `topx' already defined}}
+\@ifundefined{topx}{}
+    {\PackageWarning{nimsticks}{Existing command `topx' conflicts with counter `topx'}}
+\@ifundefined{c at botx}{}
+    {\PackageWarning{nimsticks}{Counter `botx' already defined}}
+\@ifundefined{botx}{}
+    {\PackageWarning{nimsticks}{Existing command `botx' conflicts with counter `botx'}}
+\@ifundefined{c at heap}{}
+    {\PackageWarning{nimsticks}{Counter `heap' already defined}}
+\@ifundefined{heap}{}
+    {\PackageWarning{nimsticks}{Existing command `heap' conflicts with counter `heap'}}
+\@ifundefined{c at heapindex}{}
+    {\PackageWarning{nimsticks}{Counter `heapindex' already defined}}
+\@ifundefined{heapindex}{}
+    {\PackageWarning{nimsticks}{Existing command `heapindex' conflicts with counter `heapindex'}}
+\newcommand{\drawnimstick}{%
+    \rand\pgfmathsetmacro{\topx}{(\the\value{rand})/1000}%
+    \rand\pgfmathsetmacro{\botx}{(\the\value{rand})/1000}%
+    \begin{tikzpicture}%
+         \draw[very thick] (\topx,0) -- (\botx,0.5);%
+    \end{tikzpicture}%
+}
+\newcommand{\nimgame}[1]{%
+    \begin{center}%
+        \def\listofgames{#1}%
+        \foreach \heap in \listofgames {%
+            \foreach \heapindex in {1, ..., \heap} {%
+                \drawnimstick\hspace{0.5mm}%
+            }%
+            \hspace{10mm}%
+        }%
+    \end{center}%
+}
+\endinput
+%%
+%% End of file `nimsticks.sty'.


Property changes on: trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.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	2020-07-12 20:02:01 UTC (rev 55820)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2020-07-12 20:03:01 UTC (rev 55821)
@@ -528,7 +528,7 @@
     newverbs nextpage
     nfssext-cfr nicefilelist niceframe niceframe-type1 nicematrix nicetext
     nidanfloat nih nihbiosketch
-    nimbus15 njurepo nkarta nlctdoc
+    nimbus15 nimsticks njurepo nkarta nlctdoc
     nmbib noconflict nodetree noindentafter noitcrul nolbreaks
     nomencl nomentbl nonfloat nonumonpart nopageno norasi-c90 normalcolor
     nostarch notes notes2bib notespages notestex

Modified: trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc	2020-07-12 20:02:01 UTC (rev 55820)
+++ trunk/Master/tlpkg/tlpsrc/collection-games.tlpsrc	2020-07-12 20:03:01 UTC (rev 55821)
@@ -23,6 +23,7 @@
 depend labyrinth
 depend logicpuzzle
 depend musikui
+depend nimsticks
 depend onedown
 depend othello
 depend othelloboard

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


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