%%
%% 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.
%% 
%% Copyright (C) 2008 by Heiko Oberdiek <oberdiek@uni-freiburg.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version. The latest version of this license is in
%%    http://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".
%% 
%% This Current Maintainer of this work is Heiko Oberdiek.
%% 
%% 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
  \catcode123 1 % {
  \catcode125 2 % }
  \def\x{\endgroup
    \expandafter\edef\csname llm@AtEnd\endcsname{%
      \catcode35 \the\catcode35\relax
      \catcode64 \the\catcode64\relax
      \catcode123 \the\catcode123\relax
      \catcode125 \the\catcode125\relax
    }%
  }%
\x
\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{61}{12}% =
\TMP@EnsureCode{62}{12}% >
\edef\llm@AtEnd{%
  \llm@AtEnd
  \escapechar\the\escapechar\relax
}
\escapechar=92 % `\\
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{letltxmacro}%
  [2008/06/24 v1.3 Let assignment for LaTeX macros (HO)]
\newcommand*{\LetLtxMacro}[2]{%
  \edef\reserved@a{%
    \noexpand\protect
    \expandafter\noexpand
    \csname\expandafter\@gobble\string#2 \endcsname
  }%
  \ifx\reserved@a#2\relax
    \edef#1{%
      \noexpand\protect
      \expandafter\noexpand
      \csname\expandafter\@gobble\string#1 \endcsname
    }%
    \expandafter\let
    \csname\expandafter\@gobble\string#1 \expandafter\endcsname
    \csname\expandafter\@gobble\string#2 \endcsname
    \expandafter\llm@LetLtxMacro
        \csname\expandafter\@gobble\string#1 \expandafter\endcsname
        \csname\expandafter\@gobble\string#2 \endcsname
  \else
    \llm@LetLtxMacro{#1}{#2}%
  \fi
}
\def\llm@LetLtxMacro#1#2{%
  \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
      \let#1=#2\relax
    \else
      \let#1=\llm@GlobalTemp
      \expandafter\let\csname\string#1\expandafter\endcsname
                      \csname\string#2\endcsname
    \fi
  }{%
    \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'.
