From 9c5706814f2f593a9f52c51ad02b61e9bacd9ee4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Sat, 24 Jul 2021 03:01:03 +0000 Subject: CTAN sync 202107240301 --- macros/latex/contrib/ifallfalse/README.md | 4 +-- macros/latex/contrib/ifallfalse/ifallfalse.dtx | 47 +++++++++++++++++-------- macros/latex/contrib/ifallfalse/ifallfalse.pdf | Bin 176927 -> 178390 bytes 3 files changed, 34 insertions(+), 17 deletions(-) (limited to 'macros/latex/contrib/ifallfalse') diff --git a/macros/latex/contrib/ifallfalse/README.md b/macros/latex/contrib/ifallfalse/README.md index 925d98f471..072e82ff87 100644 --- a/macros/latex/contrib/ifallfalse/README.md +++ b/macros/latex/contrib/ifallfalse/README.md @@ -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 > @@ -36,4 +36,4 @@ Run 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 diff --git a/macros/latex/contrib/ifallfalse/ifallfalse.dtx b/macros/latex/contrib/ifallfalse/ifallfalse.dtx index 9d5e630f73..adfe09065e 100644 --- a/macros/latex/contrib/ifallfalse/ifallfalse.dtx +++ b/macros/latex/contrib/ifallfalse/ifallfalse.dtx @@ -15,7 +15,7 @@ % \iffalse % %\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] %<*driver> \documentclass{ltxdoc} @@ -30,14 +30,16 @@ % % \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} % % \title{\textsf{ifallfalse} -- Compare string against set of strings} % \author{Dennis Chen \\ proofprogram@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@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@branch\allfalse@branchtrue% + \def\comparedstring{#1}% + \def\trueaction{#2}% + \def\falseaction{#3}% + \def\logicbody{\protect\allfalse@branchfalse}% } -{ - \logicbody +{% + \logicbody% + \ifallfalse@branch + \trueaction% + \else + \falseaction% + \fi } % \end{macrocode} % \end{environment} @@ -118,10 +135,10 @@ % \begin{verbatim} % \if\else % \if\else -% \ldots action +% \ldots \allfalse@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@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} diff --git a/macros/latex/contrib/ifallfalse/ifallfalse.pdf b/macros/latex/contrib/ifallfalse/ifallfalse.pdf index 44df77fa26..a8bdb834f2 100644 Binary files a/macros/latex/contrib/ifallfalse/ifallfalse.pdf and b/macros/latex/contrib/ifallfalse/ifallfalse.pdf differ -- cgit v1.2.3