texlive[64084] Master/texmf-dist: nimsticks (9aug22)

commits+karl at tug.org commits+karl at tug.org
Tue Aug 9 22:01:05 CEST 2022


Revision: 64084
          http://tug.org/svn/texlive?view=revision&revision=64084
Author:   karl
Date:     2022-08-09 22:01:04 +0200 (Tue, 09 Aug 2022)
Log Message:
-----------
nimsticks (9aug22)

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	2022-08-09 16:36:14 UTC (rev 64083)
+++ trunk/Master/texmf-dist/doc/latex/nimsticks/README.md	2022-08-09 20:01:04 UTC (rev 64084)
@@ -20,6 +20,12 @@
 
 ## Changes
 
+### [1.2] - 2022-08-09
+
+- Switched `ifthen` to `etoolbox`;
+- Switched `\begin{center}` to `\centering` (because the former doesn't work in `standalone` documents and the latter doesn't add vertical space);
+- Removed some whitespace that appeared to the right of the last heap.
+
 ### [1.1] - 2020-07-19
 
 - Added option to create inline Nim game using `\nimgame[inline]{}`.

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	2022-08-09 16:36:14 UTC (rev 64083)
+++ trunk/Master/texmf-dist/source/latex/nimsticks/nimsticks.dtx	2022-08-09 20:01:04 UTC (rev 64084)
@@ -1,5 +1,5 @@
 %\iffalse meta-comment
-%Copyright (c) 2020 Peter Rowlett
+%Copyright (c) 2022 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
@@ -47,13 +47,11 @@
 %
 %\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}
+%The command \lstinline{\nimgame} presents the Nim game within \lstinline!\centering!. An optional flag \lstinline{inline} can be used to produce the Nim game without the \lstinline{\centering}. 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}
+%\section{Warnings}
 %
 %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.
 %
@@ -63,6 +61,17 @@
 %\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}
+%\section{Changes to usage or output}
+%
+% (for full change log, see GitHub \verb|README.md|)
+%
+% \begin{itemize}
+%    \item v1.1: added option to make inline Nim game.
+%    \item v1.2: \begin{itemize}
+%        \item switched \verb|\begin{center}| to \verb|\centering| (because the former doesn't work in \verb|standalone| documents and the latter doesn't add vertical space);
+%        \item removed some whitespace that appeared to the right of the last heap.
+%    \end{itemize}
+%\end{itemize}
 %\iffalse
 %<*documentation>
 \documentclass{article}
@@ -70,7 +79,7 @@
 \usepackage{doc}
 \usepackage{listings}
 \lstset{basicstyle=\ttfamily\footnotesize,commentstyle=\color{white},language=TeX}
-\title{nimsticks v1.1}
+\title{nimsticks v1.2}
 \author{Peter Rowlett}
 \begin{document}
 \maketitle
@@ -81,10 +90,10 @@
 
 %\iffalse
 %<*nimsticks>
-\ProvidesPackage{nimsticks}[2020/07/19 nimsticks 1.1]
+\ProvidesPackage{nimsticks}[2022/08/09 nimsticks 1.2]
 \RequirePackage[first=-100,last=100,seed=0]{lcg}
 \RequirePackage{tikz}
-\RequirePackage{ifthen}
+\RequirePackage{etoolbox}
 \@ifundefined{drawnimstick}{}
     {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}}
 \@ifundefined{nimgame}{}
@@ -115,7 +124,7 @@
     \end{tikzpicture}%
 }
 \newcommand{\nimgame}[2][block]{%
-    \ifthenelse{\equal{#1}{inline}}{}{\begin{center}}%
+    \ifstrequal{#1}{inline}{}{\bgroup\centering}%
         \def\listofgames{#2}%
         \foreach \heap in \listofgames {%
             \foreach \heapindex in {1, ..., \heap} {%
@@ -122,8 +131,8 @@
                 \drawnimstick\hspace{0.5mm}%
             }%
             \hspace{10mm}%
-        }%
-    \ifthenelse{\equal{#1}{inline}}{}{\end{center}}%
+        }\hspace{-10mm}%
+    \ifstrequal{#1}{inline}{}{\par\egroup}%
 }
 %</nimsticks>
 %\fi

Modified: trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty	2022-08-09 16:36:14 UTC (rev 64083)
+++ trunk/Master/texmf-dist/tex/latex/nimsticks/nimsticks.sty	2022-08-09 20:01:04 UTC (rev 64084)
@@ -26,10 +26,10 @@
 %% SOFTWARE.
 %% 
 
-\ProvidesPackage{nimsticks}[2020/07/19 nimsticks 1.1]
+\ProvidesPackage{nimsticks}[2022/08/09 nimsticks 1.2]
 \RequirePackage[first=-100,last=100,seed=0]{lcg}
 \RequirePackage{tikz}
-\RequirePackage{ifthen}
+\RequirePackage{etoolbox}
 \@ifundefined{drawnimstick}{}
     {\PackageWarning{nimsticks}{Command `drawnimstick' already defined}}
 \@ifundefined{nimgame}{}
@@ -60,7 +60,7 @@
     \end{tikzpicture}%
 }
 \newcommand{\nimgame}[2][block]{%
-    \ifthenelse{\equal{#1}{inline}}{}{\begin{center}}%
+    \ifstrequal{#1}{inline}{}{\bgroup\centering}%
         \def\listofgames{#2}%
         \foreach \heap in \listofgames {%
             \foreach \heapindex in {1, ..., \heap} {%
@@ -67,8 +67,8 @@
                 \drawnimstick\hspace{0.5mm}%
             }%
             \hspace{10mm}%
-        }%
-    \ifthenelse{\equal{#1}{inline}}{}{\end{center}}%
+        }\hspace{-10mm}%
+    \ifstrequal{#1}{inline}{}{\par\egroup}%
 }
 \endinput
 %%



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