diff options
author | Karl Berry <karl@freefriends.org> | 2021-07-23 20:08:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-07-23 20:08:50 +0000 |
commit | 17435dbc87ef4c15ed383dffdb4b2ba093bb0fa8 (patch) | |
tree | 3161b53089af685f4ea6895fb253e7c7d7612bac /Master | |
parent | 6ac7453f863d3ae49112f4eed4cc5232ae886b66 (diff) |
ifallfalse (23jul21)
git-svn-id: svn://tug.org/texlive/trunk@60027 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/ifallfalse/README.md | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf | bin | 176927 -> 178390 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx | 47 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty | 22 |
4 files changed, 49 insertions, 24 deletions
diff --git a/Master/texmf-dist/doc/latex/ifallfalse/README.md b/Master/texmf-dist/doc/latex/ifallfalse/README.md index 925d98f471a..072e82ff87f 100644 --- a/Master/texmf-dist/doc/latex/ifallfalse/README.md +++ b/Master/texmf-dist/doc/latex/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 <proofprogram@gmail.com> > @@ -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/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf b/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf Binary files differindex 44df77fa26f..a8bdb834f20 100644 --- a/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf +++ b/Master/texmf-dist/doc/latex/ifallfalse/ifallfalse.pdf diff --git a/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx b/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx index 9d5e630f731..adfe09065e3 100644 --- a/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx +++ b/Master/texmf-dist/source/latex/ifallfalse/ifallfalse.dtx @@ -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,14 +30,16 @@ %</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} % % \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/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty b/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty index fbd4eedffa1..deab2fd175d 100644 --- a/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty +++ b/Master/texmf-dist/tex/latex/ifallfalse/ifallfalse.sty @@ -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@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 } \newcommand*\@allfalsename{allfalse} |