texlive[69223] Master: xkeymask (26dec23)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 26 22:05:22 CET 2023


Revision: 69223
          https://tug.org/svn/texlive?view=revision&revision=69223
Author:   karl
Date:     2023-12-26 22:05:22 +0100 (Tue, 26 Dec 2023)
Log Message:
-----------
xkeymask (26dec23)

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

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/xkeymask/
    trunk/Master/texmf-dist/doc/latex/xkeymask/README
    trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.pdf
    trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.tex
    trunk/Master/texmf-dist/tex/latex/xkeymask/
    trunk/Master/texmf-dist/tex/latex/xkeymask/xkeymask.sty
    trunk/Master/tlpkg/tlpsrc/xkeymask.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/xkeymask/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xkeymask/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xkeymask/README	2023-12-26 21:05:22 UTC (rev 69223)
@@ -0,0 +1,36 @@
+xkeymask v1.0
+-------------
+
+This package is an extension of the xkeyval package by Hendri Adriaens that offers additional macros for "masking" certain keys.
+
+See for more information the pdf documentation of this package.
+
+
+Installation
+------------
+
+CTAN:/macros/latex/contrib/xkeymask: official location
+ |
+ |- README           : should not be installed
+ |- xkeymask.tex     : should not be installed
+ |- xkeymask.pdf     : /doc/latex/xkeymask
+ |- xkeymask.sty     : /tex/latex/xkeymask
+
+See the documentation of your LaTeX distribution or the TeX Frequently Asked Questions for more information on installing xkeymask into your LaTeX distribution
+(https://texfaq.org/#installing).
+
+
+License
+-------
+
+Copyright (C) 2022-2023 Ramkumar Ramachandra
+
+This work may be distributed and/or modified under the conditions of the LaTeX Project Public License, either version 1.3c of this license or (at your option) any later version. The latest version of this license can be found at https://www.latex-project.org/lppl.txt.
+
+This work has the LPPL maintenance status "maintained".
+
+This Current Maintainer is Ramkumar Ramachandra.
+
+This work consists of the file xkeymask.sty.
+
+The following files constitute the xkeymask bundle and must be distributed as a whole: README, xkeymask.sty, xkeymask.tex, xkeymask.pdf.


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

Index: trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.pdf	2023-12-26 21:04:37 UTC (rev 69222)
+++ trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.pdf	2023-12-26 21:05:22 UTC (rev 69223)

Property changes on: trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.tex	2023-12-26 21:05:22 UTC (rev 69223)
@@ -0,0 +1,123 @@
+% xkeymask package by Ramkumar Ramachandra.
+%%
+%% --------------------------------------------
+%% Copyright (C) 2022-2023 Ramkumar Ramachandra
+%% --------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option)
+%% any later version. The latest version of this license
+%% can be found at:
+%%   https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions
+%% of LaTeX version 2008/05/04 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer is Ramkumar Ramachandra.
+%%
+%% This work consists of the file xkeymask.sty.
+%%
+%% The following files constitute the xkeymask bundle and
+%% must be distributed as a whole:
+%%   README, xkeymask.sty, xkeymask.tex, xkeymask.pdf.
+%%
+\documentclass[a4paper]{ltxdoc}
+\usepackage{minted, amsmath, framed}
+\usepackage[margin=0.8in]{geometry}
+\usepackage[prefix=bonak]{xkeymask}
+
+\makeatletter
+\define at cmdkey[bonak]{frame}{D}{(#1)}
+\define at cmdkey[bonak]{layer}{D}{(#1)}
+\define at cmdkey[bonak]{layer}{d}{(#1)}
+\define at cmdkey[bonak]{painting}{D}{(#1)}
+\define at cmdkey[bonak]{painting}{E}{(#1)}
+\define at cmdkey[bonak]{painting}{d}{(#1)}
+\makeatother
+
+\newcommand{\prim}[6]{
+  \ensuremath{\mathsf{{#1}}_{#2}^{#3,#4,#5}}
+  \setkeys*[bonak]{#1}{#6}}
+
+\newcommand{\framep}[5]{\prim{frame}{#1}{#2}{#3}{#4}{#5}}
+\newcommand{\layer}[5]{\prim{layer}{#1}{#2}{#3}{#4}{#5}}
+\newcommand{\painting}[5]{\prim{painting}{#1}{#2}{#3}{#4}{#5}}
+
+\newcommand{\eqnarg}[3]{\ifinmask[bonak]{#1}[#2]{\{#2:#3\}}{(#2:#3)}}
+\begin{document}
+\title{The \texttt{xkeymask} package}
+\author{Ramkumar Ramachandra}
+\maketitle
+This package is an extension of the \texttt{xkeyval} package by Hendri Adriaens that offers macros for ``masking'' certain keys, so that they are not used in certain places. The package was originally written for the purposes of the \href{https://github.com/artagnon/bonak}{bonak} project, for hiding certain keys in certain places, and has been released for a wider audience. The idea is that one first imports the package with a desired ``prefix'' in the document preamble, and then creates masks use at certain points in the document. The mask can also be queried or cleared at some later point. The main user interface is provided by the |\appendmask|, |\clearmask|, and |\ifinmask| commands. The following example:
+
+\begin{minted}{latex}
+  \documentclass{article}
+  \usepackage{amsmath}
+  \usepackage[prefix=bonak]{xkeymask}
+
+  \makeatletter
+  \define at cmdkey[bonak]{frame}{D}{(#1)}
+  \define at cmdkey[bonak]{layer}{D}{(#1)}
+  \define at cmdkey[bonak]{layer}{d}{(#1)}
+  \define at cmdkey[bonak]{painting}{D}{(#1)}
+  \define at cmdkey[bonak]{painting}{E}{(#1)}
+  \define at cmdkey[bonak]{painting}{d}{(#1)}
+  \makeatother
+
+  \newcommand{\prim}[6]{
+    \ensuremath{\mathsf{{#1}}_{#2}^{#3,#4,#5}}
+    \setkeys*[bonak]{#1}{#6}}
+
+  \newcommand{\framep}[5]{\prim{frame}{#1}{#2}{#3}{#4}{#5}}
+  \newcommand{\layer}[5]{\prim{layer}{#1}{#2}{#3}{#4}{#5}}
+  \newcommand{\painting}[5]{\prim{painting}{#1}{#2}{#3}{#4}{#5}}
+
+  \newcommand{\eqnarg}[3]{\ifinmask[bonak]{#1}[#2]{\{#2:#3\}}{(#2:#3)}}
+
+  \begin{document}
+    With mask:
+    \appendmask[bonak]{layer}[D]
+    \appendmask[bonak]{painting}[D,E]
+    \appendmask[bonak]{cohfiller}[c]
+    \begin{align*}
+      \eqnarg{cohlayer}{d}{\framep{m}{n}{p}{q}{D=D}} \\
+      \eqnarg{cohlayer}{l}{\layer{m}{n}{p}{q}{D=D, d=d}} \\
+      \eqnarg{cohfiller}{c}{\painting{m}{n}{p}{q}{D=D, E=E, d=d}} \\
+    \end{align*}
+    Without mask:
+    \clearmask
+    \begin{align*}
+      \eqnarg{cohlayer}{d}{\framep{m}{n}{p}{q}{D=D}} \\
+      \eqnarg{cohlayer}{l}{\layer{m}{n}{p}{q}{D=D, d=d}} \\
+      \eqnarg{cohfiller}{c}{\painting{m}{n}{p}{q}{D=D, E=E, d=d}} \\
+    \end{align*}
+  \end{document}
+\end{minted}
+
+\newpage
+produces the following output:
+
+\begin{framed}
+  With mask:
+  \appendmask[bonak]{layer}[D]
+  \appendmask[bonak]{painting}[D,E]
+  \appendmask[bonak]{cohfiller}[c]
+  \begin{align*}
+    \eqnarg{cohlayer}{d}{\framep{m}{n}{p}{q}{D=D}} \\
+    \eqnarg{cohlayer}{l}{\layer{m}{n}{p}{q}{D=D, d=d}} \\
+    \eqnarg{cohfiller}{c}{\painting{m}{n}{p}{q}{D=D, E=E, d=d}} \\
+  \end{align*}
+  Without mask:
+  \clearmask
+  \begin{align*}
+    \eqnarg{cohlayer}{d}{\framep{m}{n}{p}{q}{D=D}} \\
+    \eqnarg{cohlayer}{l}{\layer{m}{n}{p}{q}{D=D, d=d}} \\
+    \eqnarg{cohfiller}{c}{\painting{m}{n}{p}{q}{D=D, E=E, d=d}} \\
+  \end{align*}
+\end{framed}
+
+\section*{Full source code listing}
+\inputminted{latex}{xkeymask.sty}
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/xkeymask/xkeymask.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/tex/latex/xkeymask/xkeymask.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/xkeymask/xkeymask.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/xkeymask/xkeymask.sty	2023-12-26 21:05:22 UTC (rev 69223)
@@ -0,0 +1,109 @@
+% xkeymask package by Ramkumar Ramachandra.
+%%
+%% --------------------------------------------
+%% Copyright (C) 2022-2023 Ramkumar Ramachandra
+%% --------------------------------------------
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3c of this license or (at your option)
+%% any later version. The latest version of this license
+%% can be found at:
+%%   https://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions
+%% of LaTeX version 2008/05/04 or later.
+%%
+%% This work has the LPPL maintenance status "maintained".
+%%
+%% This Current Maintainer is Ramkumar Ramachandra.
+%%
+%% This work consists of the file xkeymask.sty.
+%%
+%% The following files constitute the xkeymask bundle and
+%% must be distributed as a whole:
+%%   README, xkeymask.sty, xkeymask.tex, xkeymask.pdf.
+%%
+\RequirePackage{kvoptions, xkeyval}
+\ProvidesPackage{xkeymask}[v1.0 An extension of xkeyval with a mask]
+
+% Option processing
+\newif\ifxkeymask at prefix
+\DeclareStringOption{prefix}
+\AddToKeyvalOption*{prefix}{\xkeymask at prefixtrue}
+\ProcessKeyvalOptions*
+
+\ifxkeymask at prefix
+  % We patch xkeyval's \setkeys to use a mask to ignore keys
+  \makeatletter
+  % Our global mask
+  \def\XKM at mask{}
+
+  % First we define \appendmask
+  \long\def\XKM at appendmask[#1]{
+    \XKV at for@o\XKV at fams\XKV at tfam{
+      \xdef\XKM at hdr{\XKV at prefix\XKV at tfam @}
+      \XKV at for@o{#1}\XKV at tempa{
+        % Remove spaces around key name
+        \expandafter\KV@@sp at def\expandafter\XKV at tempa\expandafter{\XKV at tempa}
+        \XKV at addtolist@x\XKM at mask{\XKM at hdr\XKV at tempa}
+      }
+    }
+  }
+  \def\appendmask{\XKV at testopta{\XKV at testoptc\XKM at appendmask}}
+
+  % Query the mask for a key
+  \long\def\XKM at ifinmask[#1]#2#3{
+    \XKV at checksanitizea{#1}\XKV at tempc
+    \XKV at for@o\XKV at fams\XKV at tfam{
+      \XKV at for@o\XKV at tempc\XKV at tempb{
+        \xdef\XKM at hdr{\XKV at prefix\XKV at tfam @}
+        \xdef\XKV at tempd{\XKV at prefix\XKV at tfam @\XKV at tempb}
+        \@expandtwoargs\in@\XKV at tempd\XKM at mask
+        \ifin@
+          #2
+        \else
+          #3
+        \fi
+      }
+    }
+  }
+  \def\ifinmask{\XKV at testopta{\XKV at testoptc\XKM at ifinmask}}
+
+  % A quick way to clear the mask
+  \def\clearmask{\global\let\XKM at mask\@empty}
+
+  % Now we override the definition of \XKV at setkeys
+  \long\def\XKM at setkeys[#1]#2{
+    \XKV at checksanitizea{#2}\XKV at resb
+    \let\XKV at resa\@empty
+    \XKV at for@o\XKV at fams\XKV at tfam{
+      \XKV at for@o\XKV at resb\XKV at tempb{
+        \expandafter\XKV at g@tkeyname\XKV at tempb=\@nil\XKV at tempc
+        % Remove spaces around key name
+        \expandafter\KV@@sp at def\expandafter\XKV at tempc\expandafter{\XKV at tempc}
+        \xdef\XKV at tempd{\XKV at prefix\XKV at tfam @\XKV at tempc}
+        % If \XKV at tempd is in \XKM at mask,
+        % remove the corresponding kv from \XKV at resb
+        \@expandtwoargs\in@\XKV at tempd\XKM at mask
+        \ifin@\else\XKV at addtolist@o\XKV at resa\XKV at tempb\fi
+      }
+    }
+    \ifnum\XKV at depth=\z@\let\XKV at rm\@empty\fi
+    \expandafter\XKV at s@tkeys\expandafter{\XKV at resa}{#1}
+    \let\CurrentOption\@empty
+  }
+
+  % A dispatcher to \XKM at setkeys or \XKV at setkeys
+  \long\def\XKM at setkeys@dispatch{
+    \xdef\XKV at tempa{\xkeymask at prefix @}
+    \ifx\XKV at prefix\XKV at tempa
+      \expandafter\XKM at setkeys
+    \else
+      \expandafter\XKV at setkeys
+    \fi
+  }
+
+  % Finally, override \setkeys itself to call the dispatcher
+  \def\setkeys{\XKV at testopta{\XKV at testoptc\XKM at setkeys@dispatch}}
+  \makeatother
+\fi


Property changes on: trunk/Master/texmf-dist/tex/latex/xkeymask/xkeymask.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	2023-12-26 21:04:37 UTC (rev 69222)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2023-12-26 21:05:22 UTC (rev 69223)
@@ -921,7 +921,7 @@
     xetexfontinfo xetexko
     xetexref xevlna xfakebold xfor xgreek xhfill
     xifthen xii xii-lat xindex xindy-persian xint xintsession xistercian xits
-    xkcdcolors xkeyval xlop xltabular xltxtra
+    xkcdcolors xkeymask xkeyval xlop xltabular xltxtra
     xml2pmx xmltex xmpincl xmuthesis xnewcommand
     xoptarg xpatch xpeek xpiano xpicture xpinyin xprintlen xpunctuate
     xq xsavebox xsim xskak xstring xtab xtuthesis xunicode xurl

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2023-12-26 21:04:37 UTC (rev 69222)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2023-12-26 21:05:22 UTC (rev 69223)
@@ -1495,6 +1495,7 @@
 depend xifthen
 depend xint
 depend xkcdcolors
+depend xkeymask
 depend xltabular
 depend xmpincl
 depend xnewcommand

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


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