%%
%% This is file `letltxmacro.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% letltxmacro.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Project: letltxmacro
%% Version: 2019/12/03 v1.6
%% 
%% Copyright (C)
%%    2008, 2010 Heiko Oberdiek
%%    2016-2019 Oberdiek Package Support Group
%% 
%% 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. This version of this license is in
%%    https://www.latex-project.org/lppl/lppl-1-3c.txt
%% and the latest version of this license is in
%%    https://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of
%% LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status "maintained".
%% 
%% The Current Maintainers of this work are
%% Heiko Oberdiek and the Oberdiek Package Support Group
%% https://github.com/ho-tex/letltxmacro/issues
%% 
%% 
%% This work consists of the main source file letltxmacro.dtx
%% and the derived files
%%    letltxmacro.sty, letltxmacro.pdf, letltxmacro.ins, letltxmacro.drv,
%%    letltxmacro-showcases.tex, letltxmacro-test1.tex,
%%    letltxmacro-test2.tex.
%% 
\begingroup\catcode61\catcode48\catcode32=10\relax%
  \catcode13=5 % ^^M
  \endlinechar=13 %
  \catcode123=1 % {
  \catcode125=2 % }
  \catcode64=11 % @
  \def\x{\endgroup
    \expandafter\edef\csname llm@AtEnd\endcsname{%
      \endlinechar=\the\endlinechar\relax
      \catcode13=\the\catcode13\relax
      \catcode32=\the\catcode32\relax
      \catcode35=\the\catcode35\relax
      \catcode61=\the\catcode61\relax
      \catcode64=\the\catcode64\relax
      \catcode123=\the\catcode123\relax
      \catcode125=\the\catcode125\relax
    }%
  }%
\x\catcode61\catcode48\catcode32=10\relax%
\catcode13=5 % ^^M
\endlinechar=13 %
\catcode35=6 % #
\catcode64=11 % @
\catcode123=1 % {
\catcode125=2 % }
\def\TMP@EnsureCode#1#2{%
  \edef\llm@AtEnd{%
    \llm@AtEnd
    \catcode#1=\the\catcode#1\relax
  }%
  \catcode#1=#2\relax
}
\TMP@EnsureCode{40}{12}% (
\TMP@EnsureCode{41}{12}% )
\TMP@EnsureCode{42}{12}% *
\TMP@EnsureCode{45}{12}% -
\TMP@EnsureCode{46}{12}% .
\TMP@EnsureCode{47}{12}% /
\TMP@EnsureCode{58}{12}% :
\TMP@EnsureCode{62}{12}% >
\TMP@EnsureCode{91}{12}% [
\TMP@EnsureCode{93}{12}% ]
\edef\llm@AtEnd{%
  \llm@AtEnd
  \escapechar\the\escapechar\relax
  \noexpand\endinput
}
\escapechar=92 % `\\
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{letltxmacro}%
  [2019/12/03 v1.6 Let assignment for LaTeX macros (HO)]
\newcommand*{\LetLtxMacro}{%
  \llm@ModeLetLtxMacro{}%
}
\newcommand*{\GlobalLetLtxMacro}{%
  \llm@ModeLetLtxMacro\global
}
\newcommand*{\llm@ModeLetLtxMacro}[3]{%
  \edef\llm@escapechar{\the\escapechar}%
  \escapechar=-1 %
  \edef\reserved@a{%
    \noexpand\protect
    \expandafter\noexpand
    \csname\string#3 \endcsname
  }%
  \ifx\reserved@a#3\relax
    #1\edef#2{%
      \noexpand\protect
      \expandafter\noexpand
      \csname\string#2 \endcsname
    }%
    #1\expandafter\let
    \csname\string#2 \expandafter\endcsname
    \csname\string#3 \endcsname
    \expandafter\llm@LetLtxMacro
        \csname\string#2 \expandafter\endcsname
        \csname\string#3 \endcsname{#1}%
  \else
    \llm@LetLtxMacro{#2}{#3}{#1}%
  \fi
  \escapechar=\llm@escapechar\relax
}
\def\llm@LetLtxMacro#1#2#3{%
  \escapechar=92 %
  \expandafter\llm@CheckParams\meaning#2:->\@nil{%
    \begingroup
      \def\@protected@testopt{%
        \expandafter\@testopt\@gobble
      }%
      \def\@testopt##1##2{%
        \toks@={##2}%
      }%
      \let\llm@testopt\@empty
      \edef\x{%
        \noexpand\@protected@testopt
        \noexpand#2%
        \expandafter\noexpand\csname\string#2\endcsname
      }%
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\y
      \expandafter\expandafter\expandafter{%
        \expandafter\llm@CarThree#2{}{}{}\llm@nil
      }%
      \ifx\x\y
        #2%
        \def\llm@testopt{%
          \noexpand\@protected@testopt
          \noexpand#1%
        }%
      \else
        \edef\x{%
          \noexpand\@testopt
          \expandafter\noexpand
          \csname\string#2\endcsname
        }%
        \expandafter\expandafter\expandafter\def
        \expandafter\expandafter\expandafter\y
        \expandafter\expandafter\expandafter{%
          \expandafter\llm@CarTwo#2{}{}\llm@nil
        }%
        \ifx\x\y
          #2%
          \def\llm@testopt{%
            \noexpand\@testopt
          }%
        \fi
      \fi
      \ifx\llm@testopt\@empty
      \else
        \llm@protected\xdef\llm@GlobalTemp{%
          \llm@testopt
          \expandafter\noexpand
          \csname\string#1\endcsname
          {\the\toks@}%
        }%
      \fi
    \expandafter\endgroup\ifx\llm@testopt\@empty
      #3\let#1=#2\relax
    \else
      #3\let#1=\llm@GlobalTemp
      #3\expandafter\let
          \csname\string#1\expandafter\endcsname
          \csname\string#2\endcsname
    \fi
  }{%
    #3\let#1=#2\relax
  }%
}
\def\llm@CheckParams#1:->#2\@nil{%
  \begingroup
    \def\x{#1}%
  \ifx\x\llm@macro
    \endgroup
    \def\llm@protected{}%
    \expandafter\@firstoftwo
  \else
    \ifx\x\llm@protectedmacro
      \endgroup
      \def\llm@protected{\protected}%
      \expandafter\expandafter\expandafter\@firstoftwo
    \else
      \endgroup
      \expandafter\expandafter\expandafter\@secondoftwo
    \fi
  \fi
}
\def\llm@macro{macro}
\@onelevel@sanitize\llm@macro
\def\llm@protectedmacro{\protected macro}
\@onelevel@sanitize\llm@protectedmacro
\def\llm@CarThree#1#2#3#4\llm@nil{#1#2#3}%
\def\llm@CarTwo#1#2#3\llm@nil{#1#2}%
\llm@AtEnd%
\endinput
%%
%% End of file `letltxmacro.sty'.
