From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/gmutils/gmampulex.sty | 215 +++++++++++++++++++++++++++++
 1 file changed, 215 insertions(+)
 create mode 100644 macros/latex/contrib/gmutils/gmampulex.sty

(limited to 'macros/latex/contrib/gmutils/gmampulex.sty')

diff --git a/macros/latex/contrib/gmutils/gmampulex.sty b/macros/latex/contrib/gmutils/gmampulex.sty
new file mode 100644
index 0000000000..9ae544868e
--- /dev/null
+++ b/macros/latex/contrib/gmutils/gmampulex.sty
@@ -0,0 +1,215 @@
+%% 
+%% \iffalse ^^A we skip the debug setting
+\IfFileExists{\string~/bin/gen_and_xela}{\errorcontextlines=1000 }{}
+%% \fi
+%% ^^A $Id: TheUltimateMaster.gmd,v 0.352 2011/10/12 15:19:42 natror Exp natror $
+%% This is file “gmampulex.sty” generated with the DocStrip utility.
+%% 
+%%
+%% The original source files were:
+%%
+%% gmutils/gmutils.gmd  (with options: `ampulex')
+%%
+%% 
+%% Copyright ©  
+%% by Grzegorz ‘Natror’ Murzynowski
+%% natror (at) gmail (dot) com
+%% 
+%% This program is subject to the LaTeX Project Public License.
+%% See http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
+%% for the details of that license.
+%%
+%% LPPL status: "author-maintained".
+%%
+%% 
+%% 
+%% For documentation please refer to the file(s)
+%% gmutils.{gmd,pdf}.
+%% 
+%% 
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{gmampulex}
+    [2011/10/12 v0.996 Ampulex Compressa-like modifier of macros (GM)]
+
+
+%%
+%%
+%%     ^^A\typeout{\unexpanded{#4}}%%
+
+\RequirePackage{gmcommand}
+
+\DeclareCommand\ampulexlet\long
+{Q{\outer\long\global\protected}{} % (1)  (optional) prefix\:(es);
+  % allowed is any sequence of them in any order, just like for the
+  % original \TeX's \incmd\def.
+  T{\def\edef\gdef\xdef\pdef}{\def} % (2) (optional) kind of definition; if
+  % not specified, \incmd\def\ will be used.
+  m % (3)  macro to be let to,
+  m % (4) macro to provide the definition,
+  O{} % (5) \cs{def}'s parameters string; empty by default,
+  O{} % (6) definition body's parameters to be taken in a~one-step
+  % expansion of the redefined macro; empty by default; the
+  % undelimited parameters should be double-braced here.
+  m % (7) start token(s),
+  m % (8) end token(s)
+  m % (9) the replacement of |#7|, |#8| and whatever between them.
+}{%^^B
+  % \changes{v0.93}{2008/08/29}{added}
+  % \changes{v0.94}{2008/09/07}{made \pk{xparse}-ish and
+  %   \cs{ampulexset} removed}
+  % \chgs{2008/12/7 v0.98 first argument (the prefix) made of the
+  %   \env{Q} type}
+  % For the example of usage see \ref{ampulexset}. \HideDef
+  %
+  \long\def\gmu@ampulexlet@resa
+  ##1#7% we put |#7| as a delimiter
+  ##2#8% we put |#8| as a delimiter
+  ##3\gmu@AmpulexDelimiter{%
+    % We use a special (undefined) \CS  |\gmu@AmpulexDelimiter| as
+    % the final delimiter because standard \LaTeX's |\@nil| isn't
+    % probably a good idea since we
+    % want to ampulex deep \LaTeX's macros and other |\gmu@›…|
+    % macros too.
+    \gmu@ifempty{##3}%
+  }%
+  % Now |\gmu@ampulexlet@resa| is redefined to produce an open |\gmu@ifempty|
+  % depending on whether the start and end token(s) are found in the
+  % meaning of \inverb|#4|.
+  %
+  % Before we proceed, we deal with a difficulty with a special case
+  % when |#6| is “|#1|”, which occurs because of stripping braces of a
+  % single-brace argument.
+  \gmu@ifutokens{#6}{##1}%
+  {\def\ampulex@Args{{%
+          ####1}}%
+  }%
+  {\edef\ampulex@Args{\@nx\unexpanded{%
+        \unexpanded{#6}}}}%
+  \long  \def\gmu@ampulexlet@resc##1{%
+    \@xa\@xa\@xa\@xa      \@xa\@xa\@xa\gmu@ampulexlet@resa
+    \@xa\@xa\@xa#4%
+    \ampulex@Args
+    ##1% this parameter will be substituted with |#7#8| in
+       % line~\ref{resc1} and with emptiness in line~\ref{resc2}.
+    \gmu@AmpulexDelimiter
+  }%
+  %
+  \gmu@ampulexlet@resc{#7#8}%\label{resc1}   % ^^V   \gmu@ampulexlet@resb
+  % We've just applied the checker and it produces an open
+  % |\gmu@ifempty{⁄<some tokens>}|
+  %  if the delimiters are found in the meaning of |#4|
+  % so, if \<some tokens> are none, we issue a warning
+  {%
+    \PackageWarning{gmampulex}{%
+      \@nx#4 doesn't contain tokens
+      \detokenize{#7} nor \detokenize{#8}. You better check if this is
+      what you want to redefine.^^J%
+      \@nx#4 is^^J%
+      \meaning#4^^J%
+    }}%
+  % and we proceed if they are really some
+  {%
+  % We define a~temporary
+  % macro with the parameters delimited with the `start' and `end' parameters
+  % of \incs{ampulexdef}. It has to stand a double |\edef|.
+  \edef\gmu@ampulexlet@resa{%
+    \long\def\@nx\gmu@ampulexlet@resa
+    ####1\unexpanded{#7}%
+    ####2\unexpanded{#8}%
+    ####3\@nx\gmu@AmpulexDelimiter{%
+      \@nx\unexpanded{####1}%
+      % we drop the part between the |#7| and |#8| delimiters
+      % (including delimiters)
+      \unexpanded{\unexpanded{#9}}% we replace the part of the
+      % redefined macro's meaning with the replacement text.
+      \@nx\unexpanded{####3}%
+    }% of inner |\gmu@ampulexlet@resa|
+  }% of outer |\gmu@ampulexlet@resa|
+  \gmu@ampulexlet@resa
+  % Now |\gmu@ampulexlet@resa| carries the modifier of |#4|'s
+  % definition.
+  %
+  %
+\unless\ifx\czat#4%
+   \edef\gmu@ampulexlet@resb{% double definition for double hashes of expanded
+     % |\unexpanded{#1›…}|
+     #1#2%
+     \@nx#3\unexpanded{#5}{%
+       \gmu@ampulexlet@resc{}%\label{resc2}
+ % Here we are sure the tokens sequences
+ % |#7| and |#8| are in the one-level expansion of |#4| so we don't pass them
+ % as sentinels (which \ac{BTW} would totally spoil the redefinition, what it
+ % did indeed 2010/6/23).
+     }% of |#3|'s definition body
+   }% of inner |\gmu@ampulexlet@resb|
+   \gmu@ampulexlet@resb
+\else
+    \gmu@ifxany#2{\gdef\xdef}{\global}{}%
+    #1\edef#3#5{\gmu@ampulexlet@resc{}}%\label{resc2}
+\fi
+  }% of if the delimiters were found in the meaning.
+}% of |\ampulexlet|
+
+\DeclareCommand\ampulexdef\long{%
+  % \chgs{2010/04/22 v0.994 rewritten not to use the arguments 7–9
+  %   explicitly not to wrap them in a temporary macros, and to accept
+  %   single hashes (instead of quadruple) in arguments 5 and 6. The
+  %   temporary macros renamed
+  %   to \cmd\gmu@reserveda and \cmd\gmu@reservedb. The body moved to
+  %   \cmd\ampulexlet with adding another \CS argument to let let a
+  %   macro not necessarily redefine it itself and this command made a
+  %   particular case of that new one}
+#1  Q{\outer\long\global\protected}{} % (1) as |\ampulexlet|
+#2  T{\def\edef\gdef\xdef\pdef}{\def} % (2) ad |\ampulexlet|
+#3  m % (3)  macro to be redefined,
+#4  O{} % (4) as |\ampulexlet|'s |#5|, i.e., \cs{def}'s parameters string; empty by default,
+#5  O{} % (5) as |\ampulexlet|'s |#6|, i.e., definition body's
+ % parameters to be taken in a~one-step expansion of the redefined
+ % macro; empty by default; the undelimited parameters should be
+ % double-braced here (but not doubled).
+#6  m % (6) start token(s),
+#7  m % (7) end token(s),
+#8  m % (8) the replacement
+}{%
+  \DCUse\ampulexlet{#1}{#2}{#3}{#3}{#4}{#5}{#6}{#7}{#8}%
+}
+
+
+
+\def\gmu@ENumLoop#1#2{% this is a~fully expandable loop generating |#2|${}-{}$|#1|
+  % space tokens (cf. The  % \eTeX\ Manual p.~9).
+  \ifnum#1<#2 %
+    \gmu@tempa
+    \@xa\gmu@ENumLoop
+    \@xa{\number\numexpr#1+1\@xa}%
+    \@xa{\number#2\@xa}%
+  \fi}% of |\gmu@hashes|.
+
+\long\def\defENumLoop
+#1% the loop macro's name
+#2% the replacement of |\gmu@tempa|
+{%
+  \ampulexlet#1\gmu@ENumLoop
+  [##1##2][{##1}{##2}]%
+  \gmu@tempa\@xa{#2\@xa}%
+  %
+  \ampulexdef#1%
+  [##1##2][{##1}{##2}]%
+  \gmu@ENumLoop\@xa{#1\@xa}%
+}
+
+\edef\GenericInfoToTerminal{%
+  \unexpanded{%
+    \@XA{\ampulexlet\protected\long\GenericInfo}\csname
+    GenericInfo \endcsname[#1#2][{#1}{#2}]%
+    \write\m@ne % we replace the token between these with:
+    {\write\ifnum\tracingonline>\z@ \@unused\else\m@ne\fi}%
+  }%
+}
+
+\ampulexdef\@starttoc[#1][#1]\makeatletter\@input{\makeatletter\NamedInput}
+
+
+\endinput
+%%
+%% End of file `gmampulex.sty'.
-- 
cgit v1.2.3

