texlive[60027] Master/texmf-dist: ifallfalse (23jul21)

commits+karl at tug.org commits+karl at tug.org
Fri Jul 23 22:08:51 CEST 2021


Revision: 60027
          http://tug.org/svn/texlive?view=revision&revision=60027
Author:   karl
Date:     2021-07-23 22:08:50 +0200 (Fri, 23 Jul 2021)
Log Message:
-----------
ifallfalse (23jul21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/ifallfalse/README.md
    trunk/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf
    trunk/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx
    trunk/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty

Modified: trunk/Master/texmf-dist/doc/latex/ifallfalse/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/ifallfalse/README.md	2021-07-23 20:08:35 UTC (rev 60026)
+++ trunk/Master/texmf-dist/doc/latex/ifallfalse/README.md	2021-07-23 20:08:50 UTC (rev 60027)
@@ -1,4 +1,4 @@
-# The LaTeX package ifallfalse - version 1.0.1 (2021/07/12)
+# The LaTeX package ifallfalse - version 2.0.0 (2021/07/22)
 
 > Copyright (C) 2021 Dennis Chen <proofprogram at gmail.com>
 >
@@ -36,4 +36,4 @@
 
     pdflatex ifallfalse.dtx
 
-to generate `ifallfalse.pdf`, which contains the package documentation.
+to generate `ifallfalse.pdf`, which contains the package documentation.
\ No newline at end of file

Modified: trunk/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx	2021-07-23 20:08:35 UTC (rev 60026)
+++ trunk/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx	2021-07-23 20:08:50 UTC (rev 60027)
@@ -15,7 +15,7 @@
 % \iffalse
 %<package>
 %<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{ifallfalse}[2021/07/12 v1.0.1 Compare string against set of other strings]
+%<package>\ProvidesPackage{ifallfalse}[2021/07/22 v2.0.0 Compare string against set of other strings]
 
 %<*driver>
 \documentclass{ltxdoc}
@@ -30,7 +30,8 @@
 %</driver>
 % \fi
 %
-% \changes{v.1.0.1}{2021/07/12}{Fix errant references to allfalse environment and add limitations}
+% \changes{v2.0.0}{2021/07/22}{Add comments after lines in allfalse to prevent extra spacing from popping up}
+% \changes{v1.0.1}{2021/07/12}{Fix errant references to allfalse environment and add limitations}
 % \changes{v1.0.0}{2021/07/01}{Initial version}
 %
 % \GetFileInfo{ifallfalse.sty}
@@ -37,7 +38,8 @@
 %
 % \title{\textsf{ifallfalse} -- Compare string against set of strings}
 % \author{Dennis Chen \\ proofprogram at gmail.com}
-% \date{\fileversion, v. \filedate\thanks{\url{https://github.com/chennisden/ifallfalse}}}
+% \changes{v2.0.0}{2021/07/22}{Remove errant `v' in date}
+% \date{\fileversion, \filedate\thanks{\url{https://github.com/chennisden/ifallfalse}}}
 %
 % \maketitle
 %
@@ -52,11 +54,11 @@
 % \DescribeEnv{allfalse}
 % To set up an allfalse environment, simply write
 % \begin{verbatim}
-%\begin{allfalse}{string}{action}
+%\begin{allfalse}{string}{true branch}{false branch}
 %
 %\end{allfalse}
 % \end{verbatim}
-% \textsf{string} will be compared to the set of strings (which we will declare via |\orcheck|), and if \textsf{string} does not match the set of strings, \textsf{action} will be executed.
+% \textsf{string} will be compared to the set of strings (which we will declare via |\orcheck|), and if \textsf{string} does not match the set of strings, \textsf{false branch} will be executed. Otherwise, \textsf{true branch} will be executed.
 %
 % \DescribeMacro{\orcheck}
 %
@@ -71,12 +73,16 @@
 % \section{Example}
 %
 % Here is a simple example to demonstrate how \textsf{allfalse} is used.
+%
+% \changes{v2.0.0}{2021/07/22}{Change allfalse environment to match update}
+% \changes{v2.0.0}{2021/07/22}{Use ifallfalse package in example}
 % \begin{verbatim}
 %\documentclass{minimal}
+%\usepackage{ifallfalse}
 %
 %\begin{document}
 %
-%\begin{allfalse}{purple}{This color is not red, blue, or green!}
+%\begin{allfalse}{purple}{}{This color is not red, blue, or green!}
 %    \orcheck{red}
 %    \orcheck{blue}
 %    \orcheck{green}
@@ -85,24 +91,35 @@
 %\end{document}
 % \end{verbatim}
 %
-% In this case, because \textsf{purple} does not match \textsf{red}, \textsf{blue}, or \textsf{green}, the action --- which is printing \textsf{This color is not red, blue, or green!} --- will execute at that location inside the document.
+% In this case, because \textsf{purple} does not match \textsf{red}, \textsf{blue}, or \textsf{green}, the false branch --- which is \textsf{This color is not red, blue, or green!} --- will execute at that location inside the document.
 %
 % \section{Implementation}
 % 
 % These are the implementation details of package \textsf{allfalse}. Because the package is so short, we can explain everything.
 % 
+% \changes{v2.0.0}{2021/07/22}{Create true and false branch}
 % \begin{environment}{allfalse}
 % When setting up allfalse, we locally define the |\comparedstring| macro with the first argument that the environment takes in. This is what will be compared against all the strings passed in through the |\orcheck| declarations inside the environment.
 %
 % Then, we define our body of logic (which we will be adding onto through |\orcheck|) to just initially consist of the action we would like to perform if |\comparedstring| matches none of the strings passed in through |\orcheck|.
+%
+% Finally, we execute our logicbody, which will change |\ifallfalse at branch| to be false if appropriate. Then, the appropriate action will be executed.
 %    \begin{macrocode}
-\newenvironment{allfalse}[2]
-{
-    \def\comparedstring{#1}
-    \def\logicbody{#2}
+\newenvironment{allfalse}[3]
+{%
+    \newif\ifallfalse at branch\allfalse at branchtrue%
+    \def\comparedstring{#1}%
+    \def\trueaction{#2}%
+    \def\falseaction{#3}%
+    \def\logicbody{\protect\allfalse at branchfalse}%
 }
-{
-    \logicbody
+{%
+    \logicbody%
+    \ifallfalse at branch
+        \trueaction%
+    \else
+        \falseaction%
+    \fi
 }
 %    \end{macrocode}
 % \end{environment}
@@ -118,10 +135,10 @@
 % \begin{verbatim}
 % \if\else
 % \if\else
-% \ldots action
+% \ldots \allfalse at branchfalse
 % \fi\ldots \fi
 % \end{verbatim}
-% Logically, \textsf{action} will only execute if all the conditions are false; in other words, it will only execute if |\comparedstring| does not match any of the strings passed in via |\orcheck|. This is because each |\else| branch must execute. 
+% Logically, |\allfalse at branchfalse| will only execute if all the conditions are false; in other words, it will only execute if |\comparedstring| does not match any of the strings passed in via |\orcheck|. This is because each |\else| branch must execute. 
 % \end{itemize}
 %    \begin{macrocode}
 \newcommand*\@allfalsename{allfalse}

Modified: trunk/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty	2021-07-23 20:08:35 UTC (rev 60026)
+++ trunk/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty	2021-07-23 20:08:50 UTC (rev 60027)
@@ -15,15 +15,23 @@
 %% version 2005/12/01 or later.
 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{ifallfalse}[2021/07/12 v1.0.1 Compare string against set of other strings]
+\ProvidesPackage{ifallfalse}[2021/07/22 v2.0.0 Compare string against set of other strings]
 
-\newenvironment{allfalse}[2]
-{
-    \def\comparedstring{#1}
-    \def\logicbody{#2}
+\newenvironment{allfalse}[3]
+{%
+    \newif\ifallfalse at branch\allfalse at branchtrue%
+    \def\comparedstring{#1}%
+    \def\trueaction{#2}%
+    \def\falseaction{#3}%
+    \def\logicbody{\protect\allfalse at branchfalse}%
 }
-{
-    \logicbody
+{%
+    \logicbody%
+    \ifallfalse at branch
+        \trueaction%
+    \else
+        \falseaction%
+    \fi
 }
 \newcommand*\@allfalsename{allfalse}
 



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