| 1 |
%% |
| 2 |
%% This is file `letltxmacro.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% letltxmacro.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Project: letltxmacro |
| 12 |
%% Version: 2019/12/03 v1.6 |
| 13 |
%% |
| 14 |
%% Copyright (C) |
| 15 |
%% 2008, 2010 Heiko Oberdiek |
| 16 |
%% 2016-2019 Oberdiek Package Support Group |
| 17 |
%% |
| 18 |
%% This work may be distributed and/or modified under the |
| 19 |
%% conditions of the LaTeX Project Public License, either |
| 20 |
%% version 1.3c of this license or (at your option) any later |
| 21 |
%% version. This version of this license is in |
| 22 |
%% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 23 |
%% and the latest version of this license is in |
| 24 |
%% https://www.latex-project.org/lppl.txt |
| 25 |
%% and version 1.3 or later is part of all distributions of |
| 26 |
%% LaTeX version 2005/12/01 or later. |
| 27 |
%% |
| 28 |
%% This work has the LPPL maintenance status "maintained". |
| 29 |
%% |
| 30 |
%% The Current Maintainers of this work are |
| 31 |
%% Heiko Oberdiek and the Oberdiek Package Support Group |
| 32 |
%% https://github.com/ho-tex/letltxmacro/issues |
| 33 |
%% |
| 34 |
%% |
| 35 |
%% This work consists of the main source file letltxmacro.dtx |
| 36 |
%% and the derived files |
| 37 |
%% letltxmacro.sty, letltxmacro.pdf, letltxmacro.ins, letltxmacro.drv, |
| 38 |
%% letltxmacro-showcases.tex, letltxmacro-test1.tex, |
| 39 |
%% letltxmacro-test2.tex. |
| 40 |
%% |
| 41 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 42 |
\catcode13=5 % ^^M |
| 43 |
\endlinechar=13 % |
| 44 |
\catcode123=1 % { |
| 45 |
\catcode125=2 % } |
| 46 |
\catcode64=11 % @ |
| 47 |
\def\x{\endgroup |
| 48 |
\expandafter\edef\csname llm@AtEnd\endcsname{% |
| 49 |
\endlinechar=\the\endlinechar\relax |
| 50 |
\catcode13=\the\catcode13\relax |
| 51 |
\catcode32=\the\catcode32\relax |
| 52 |
\catcode35=\the\catcode35\relax |
| 53 |
\catcode61=\the\catcode61\relax |
| 54 |
\catcode64=\the\catcode64\relax |
| 55 |
\catcode123=\the\catcode123\relax |
| 56 |
\catcode125=\the\catcode125\relax |
| 57 |
}% |
| 58 |
}% |
| 59 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 60 |
\catcode13=5 % ^^M |
| 61 |
\endlinechar=13 % |
| 62 |
\catcode35=6 % # |
| 63 |
\catcode64=11 % @ |
| 64 |
\catcode123=1 % { |
| 65 |
\catcode125=2 % } |
| 66 |
\def\TMP@EnsureCode#1#2{% |
| 67 |
\edef\llm@AtEnd{% |
| 68 |
\llm@AtEnd |
| 69 |
\catcode#1=\the\catcode#1\relax |
| 70 |
}% |
| 71 |
\catcode#1=#2\relax |
| 72 |
} |
| 73 |
\TMP@EnsureCode{40}{12}% ( |
| 74 |
\TMP@EnsureCode{41}{12}% ) |
| 75 |
\TMP@EnsureCode{42}{12}% * |
| 76 |
\TMP@EnsureCode{45}{12}% - |
| 77 |
\TMP@EnsureCode{46}{12}% . |
| 78 |
\TMP@EnsureCode{47}{12}% / |
| 79 |
\TMP@EnsureCode{58}{12}% : |
| 80 |
\TMP@EnsureCode{62}{12}% > |
| 81 |
\TMP@EnsureCode{91}{12}% [ |
| 82 |
\TMP@EnsureCode{93}{12}% ] |
| 83 |
\edef\llm@AtEnd{% |
| 84 |
\llm@AtEnd |
| 85 |
\escapechar\the\escapechar\relax |
| 86 |
\noexpand\endinput |
| 87 |
} |
| 88 |
\escapechar=92 % `\\ |
| 89 |
\NeedsTeXFormat{LaTeX2e} |
| 90 |
\ProvidesPackage{letltxmacro}% |
| 91 |
[2019/12/03 v1.6 Let assignment for LaTeX macros (HO)] |
| 92 |
\newcommand*{\LetLtxMacro}{% |
| 93 |
\llm@ModeLetLtxMacro{}% |
| 94 |
} |
| 95 |
\newcommand*{\GlobalLetLtxMacro}{% |
| 96 |
\llm@ModeLetLtxMacro\global |
| 97 |
} |
| 98 |
\newcommand*{\llm@ModeLetLtxMacro}[3]{% |
| 99 |
\edef\llm@escapechar{\the\escapechar}% |
| 100 |
\escapechar=-1 % |
| 101 |
\edef\reserved@a{% |
| 102 |
\noexpand\protect |
| 103 |
\expandafter\noexpand |
| 104 |
\csname\string#3 \endcsname |
| 105 |
}% |
| 106 |
\ifx\reserved@a#3\relax |
| 107 |
#1\edef#2{% |
| 108 |
\noexpand\protect |
| 109 |
\expandafter\noexpand |
| 110 |
\csname\string#2 \endcsname |
| 111 |
}% |
| 112 |
#1\expandafter\let |
| 113 |
\csname\string#2 \expandafter\endcsname |
| 114 |
\csname\string#3 \endcsname |
| 115 |
\expandafter\llm@LetLtxMacro |
| 116 |
\csname\string#2 \expandafter\endcsname |
| 117 |
\csname\string#3 \endcsname{#1}% |
| 118 |
\else |
| 119 |
\llm@LetLtxMacro{#2}{#3}{#1}% |
| 120 |
\fi |
| 121 |
\escapechar=\llm@escapechar\relax |
| 122 |
} |
| 123 |
\def\llm@LetLtxMacro#1#2#3{% |
| 124 |
\escapechar=92 % |
| 125 |
\expandafter\llm@CheckParams\meaning#2:->\@nil{% |
| 126 |
\begingroup |
| 127 |
\def\@protected@testopt{% |
| 128 |
\expandafter\@testopt\@gobble |
| 129 |
}% |
| 130 |
\def\@testopt##1##2{% |
| 131 |
\toks@={##2}% |
| 132 |
}% |
| 133 |
\let\llm@testopt\@empty |
| 134 |
\edef\x{% |
| 135 |
\noexpand\@protected@testopt |
| 136 |
\noexpand#2% |
| 137 |
\expandafter\noexpand\csname\string#2\endcsname |
| 138 |
}% |
| 139 |
\expandafter\expandafter\expandafter\def |
| 140 |
\expandafter\expandafter\expandafter\y |
| 141 |
\expandafter\expandafter\expandafter{% |
| 142 |
\expandafter\llm@CarThree#2{}{}{}\llm@nil |
| 143 |
}% |
| 144 |
\ifx\x\y |
| 145 |
#2% |
| 146 |
\def\llm@testopt{% |
| 147 |
\noexpand\@protected@testopt |
| 148 |
\noexpand#1% |
| 149 |
}% |
| 150 |
\else |
| 151 |
\edef\x{% |
| 152 |
\noexpand\@testopt |
| 153 |
\expandafter\noexpand |
| 154 |
\csname\string#2\endcsname |
| 155 |
}% |
| 156 |
\expandafter\expandafter\expandafter\def |
| 157 |
\expandafter\expandafter\expandafter\y |
| 158 |
\expandafter\expandafter\expandafter{% |
| 159 |
\expandafter\llm@CarTwo#2{}{}\llm@nil |
| 160 |
}% |
| 161 |
\ifx\x\y |
| 162 |
#2% |
| 163 |
\def\llm@testopt{% |
| 164 |
\noexpand\@testopt |
| 165 |
}% |
| 166 |
\fi |
| 167 |
\fi |
| 168 |
\ifx\llm@testopt\@empty |
| 169 |
\else |
| 170 |
\llm@protected\xdef\llm@GlobalTemp{% |
| 171 |
\llm@testopt |
| 172 |
\expandafter\noexpand |
| 173 |
\csname\string#1\endcsname |
| 174 |
{\the\toks@}% |
| 175 |
}% |
| 176 |
\fi |
| 177 |
\expandafter\endgroup\ifx\llm@testopt\@empty |
| 178 |
#3\let#1=#2\relax |
| 179 |
\else |
| 180 |
#3\let#1=\llm@GlobalTemp |
| 181 |
#3\expandafter\let |
| 182 |
\csname\string#1\expandafter\endcsname |
| 183 |
\csname\string#2\endcsname |
| 184 |
\fi |
| 185 |
}{% |
| 186 |
#3\let#1=#2\relax |
| 187 |
}% |
| 188 |
} |
| 189 |
\def\llm@CheckParams#1:->#2\@nil{% |
| 190 |
\begingroup |
| 191 |
\def\x{#1}% |
| 192 |
\ifx\x\llm@macro |
| 193 |
\endgroup |
| 194 |
\def\llm@protected{}% |
| 195 |
\expandafter\@firstoftwo |
| 196 |
\else |
| 197 |
\ifx\x\llm@protectedmacro |
| 198 |
\endgroup |
| 199 |
\def\llm@protected{\protected}% |
| 200 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 201 |
\else |
| 202 |
\endgroup |
| 203 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 204 |
\fi |
| 205 |
\fi |
| 206 |
} |
| 207 |
\def\llm@macro{macro} |
| 208 |
\@onelevel@sanitize\llm@macro |
| 209 |
\def\llm@protectedmacro{\protected macro} |
| 210 |
\@onelevel@sanitize\llm@protectedmacro |
| 211 |
\def\llm@CarThree#1#2#3#4\llm@nil{#1#2#3}% |
| 212 |
\def\llm@CarTwo#1#2#3\llm@nil{#1#2}% |
| 213 |
\llm@AtEnd% |
| 214 |
\endinput |
| 215 |
%% |
| 216 |
%% End of file `letltxmacro.sty'. |