| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: letltxmacro.dtx |
| 4 |
% Version: 2019/12/03 v1.6 |
| 5 |
% Info: Let assignment for LaTeX macros |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 2008, 2010 Heiko Oberdiek |
| 9 |
% 2016-2019 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/letltxmacro/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/letltxmacro/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file letltxmacro.dtx |
| 29 |
% and the derived files |
| 30 |
% letltxmacro.sty, letltxmacro.pdf, letltxmacro.ins, letltxmacro.drv, |
| 31 |
% letltxmacro-showcases.tex, letltxmacro-test1.tex, |
| 32 |
% letltxmacro-test2.tex. |
| 33 |
% |
| 34 |
% Distribution: |
| 35 |
% CTAN:macros/latex/contrib/letltxmacro/letltxmacro.dtx |
| 36 |
% CTAN:macros/latex/contrib/letltxmacro/letltxmacro.pdf |
| 37 |
% |
| 38 |
% Unpacking: |
| 39 |
% (a) If letltxmacro.ins is present: |
| 40 |
% tex letltxmacro.ins |
| 41 |
% (b) Without letltxmacro.ins: |
| 42 |
% tex letltxmacro.dtx |
| 43 |
% (c) If you insist on using LaTeX |
| 44 |
% latex \let\install=y\input{letltxmacro.dtx} |
| 45 |
% (quote the arguments according to the demands of your shell) |
| 46 |
% |
| 47 |
% Documentation: |
| 48 |
% (a) If letltxmacro.drv is present: |
| 49 |
% latex letltxmacro.drv |
| 50 |
% (b) Without letltxmacro.drv: |
| 51 |
% latex letltxmacro.dtx; ... |
| 52 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 53 |
% if available. Here you can specify further options, e.g. |
| 54 |
% use A4 as paper format: |
| 55 |
% \PassOptionsToClass{a4paper}{article} |
| 56 |
% |
| 57 |
% Programm calls to get the documentation (example): |
| 58 |
% pdflatex letltxmacro.dtx |
| 59 |
% makeindex -s gind.ist letltxmacro.idx |
| 60 |
% pdflatex letltxmacro.dtx |
| 61 |
% makeindex -s gind.ist letltxmacro.idx |
| 62 |
% pdflatex letltxmacro.dtx |
| 63 |
% |
| 64 |
% Installation: |
| 65 |
% TDS:tex/latex/letltxmacro/letltxmacro.sty |
| 66 |
% TDS:doc/latex/letltxmacro/letltxmacro.pdf |
| 67 |
% TDS:doc/latex/letltxmacro/letltxmacro-showcases.tex |
| 68 |
% TDS:source/latex/letltxmacro/letltxmacro.dtx |
| 69 |
% |
| 70 |
%<*ignore> |
| 71 |
\begingroup |
| 72 |
\catcode123=1 % |
| 73 |
\catcode125=2 % |
| 74 |
\def\x{LaTeX2e}% |
| 75 |
\expandafter\endgroup |
| 76 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 77 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 78 |
\ifx\fmtname\x\else 1\fi\relax |
| 79 |
\else\csname fi\endcsname |
| 80 |
%</ignore> |
| 81 |
%<*install> |
| 82 |
\input docstrip.tex |
| 83 |
\Msg{************************************************************************} |
| 84 |
\Msg{* Installation} |
| 85 |
\Msg{* Package: letltxmacro 2019/12/03 v1.6 Let assignment for LaTeX macros (HO)} |
| 86 |
\Msg{************************************************************************} |
| 87 |
|
| 88 |
\keepsilent |
| 89 |
\askforoverwritefalse |
| 90 |
|
| 91 |
\let\MetaPrefix\relax |
| 92 |
\preamble |
| 93 |
|
| 94 |
This is a generated file. |
| 95 |
|
| 96 |
Project: letltxmacro |
| 97 |
Version: 2019/12/03 v1.6 |
| 98 |
|
| 99 |
Copyright (C) |
| 100 |
2008, 2010 Heiko Oberdiek |
| 101 |
2016-2019 Oberdiek Package Support Group |
| 102 |
|
| 103 |
This work may be distributed and/or modified under the |
| 104 |
conditions of the LaTeX Project Public License, either |
| 105 |
version 1.3c of this license or (at your option) any later |
| 106 |
version. This version of this license is in |
| 107 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 108 |
and the latest version of this license is in |
| 109 |
https://www.latex-project.org/lppl.txt |
| 110 |
and version 1.3 or later is part of all distributions of |
| 111 |
LaTeX version 2005/12/01 or later. |
| 112 |
|
| 113 |
This work has the LPPL maintenance status "maintained". |
| 114 |
|
| 115 |
The Current Maintainers of this work are |
| 116 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 117 |
https://github.com/ho-tex/letltxmacro/issues |
| 118 |
|
| 119 |
|
| 120 |
This work consists of the main source file letltxmacro.dtx |
| 121 |
and the derived files |
| 122 |
letltxmacro.sty, letltxmacro.pdf, letltxmacro.ins, letltxmacro.drv, |
| 123 |
letltxmacro-showcases.tex, letltxmacro-test1.tex, |
| 124 |
letltxmacro-test2.tex. |
| 125 |
|
| 126 |
\endpreamble |
| 127 |
\let\MetaPrefix\DoubleperCent |
| 128 |
|
| 129 |
\generate{% |
| 130 |
\file{letltxmacro.ins}{\from{letltxmacro.dtx}{install}}% |
| 131 |
\file{letltxmacro.drv}{\from{letltxmacro.dtx}{driver}}% |
| 132 |
\usedir{tex/latex/letltxmacro}% |
| 133 |
\file{letltxmacro.sty}{\from{letltxmacro.dtx}{package}}% |
| 134 |
\usedir{doc/latex/letltxmacro}% |
| 135 |
\file{letltxmacro-showcases.tex}{\from{letltxmacro.dtx}{showcases}}% |
| 136 |
% \usedir{doc/latex/letltxmacro/test}% |
| 137 |
% \file{letltxmacro-test1.tex}{\from{letltxmacro.dtx}{test1}}% |
| 138 |
% \file{letltxmacro-test2.tex}{\from{letltxmacro.dtx}{test2}}% |
| 139 |
} |
| 140 |
|
| 141 |
\catcode32=13\relax% active space |
| 142 |
\let =\space% |
| 143 |
\Msg{************************************************************************} |
| 144 |
\Msg{*} |
| 145 |
\Msg{* To finish the installation you have to move the following} |
| 146 |
\Msg{* file into a directory searched by TeX:} |
| 147 |
\Msg{*} |
| 148 |
\Msg{* letltxmacro.sty} |
| 149 |
\Msg{*} |
| 150 |
\Msg{* To produce the documentation run the file `letltxmacro.drv'} |
| 151 |
\Msg{* through LaTeX.} |
| 152 |
\Msg{*} |
| 153 |
\Msg{* Happy TeXing!} |
| 154 |
\Msg{*} |
| 155 |
\Msg{************************************************************************} |
| 156 |
|
| 157 |
\endbatchfile |
| 158 |
%</install> |
| 159 |
%<*ignore> |
| 160 |
\fi |
| 161 |
%</ignore> |
| 162 |
%<*driver> |
| 163 |
\NeedsTeXFormat{LaTeX2e} |
| 164 |
\ProvidesFile{letltxmacro.drv}% |
| 165 |
[2019/12/03 v1.6 Let assignment for LaTeX macros (HO)]% |
| 166 |
\documentclass{ltxdoc} |
| 167 |
\usepackage{holtxdoc}[2011/11/22] |
| 168 |
\begin{document} |
| 169 |
\DocInput{letltxmacro.dtx}% |
| 170 |
\end{document} |
| 171 |
%</driver> |
| 172 |
% \fi |
| 173 |
% |
| 174 |
% |
| 175 |
% |
| 176 |
% \GetFileInfo{letltxmacro.drv} |
| 177 |
% |
| 178 |
% \title{The \xpackage{letltxmacro} package} |
| 179 |
% \date{2019/12/03 v1.6} |
| 180 |
% \author{Heiko Oberdiek\thanks |
| 181 |
% {Please report any issues at \url{https://github.com/ho-tex/letltxmacro/issues}}} |
| 182 |
% |
| 183 |
% \maketitle |
| 184 |
% |
| 185 |
% \begin{abstract} |
| 186 |
% \TeX's \cs{let} assignment does not work for \LaTeX\ macros |
| 187 |
% with optional arguments or for macros that are defined |
| 188 |
% as robust macros by \cs{DeclareRobustCommand}. This package |
| 189 |
% defines \cs{LetLtxMacro} that also takes care of the involved |
| 190 |
% internal macros. |
| 191 |
% \end{abstract} |
| 192 |
% |
| 193 |
% \tableofcontents |
| 194 |
% |
| 195 |
% \section{Documentation} |
| 196 |
% |
| 197 |
% If someone wants to redefine a macro with using the old |
| 198 |
% meaning, then one method is \TeX's command \cs{let}: |
| 199 |
%\begin{quote} |
| 200 |
%\begin{verbatim} |
| 201 |
%\newcommand{\Macro}{\typeout{Test Macro}} |
| 202 |
%\let\SavedMacro=\Macro |
| 203 |
%\renewcommand{\Macro}{% |
| 204 |
% \typeout{Begin}% |
| 205 |
% \SavedMacro |
| 206 |
% \typeout{End}% |
| 207 |
%} |
| 208 |
%\end{verbatim} |
| 209 |
%\end{quote} |
| 210 |
% However, this method fails, if \cs{Macro} is defined |
| 211 |
% by \cs{DeclareRobustCommand} and/or has an optional argument. |
| 212 |
% In both cases \LaTeX\ defines an additional internal macro |
| 213 |
% that is forgotten in the simple \cs{let} assignment of |
| 214 |
% the example above. |
| 215 |
% |
| 216 |
% \begin{declcs}{LetLtxMacro} \M{new macro} \M{old macro} |
| 217 |
% \end{declcs} |
| 218 |
% Macro \cs{LetLtxMacro} behaves similar to \TeX's \cs{let} |
| 219 |
% assignment, but it takes care of macros that are |
| 220 |
% defined by \cs{DeclareRobustCommand} and/or have optional |
| 221 |
% arguments. Example: |
| 222 |
%\begin{quote} |
| 223 |
%\begin{verbatim} |
| 224 |
%\DeclareRobustCommand{\Macro}[1][default]{...} |
| 225 |
%\LetLtxMacro{\SavedMacro}{\Macro} |
| 226 |
%\end{verbatim} |
| 227 |
%\end{quote} |
| 228 |
% Then macro \cs{SavedMacro} only uses internal macro names |
| 229 |
% that are derived from \cs{SavedMacro}'s macro name. Macro \cs{Macro} |
| 230 |
% can now be redefined without affecting \cs{SavedMacro}. |
| 231 |
% |
| 232 |
% \begin{declcs}{GlobalLetLtxMacro} \M{new macro} \M{old macro} |
| 233 |
% \end{declcs} |
| 234 |
% Like \cs{LetLtxMacro}, but the \meta{new macro} is defined globally. |
| 235 |
% Since version 2019/12/03~v1.4. |
| 236 |
% |
| 237 |
% \subsection{Supported macro definition commands} |
| 238 |
% |
| 239 |
% \begin{quote} |
| 240 |
% \begin{tabular}{@{}ll@{}} |
| 241 |
% \cs{newcommand}, \cs{renewcommand} & latex/base\\ |
| 242 |
% \cs{newenvironment}, \cs{renewenvironment} & latex/base\\ |
| 243 |
% \cs{DeclareRobustCommand}& latex/base\\ |
| 244 |
% \cs{newrobustcmd}, \cs{renewrobustcmd} & etoolbox\\ |
| 245 |
% \cs{robustify} & etoolbox 2008/06/22 v1.6\\ |
| 246 |
% \end{tabular} |
| 247 |
% \end{quote} |
| 248 |
% |
| 249 |
% \StopEventually{ |
| 250 |
% } |
| 251 |
% |
| 252 |
% \section{Implementation} |
| 253 |
% |
| 254 |
% \subsection{Show cases} |
| 255 |
% |
| 256 |
% \subsubsection{\xfile{letltxmacro-showcases.tex}} |
| 257 |
% |
| 258 |
% \begin{macrocode} |
| 259 |
%<*showcases> |
| 260 |
\NeedsTeXFormat{LaTeX2e} |
| 261 |
\makeatletter |
| 262 |
% \end{macrocode} |
| 263 |
% \begin{macro}{\Line} |
| 264 |
% The result is displayed by macro \cs{Line}. The percent symbol |
| 265 |
% at line start allows easy grepping and inserting into the DTX |
| 266 |
% file. |
| 267 |
% \begin{macrocode} |
| 268 |
\newcommand*{\Line}[1]{% |
| 269 |
\typeout{\@percentchar#1}% |
| 270 |
} |
| 271 |
% \end{macrocode} |
| 272 |
% \end{macro} |
| 273 |
% \begin{macrocode} |
| 274 |
\newcommand*{\ShowCmdName}[1]{% |
| 275 |
\@ifundefined{#1}{}{% |
| 276 |
\Line{% |
| 277 |
\space\space(\expandafter\string\csname#1\endcsname) = % |
| 278 |
(\expandafter\meaning\csname#1\endcsname)% |
| 279 |
}% |
| 280 |
}% |
| 281 |
} |
| 282 |
\newcommand*{\ShowCmds}[1]{% |
| 283 |
\ShowCmdName{#1}% |
| 284 |
\ShowCmdName{#1 }% |
| 285 |
\ShowCmdName{\\#1}% |
| 286 |
\ShowCmdName{\\#1 }% |
| 287 |
} |
| 288 |
\let\\\@backslashchar |
| 289 |
% \end{macrocode} |
| 290 |
% \begin{macro}{\ShowDef} |
| 291 |
% \begin{macrocode} |
| 292 |
\newcommand*{\ShowDef}[2]{% |
| 293 |
\begingroup |
| 294 |
\Line{}% |
| 295 |
\newcommand*{\DefString}{#2}% |
| 296 |
\@onelevel@sanitize\DefString |
| 297 |
\Line{\DefString}% |
| 298 |
#2% |
| 299 |
\ShowCmds{#1}% |
| 300 |
\endgroup |
| 301 |
} |
| 302 |
% \end{macrocode} |
| 303 |
% \end{macro} |
| 304 |
% \begin{macrocode} |
| 305 |
\typeout{} |
| 306 |
\Line{* LaTeX definitions:} |
| 307 |
\ShowDef{cmd}{% |
| 308 |
\newcommand{\cmd}[2][default]{}% |
| 309 |
} |
| 310 |
\ShowDef{cmd}{% |
| 311 |
\DeclareRobustCommand{\cmd}{}% |
| 312 |
} |
| 313 |
\ShowDef{cmd}{% |
| 314 |
\DeclareRobustCommand{\cmd}[2][default]{}% |
| 315 |
} |
| 316 |
\typeout{} |
| 317 |
% \end{macrocode} |
| 318 |
% The minimal version of package \xpackage{etoolbox} is 2008/06/12 v1.6a |
| 319 |
% because it fixes \cs{robustify}. |
| 320 |
% \begin{macrocode} |
| 321 |
\RequirePackage{etoolbox}[2008/06/12]% |
| 322 |
\Line{} |
| 323 |
\Line{* etoolbox's robust definitions:} |
| 324 |
\ShowDef{cmd}{% |
| 325 |
\newrobustcmd{\cmd}{}% |
| 326 |
} |
| 327 |
\ShowDef{cmd}{% |
| 328 |
\newrobustcmd{\cmd}[2][default]{}% |
| 329 |
} |
| 330 |
\Line{} |
| 331 |
\Line{* etoolbox's \string\robustify:} |
| 332 |
\ShowDef{cmd}{% |
| 333 |
\newcommand{\cmd}[2][default]{} % |
| 334 |
\robustify{\cmd}% |
| 335 |
} |
| 336 |
\ShowDef{cmd}{% |
| 337 |
\DeclareRobustCommand{\cmd}{} % |
| 338 |
\robustify{\cmd}% |
| 339 |
} |
| 340 |
\ShowDef{cmd}{% |
| 341 |
\DeclareRobustCommand{\cmd}[2][default]{} % |
| 342 |
\robustify{\cmd}% |
| 343 |
} |
| 344 |
\typeout{} |
| 345 |
\@@end |
| 346 |
%</showcases> |
| 347 |
% \end{macrocode} |
| 348 |
% |
| 349 |
% \subsubsection{Result} |
| 350 |
% |
| 351 |
% \begingroup |
| 352 |
% \makeatletter |
| 353 |
% \let\org@verbatim\@verbatim |
| 354 |
% \def\@verbatim{^^A |
| 355 |
% \org@verbatim |
| 356 |
% \catcode`\~=\active |
| 357 |
% }^^A |
| 358 |
% \let~\textvisiblespace |
| 359 |
%\begin{verbatim} |
| 360 |
%* LaTeX definitions: |
| 361 |
% |
| 362 |
%\newcommand {\cmd }[2][default]{} |
| 363 |
% (\cmd) = (macro:->\@protected@testopt \cmd \\cmd {default}) |
| 364 |
% (\\cmd) = (\long macro:[#1]#2->) |
| 365 |
% |
| 366 |
%\DeclareRobustCommand {\cmd }{} |
| 367 |
% (\cmd) = (macro:->\protect \cmd~ ) |
| 368 |
% (\cmd~) = (\long macro:->) |
| 369 |
% |
| 370 |
%\DeclareRobustCommand {\cmd }[2][default]{} |
| 371 |
% (\cmd) = (macro:->\protect \cmd~ ) |
| 372 |
% (\cmd~) = (macro:->\@protected@testopt \cmd~ \\cmd~ {default}) |
| 373 |
% (\\cmd~) = (\long macro:[#1]#2->) |
| 374 |
% |
| 375 |
%* etoolbox's robust definitions: |
| 376 |
% |
| 377 |
%\newrobustcmd {\cmd }{} |
| 378 |
% (\cmd) = (\protected\long macro:->) |
| 379 |
% |
| 380 |
%\newrobustcmd {\cmd }[2][default]{} |
| 381 |
% (\cmd) = (\protected macro:->\@testopt \\cmd {default}) |
| 382 |
% (\\cmd) = (\long macro:[#1]#2->) |
| 383 |
% |
| 384 |
%* etoolbox's \robustify: |
| 385 |
% |
| 386 |
%\newcommand {\cmd }[2][default]{} \robustify {\cmd } |
| 387 |
% (\cmd) = (\protected macro:->\@protected@testopt \cmd \\cmd {default}) |
| 388 |
% (\\cmd) = (\long macro:[#1]#2->) |
| 389 |
% |
| 390 |
%\DeclareRobustCommand {\cmd }{} \robustify {\cmd } |
| 391 |
% (\cmd) = (\protected macro:->) |
| 392 |
% |
| 393 |
%\DeclareRobustCommand {\cmd }[2][default]{} \robustify {\cmd } |
| 394 |
% (\cmd) = (\protected macro:->\@protected@testopt \cmd~ \\cmd~ {default}) |
| 395 |
% (\cmd~) = (macro:->\@protected@testopt \cmd~ \\cmd~ {default}) |
| 396 |
% (\\cmd~) = (\long macro:[#1]#2->) |
| 397 |
%\end{verbatim} |
| 398 |
% \endgroup |
| 399 |
% |
| 400 |
% \subsection{Package} |
| 401 |
% |
| 402 |
% \begin{macrocode} |
| 403 |
%<*package> |
| 404 |
% \end{macrocode} |
| 405 |
% |
| 406 |
% \subsubsection{Catcodes and identification} |
| 407 |
% |
| 408 |
% \begin{macrocode} |
| 409 |
\begingroup\catcode61\catcode48\catcode32=10\relax% |
| 410 |
\catcode13=5 % ^^M |
| 411 |
\endlinechar=13 % |
| 412 |
\catcode123=1 % { |
| 413 |
\catcode125=2 % } |
| 414 |
\catcode64=11 % @ |
| 415 |
\def\x{\endgroup |
| 416 |
\expandafter\edef\csname llm@AtEnd\endcsname{% |
| 417 |
\endlinechar=\the\endlinechar\relax |
| 418 |
\catcode13=\the\catcode13\relax |
| 419 |
\catcode32=\the\catcode32\relax |
| 420 |
\catcode35=\the\catcode35\relax |
| 421 |
\catcode61=\the\catcode61\relax |
| 422 |
\catcode64=\the\catcode64\relax |
| 423 |
\catcode123=\the\catcode123\relax |
| 424 |
\catcode125=\the\catcode125\relax |
| 425 |
}% |
| 426 |
}% |
| 427 |
\x\catcode61\catcode48\catcode32=10\relax% |
| 428 |
\catcode13=5 % ^^M |
| 429 |
\endlinechar=13 % |
| 430 |
\catcode35=6 % # |
| 431 |
\catcode64=11 % @ |
| 432 |
\catcode123=1 % { |
| 433 |
\catcode125=2 % } |
| 434 |
\def\TMP@EnsureCode#1#2{% |
| 435 |
\edef\llm@AtEnd{% |
| 436 |
\llm@AtEnd |
| 437 |
\catcode#1=\the\catcode#1\relax |
| 438 |
}% |
| 439 |
\catcode#1=#2\relax |
| 440 |
} |
| 441 |
\TMP@EnsureCode{40}{12}% ( |
| 442 |
\TMP@EnsureCode{41}{12}% ) |
| 443 |
\TMP@EnsureCode{42}{12}% * |
| 444 |
\TMP@EnsureCode{45}{12}% - |
| 445 |
\TMP@EnsureCode{46}{12}% . |
| 446 |
\TMP@EnsureCode{47}{12}% / |
| 447 |
\TMP@EnsureCode{58}{12}% : |
| 448 |
\TMP@EnsureCode{62}{12}% > |
| 449 |
\TMP@EnsureCode{91}{12}% [ |
| 450 |
\TMP@EnsureCode{93}{12}% ] |
| 451 |
\edef\llm@AtEnd{% |
| 452 |
\llm@AtEnd |
| 453 |
\escapechar\the\escapechar\relax |
| 454 |
\noexpand\endinput |
| 455 |
} |
| 456 |
\escapechar=92 % `\\ |
| 457 |
% \end{macrocode} |
| 458 |
% |
| 459 |
% Package identification. |
| 460 |
% \begin{macrocode} |
| 461 |
\NeedsTeXFormat{LaTeX2e} |
| 462 |
\ProvidesPackage{letltxmacro}% |
| 463 |
[2019/12/03 v1.6 Let assignment for LaTeX macros (HO)] |
| 464 |
% \end{macrocode} |
| 465 |
% |
| 466 |
% \subsubsection{Main macros} |
| 467 |
% |
| 468 |
% \begin{macro}{\LetLtxMacro} |
| 469 |
% \begin{macrocode} |
| 470 |
\newcommand*{\LetLtxMacro}{% |
| 471 |
\llm@ModeLetLtxMacro{}% |
| 472 |
} |
| 473 |
% \end{macrocode} |
| 474 |
% \end{macro} |
| 475 |
% \begin{macro}{\GlobalLetLtxMacro} |
| 476 |
% \begin{macrocode} |
| 477 |
\newcommand*{\GlobalLetLtxMacro}{% |
| 478 |
\llm@ModeLetLtxMacro\global |
| 479 |
} |
| 480 |
% \end{macrocode} |
| 481 |
% \end{macro} |
| 482 |
% |
| 483 |
% \begin{macro}{\llm@ModeLetLtxMacro} |
| 484 |
% \begin{macrocode} |
| 485 |
\newcommand*{\llm@ModeLetLtxMacro}[3]{% |
| 486 |
\edef\llm@escapechar{\the\escapechar}% |
| 487 |
\escapechar=-1 % |
| 488 |
\edef\reserved@a{% |
| 489 |
\noexpand\protect |
| 490 |
\expandafter\noexpand |
| 491 |
\csname\string#3 \endcsname |
| 492 |
}% |
| 493 |
\ifx\reserved@a#3\relax |
| 494 |
#1\edef#2{% |
| 495 |
\noexpand\protect |
| 496 |
\expandafter\noexpand |
| 497 |
\csname\string#2 \endcsname |
| 498 |
}% |
| 499 |
#1\expandafter\let |
| 500 |
\csname\string#2 \expandafter\endcsname |
| 501 |
\csname\string#3 \endcsname |
| 502 |
\expandafter\llm@LetLtxMacro |
| 503 |
\csname\string#2 \expandafter\endcsname |
| 504 |
\csname\string#3 \endcsname{#1}% |
| 505 |
\else |
| 506 |
\llm@LetLtxMacro{#2}{#3}{#1}% |
| 507 |
\fi |
| 508 |
\escapechar=\llm@escapechar\relax |
| 509 |
} |
| 510 |
% \end{macrocode} |
| 511 |
% \end{macro} |
| 512 |
% \begin{macro}{\llm@LetLtxMacro} |
| 513 |
% \begin{macrocode} |
| 514 |
\def\llm@LetLtxMacro#1#2#3{% |
| 515 |
\escapechar=92 % |
| 516 |
\expandafter\llm@CheckParams\meaning#2:->\@nil{% |
| 517 |
\begingroup |
| 518 |
\def\@protected@testopt{% |
| 519 |
\expandafter\@testopt\@gobble |
| 520 |
}% |
| 521 |
\def\@testopt##1##2{% |
| 522 |
\toks@={##2}% |
| 523 |
}% |
| 524 |
\let\llm@testopt\@empty |
| 525 |
\edef\x{% |
| 526 |
\noexpand\@protected@testopt |
| 527 |
\noexpand#2% |
| 528 |
\expandafter\noexpand\csname\string#2\endcsname |
| 529 |
}% |
| 530 |
\expandafter\expandafter\expandafter\def |
| 531 |
\expandafter\expandafter\expandafter\y |
| 532 |
\expandafter\expandafter\expandafter{% |
| 533 |
\expandafter\llm@CarThree#2{}{}{}\llm@nil |
| 534 |
}% |
| 535 |
\ifx\x\y |
| 536 |
#2% |
| 537 |
\def\llm@testopt{% |
| 538 |
\noexpand\@protected@testopt |
| 539 |
\noexpand#1% |
| 540 |
}% |
| 541 |
\else |
| 542 |
\edef\x{% |
| 543 |
\noexpand\@testopt |
| 544 |
\expandafter\noexpand |
| 545 |
\csname\string#2\endcsname |
| 546 |
}% |
| 547 |
\expandafter\expandafter\expandafter\def |
| 548 |
\expandafter\expandafter\expandafter\y |
| 549 |
\expandafter\expandafter\expandafter{% |
| 550 |
\expandafter\llm@CarTwo#2{}{}\llm@nil |
| 551 |
}% |
| 552 |
\ifx\x\y |
| 553 |
#2% |
| 554 |
\def\llm@testopt{% |
| 555 |
\noexpand\@testopt |
| 556 |
}% |
| 557 |
\fi |
| 558 |
\fi |
| 559 |
\ifx\llm@testopt\@empty |
| 560 |
\else |
| 561 |
\llm@protected\xdef\llm@GlobalTemp{% |
| 562 |
\llm@testopt |
| 563 |
\expandafter\noexpand |
| 564 |
\csname\string#1\endcsname |
| 565 |
{\the\toks@}% |
| 566 |
}% |
| 567 |
\fi |
| 568 |
\expandafter\endgroup\ifx\llm@testopt\@empty |
| 569 |
#3\let#1=#2\relax |
| 570 |
\else |
| 571 |
#3\let#1=\llm@GlobalTemp |
| 572 |
#3\expandafter\let |
| 573 |
\csname\string#1\expandafter\endcsname |
| 574 |
\csname\string#2\endcsname |
| 575 |
\fi |
| 576 |
}{% |
| 577 |
#3\let#1=#2\relax |
| 578 |
}% |
| 579 |
} |
| 580 |
% \end{macrocode} |
| 581 |
% \end{macro} |
| 582 |
% \begin{macro}{\llm@CheckParams} |
| 583 |
% \begin{macrocode} |
| 584 |
\def\llm@CheckParams#1:->#2\@nil{% |
| 585 |
\begingroup |
| 586 |
\def\x{#1}% |
| 587 |
\ifx\x\llm@macro |
| 588 |
\endgroup |
| 589 |
\def\llm@protected{}% |
| 590 |
\expandafter\@firstoftwo |
| 591 |
\else |
| 592 |
\ifx\x\llm@protectedmacro |
| 593 |
\endgroup |
| 594 |
\def\llm@protected{\protected}% |
| 595 |
\expandafter\expandafter\expandafter\@firstoftwo |
| 596 |
\else |
| 597 |
\endgroup |
| 598 |
\expandafter\expandafter\expandafter\@secondoftwo |
| 599 |
\fi |
| 600 |
\fi |
| 601 |
} |
| 602 |
% \end{macrocode} |
| 603 |
% \end{macro} |
| 604 |
% \begin{macro}{\llm@macro} |
| 605 |
% \begin{macrocode} |
| 606 |
\def\llm@macro{macro} |
| 607 |
\@onelevel@sanitize\llm@macro |
| 608 |
% \end{macrocode} |
| 609 |
% \end{macro} |
| 610 |
% \begin{macro}{\llm@protectedmacro} |
| 611 |
% \begin{macrocode} |
| 612 |
\def\llm@protectedmacro{\protected macro} |
| 613 |
\@onelevel@sanitize\llm@protectedmacro |
| 614 |
% \end{macrocode} |
| 615 |
% \end{macro} |
| 616 |
% \begin{macro}{\llm@CarThree} |
| 617 |
% \begin{macrocode} |
| 618 |
\def\llm@CarThree#1#2#3#4\llm@nil{#1#2#3}% |
| 619 |
% \end{macrocode} |
| 620 |
% \end{macro} |
| 621 |
% \begin{macro}{\llm@CarTwo} |
| 622 |
% \begin{macrocode} |
| 623 |
\def\llm@CarTwo#1#2#3\llm@nil{#1#2}% |
| 624 |
% \end{macrocode} |
| 625 |
% \end{macro} |
| 626 |
% |
| 627 |
% \begin{macrocode} |
| 628 |
\llm@AtEnd% |
| 629 |
%</package> |
| 630 |
% \end{macrocode} |
| 631 |
% \section{Installation} |
| 632 |
% |
| 633 |
% \subsection{Download} |
| 634 |
% |
| 635 |
% \paragraph{Package.} This package is available on |
| 636 |
% CTAN\footnote{\CTANpkg{letltxmacro}}: |
| 637 |
% \begin{description} |
| 638 |
% \item[\CTAN{macros/latex/contrib/letltxmacro/letltxmacro.dtx}] The source file. |
| 639 |
% \item[\CTAN{macros/latex/contrib/letltxmacro/letltxmacro.pdf}] Documentation. |
| 640 |
% \end{description} |
| 641 |
% |
| 642 |
% |
| 643 |
% \paragraph{Bundle.} All the packages of the bundle `letltxmacro' |
| 644 |
% are also available in a TDS compliant ZIP archive. There |
| 645 |
% the packages are already unpacked and the documentation files |
| 646 |
% are generated. The files and directories obey the TDS standard. |
| 647 |
% \begin{description} |
| 648 |
% \item[\CTANinstall{install/macros/latex/contrib/letltxmacro.tds.zip}] |
| 649 |
% \end{description} |
| 650 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 651 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 652 |
% with \xfile{texmf} in their name are usually organized this way. |
| 653 |
% |
| 654 |
% \subsection{Bundle installation} |
| 655 |
% |
| 656 |
% \paragraph{Unpacking.} Unpack the \xfile{letltxmacro.tds.zip} in the |
| 657 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 658 |
% Example (linux): |
| 659 |
% \begin{quote} |
| 660 |
% |unzip letltxmacro.tds.zip -d ~/texmf| |
| 661 |
% \end{quote} |
| 662 |
% |
| 663 |
% \subsection{Package installation} |
| 664 |
% |
| 665 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 666 |
% \docstrip\ archive. The files are extracted by running the |
| 667 |
% \xfile{.dtx} through \plainTeX: |
| 668 |
% \begin{quote} |
| 669 |
% \verb|tex letltxmacro.dtx| |
| 670 |
% \end{quote} |
| 671 |
% |
| 672 |
% \paragraph{TDS.} Now the different files must be moved into |
| 673 |
% the different directories in your installation TDS tree |
| 674 |
% (also known as \xfile{texmf} tree): |
| 675 |
% \begin{quote} |
| 676 |
% \def\t{^^A |
| 677 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 678 |
% letltxmacro.sty & tex/latex/letltxmacro/letltxmacro.sty\\ |
| 679 |
% letltxmacro.pdf & doc/latex/letltxmacro/letltxmacro.pdf\\ |
| 680 |
% letltxmacro-showcases.tex & doc/latex/letltxmacro/letltxmacro-showcases.tex\\ |
| 681 |
% letltxmacro.dtx & source/latex/letltxmacro/letltxmacro.dtx\\ |
| 682 |
% \end{tabular}^^A |
| 683 |
% }^^A |
| 684 |
% \sbox0{\t}^^A |
| 685 |
% \ifdim\wd0>\linewidth |
| 686 |
% \begingroup |
| 687 |
% \advance\linewidth by\leftmargin |
| 688 |
% \advance\linewidth by\rightmargin |
| 689 |
% \edef\x{\endgroup |
| 690 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 691 |
% }\x |
| 692 |
% \def\lwbox{^^A |
| 693 |
% \leavevmode |
| 694 |
% \hbox to \linewidth{^^A |
| 695 |
% \kern-\leftmargin\relax |
| 696 |
% \hss |
| 697 |
% \usebox0 |
| 698 |
% \hss |
| 699 |
% \kern-\rightmargin\relax |
| 700 |
% }^^A |
| 701 |
% }^^A |
| 702 |
% \ifdim\wd0>\lw |
| 703 |
% \sbox0{\small\t}^^A |
| 704 |
% \ifdim\wd0>\linewidth |
| 705 |
% \ifdim\wd0>\lw |
| 706 |
% \sbox0{\footnotesize\t}^^A |
| 707 |
% \ifdim\wd0>\linewidth |
| 708 |
% \ifdim\wd0>\lw |
| 709 |
% \sbox0{\scriptsize\t}^^A |
| 710 |
% \ifdim\wd0>\linewidth |
| 711 |
% \ifdim\wd0>\lw |
| 712 |
% \sbox0{\tiny\t}^^A |
| 713 |
% \ifdim\wd0>\linewidth |
| 714 |
% \lwbox |
| 715 |
% \else |
| 716 |
% \usebox0 |
| 717 |
% \fi |
| 718 |
% \else |
| 719 |
% \lwbox |
| 720 |
% \fi |
| 721 |
% \else |
| 722 |
% \usebox0 |
| 723 |
% \fi |
| 724 |
% \else |
| 725 |
% \lwbox |
| 726 |
% \fi |
| 727 |
% \else |
| 728 |
% \usebox0 |
| 729 |
% \fi |
| 730 |
% \else |
| 731 |
% \lwbox |
| 732 |
% \fi |
| 733 |
% \else |
| 734 |
% \usebox0 |
| 735 |
% \fi |
| 736 |
% \else |
| 737 |
% \lwbox |
| 738 |
% \fi |
| 739 |
% \else |
| 740 |
% \usebox0 |
| 741 |
% \fi |
| 742 |
% \end{quote} |
| 743 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 744 |
% TDS installing feature, then some files can already be in the right |
| 745 |
% place, see the documentation of \docstrip. |
| 746 |
% |
| 747 |
% \subsection{Refresh file name databases} |
| 748 |
% |
| 749 |
% If your \TeX~distribution |
| 750 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 751 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 752 |
% \verb|mktexlsr|. |
| 753 |
% |
| 754 |
% \subsection{Some details for the interested} |
| 755 |
% |
| 756 |
% \paragraph{Unpacking with \LaTeX.} |
| 757 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 758 |
% \begin{description} |
| 759 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 760 |
% \item[\LaTeX:] Generate the documentation. |
| 761 |
% \end{description} |
| 762 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 763 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 764 |
% about your intention: |
| 765 |
% \begin{quote} |
| 766 |
% \verb|latex \let\install=y\input{letltxmacro.dtx}| |
| 767 |
% \end{quote} |
| 768 |
% Do not forget to quote the argument according to the demands |
| 769 |
% of your shell. |
| 770 |
% |
| 771 |
% \paragraph{Generating the documentation.} |
| 772 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 773 |
% the documentation. The process can be configured by the |
| 774 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 775 |
% line into this file, if you want to have A4 as paper format: |
| 776 |
% \begin{quote} |
| 777 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 778 |
% \end{quote} |
| 779 |
% An example follows how to generate the |
| 780 |
% documentation with pdf\LaTeX: |
| 781 |
% \begin{quote} |
| 782 |
%\begin{verbatim} |
| 783 |
%pdflatex letltxmacro.dtx |
| 784 |
%makeindex -s gind.ist letltxmacro.idx |
| 785 |
%pdflatex letltxmacro.dtx |
| 786 |
%makeindex -s gind.ist letltxmacro.idx |
| 787 |
%pdflatex letltxmacro.dtx |
| 788 |
%\end{verbatim} |
| 789 |
% \end{quote} |
| 790 |
% |
| 791 |
% \begin{History} |
| 792 |
% \begin{Version}{2008/06/09 v1.0} |
| 793 |
% \item |
| 794 |
% First version. |
| 795 |
% \end{Version} |
| 796 |
% \begin{Version}{2008/06/12 v1.1} |
| 797 |
% \item |
| 798 |
% Support for \xpackage{etoolbox}'s \cs{newrobustcmd} added. |
| 799 |
% \end{Version} |
| 800 |
% \begin{Version}{2008/06/13 v1.2} |
| 801 |
% \item |
| 802 |
% Support for \xpackage{etoolbox}'s \cs{robustify} added. |
| 803 |
% \end{Version} |
| 804 |
% \begin{Version}{2008/06/24 v1.3} |
| 805 |
% \item |
| 806 |
% Test file adapted for etoolbox 2008/06/22 v1.6. |
| 807 |
% \end{Version} |
| 808 |
% \begin{Version}{2010/09/02 v1.4} |
| 809 |
% \item |
| 810 |
% \cs{GlobalLetLtxMacro} added. |
| 811 |
% \end{Version} |
| 812 |
% \begin{Version}{2016/05/16 v1.5} |
| 813 |
% \item |
| 814 |
% Documentation updates. |
| 815 |
% \end{Version} |
| 816 |
% \begin{Version}{2019/12/03 v1.6} |
| 817 |
% \item |
| 818 |
% Documentation updates. |
| 819 |
% \end{Version} |
| 820 |
% \end{History} |
| 821 |
% |
| 822 |
% \PrintIndex |
| 823 |
% |
| 824 |
% \Finale |
| 825 |
\endinput |