%
% \iffalse  /!\  this file contains non-ascii --  encoding is utf-8 /!\
%
%     show2e package by Manuel P\'egouri\'e-Gonnard <mpg@elzevir.fr>
%     --------------------------------------------------------------
%
% 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.  The latest version of this
% license is in:
%
%   http://www.latex-project.org/lppl.txt
%
% and version 1.3c or later is part of all distributions of LaTeX
% version 2006/05/20 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The current maintainer of this work is Manuel P\'egouri\'e-Gonnard.
%
% This work consists of the file show2e.dtx and the derived files
% show2e.sty, show2e.pdf and show2e-fr.pdf.
%
%
%<*gobble>
\ProvidesFile{show2e.dtx}
%</gobble>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{show2e}
%<*package>
% \fi
% \ProvidesFile{show2e.dtx}
  [2008/03/13 v1.0 \space \show variants for latex2e \space (mpg)]
% \iffalse
%</package>
% \fi
% \CheckSum{85}
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
% \iffalse
%<*gobble>
\begingroup
%</gobble>
%<*batchfile>
\input docstrip
\keepsilent
\preamble

show2e package by Manuel P\string\'egouri\string\'e-Gonnard %
<mpg@elzevir.fr>
This is a generated file. See show2e.dtx for license information.

\endpreamble
\askforoverwritefalse
%\generate{\file{show2e.ins}{\from{show2e.dtx}{batchfile}}}
%\generate{\file{show2e.drv}{\from{show2e.dtx}{driver}}}
\generate{\file{show2e.sty}{\from{show2e.dtx}{package}}}
\generate{\file{show2e-fr.drv}{\from{show2e.dtx}{pilote}}}
%</batchfile>
%<*gobble>
\endgroup
%</gobble>
%<*driver|pilote>
\documentclass[oneside, a4paper]{ltxdoc}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[babel=true, expansion=false]{microtype}
\usepackage{fixltx2e}
\expandafter\newif\csname iffrenchdoc\endcsname % cachez ce if...
%<pilote>\frenchdoctrue
%</driver|pilote>
%<*gobble>
\iffrenchdoc
%</gobble>
%<*pilote>
\usepackage[lmargin=4.5cm, rmargin=3cm]{geometry}
\OnlyDescription
\usepackage[english, french]{babel}
\FrenchFootnotes \AddThinSpaceBeforeFootnotes
\newcommand*\eng[1]{\emph{\foreignlanguage{english}{#1}}}
\usepackage[bookmarks=false]{hyperref}
\hypersetup{%
  pdftitle=L'extension show2e
  pdfsubject=Une DESCRIPTION}
%</pilote>
%<*gobble>
\else
%</gobble>
%<*driver>
\AlsoImplementation
\usepackage[english]{babel}
\usepackage[bookmarks=false]{hyperref}
\hypersetup{%
  pdftitle=The show2e package,
  pdfsubject=A DESCRIPTION}
\settowidth\MacroIndent{\rmfamily\scriptsize 000\ }
\setlength\MacroTopsep{0pt}
\setcounter{tocdepth}{1}
%</driver>
%<*gobble>
\fi
%</gobble>
%<*driver|pilote>
\hypersetup{%
  colorlinks=true, linkcolor=black, urlcolor=black,
  pdfauthor=Manuel Pégourié-Gonnard}
\newcommand\file{\nolinkurl}
\newcommand\pf{\textsf}
\newcommand\optstar{\meta{$*$}}
\newcommand\topcs[1]{\texorpdfstring{\cs{#1}}{#1}}
\begin{document}
  \DocInput{show2e.dtx}
\end{document}
%</driver|pilote>
%<*package>
% \fi
%
% \GetFileInfo{show2e.dtx}
%
% \title{\iffrenchdoc L'extension \pf{show2e}\else The \pf{show2e} package\fi}
% \author{Manuel Pégourié-Gonnard\\ 
%   \href{mailto:mpg@elzevir.fr}{mpg@elzevir.fr}}
% \date{\fileversion\ (\filedate)}
% 
% \maketitle
%
% \iffrenchdoc\else
% \bigbreak\noindent
% \emph{Important note for French readers}: the file
% \file{show2e-fr.pdf} contains the same documenation in French.
% \fi
%
% \section{Introduction}
%
% \iffrenchdoc
%
% Cette toute petite extension a pour but de simplifier légèrement le
% déboguage, notamment interactif, en fournissant quelques variantes de
% |\show| adaptées aux objets introduits par \LaTeXe{} : commandes à
% arguments optionnels, commandes robustes, environnements.
%
% \else
%
% This small package aims at making debugging (esp.\@ in an interactive
% way) easier, by providing |\show| variants suited to \LaTeXe's
% commands (with optional arguments or robust) and environments.
%
% \fi
%
% \section{Usage}
% 
% \iffrenchdoc
%
% \DescribeMacro{\showcmd}
% La commande |\showcmd| sert à afficher une commande comme le ferait la
% primitive |\show| de \TeX, mais en effectuant en plus quelques tests
% pour savoir si la commande est une macro qui prend un argument
% optionnel (comme on peut en définir avec |\newcommand|), ou qui a été
% définie comme robuste avec |\DeclareRobustCommand|, ou ultérieurement
% rendue robuste par |\MakeRobust| (fourni par \pf{fixltx2e}). Dans ce
% cas, la commande utilise aussi une ou plusieurs macros interne, que
% |\showcmd| affichera automatiquement pour vous.
%
% \DescribeMacro{\showcs}
% \DescribeMacro{\showenv}
% La variante |\showcs| fonctionne de la même manière, mais prend comme
% argument le \emph{nom} de la commande entre accolades : les deux
% formes |\showcmd\truc| et |\showcs{truc}| sont donc équivalentes.
% Enfin, |\showenv| montre les definitions de début et de fin d'un
% environnement.
%
% \medbreak
%
% C'est tout pour la description des commandes. Il faut bien remarquer
% qu'elles ne sont pas infaillibles, et ne fonctionnent qu'avec les
% commandes crées par les macros standard de \LaTeXe{} (et celles de
% \pf{xargs}, d'ailleurs) : elles n'essayent pas de prendre en compte
% des usages directs de |\@ifnextchar|, ni même de |\@ifstar| (pour le
% moment).
% 
% Pour les curieux, le code commenté apparaît à la fin de la version
% anglaise de cette documentation
%
% \begin{center}\large
% C'est tout pour cette fois ! \\
% Amusez-vous bien avec \LaTeX{} !
% \end{center}
%
% \else
% 
% \DescribeMacro{\showcmd}
% The |\showcmd| command displays a command like \TeX's |\show|, but
% with a little bonus: it also checks if the macros takes an optional
% argument (like some commands defined with |\newcommand| do), or was
% made robust by using |\DeclareRobustCommand| or \pf{fixltx2e}'s
% |\MakeRobust|. Such commands use other(s) internal command(s), which
% |\showcmd| will also display for you.
%
% \DescribeMacro{\showcs}
% \DescribeMacro{\showenv}
% The |\showcs| command does the same thing as |\showcmd|, but takes the
% command's \emph{name} as its argument: |\showcmd\truc| is equivalent
% to |\showcs{truc}|. Finally, the |\showenv| command does the same for
% environments.
%
% \medbreak
%
% The previous commands will only work on simple commands defined with
% standard \LaTeXe{} commands (or, by the way, with \pf{xargs}): they
% do not try to guess such things as a direct use of |\@ifnextchar|, or
% even |\@ifstar| (at the moment).
%
% \fi
%
% \StopEventually{}
%
% \section{Implementation}
%
% \begin{macro}{\showcmd}
% The |\showcmd| macro just checks to beginning of the meaning of is
% argument, in order to decide if there are any internal macro to
% show too. It also sets a default value for |\escapechar| for sake of
% readability.
%    \begin{macrocode}
\newcommand* \showcmd [1] {%
  \begingroup \escapechar92
  \show#1%
  \showe@if@meaning@prefix@NnT #1 {\x@protect} 
    {\showe@show@space@macro@N #1}%
  \showe@if@meaning@prefix@NnT #1 {\protect}
    {\showe@show@space@macro@N #1}%
  \showe@if@meaning@prefix@NoT #1 {\string\@protected@testopt}
    {\showe@show@backslash@macro@N #1}%
  \endgroup}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\showcs}
% \begin{macro}{\showenv}
% The two variants are only wrappers for |\showcmd|.
%    \begin{macrocode}
\newcommand* \showcs [1] {%
  \expandafter \showcmd \csname#1\endcsname}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand* \showenv [1] {%
  \showcs{#1}%
  \expandafter \show\csname end#1\endcsname}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\showe@show@backslash@macro@N}
% \begin{macro}{\showe@show@space@macro@N}
% Macros for showing the internal macros found, either with |\show| or
% with |\showcmd|.
%    \begin{macrocode}
\newcommand* \showe@show@backslash@macro@N [1] {%
  \expandafter \show \csname\string#1\endcsname}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand* \showe@show@space@macro@N [1] {%
  \begingroup \escapechar\m@ne \expandafter\endgroup
  \expandafter \showcmd \csname\string#1 \endcsname}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\showe@if@meaning@prefix@NnT}
% \begin{macro}{\showe@if@meaning@prefix@NoT}
% Check if the second argument is a prefix for the meaning of the first.
% Variant expanding the second argument once before (named in l3 style).
%    \begin{macrocode}
\newcommand* \showe@if@meaning@prefix@NnT [2] {%
  \def \@tempa {#2}%
  \showe@if@prefix@ooT {\meaning #1} {\meaning \@tempa}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand* \showe@if@meaning@prefix@NoT [2] {%
  \expandafter \showe@if@meaning@prefix@NnT
  \expandafter #1%
  \expandafter {#2}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\showe@if@prefix@nnT}
% \begin{macro}{\showe@if@prefix@ooT}
% Check if string 2 is a prefix of string 1. Variant expanding the two
% arguments once before checking.
%    \begin{macrocode}
\newcommand* \showe@if@prefix@nnT [2] {%
  \def \@tempa ##1#2##2\@nil {%
    \ifx\empty##2\empty
      \expandafter\@gobble
    \else
      \expandafter\@firstofone
    \fi}%
  \@tempa#1#2\@nil}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand* \showe@if@prefix@ooT [2] {%
  \edef \@tempa {{#1}{#2}}%
  \expandafter \showe@if@prefix@nnT\@tempa}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \bigskip
% \begin{center}\Large
% That's all folks!\\
% Happy \TeX ing!
% \end{center}
%
% \Finale
%
% \iffalse
%</package>
%<*batchfile>
% \fi
% \begingroup\obeyspaces
% \typeout{*****************************************************}
% \typeout{*                                                   *}
% \typeout{* To finish the installation you have to move the   *}
% \typeout{* following file into a directory searched by TeX:  *}
% \typeout{*                                                   *}
% \typeout{*      show2e.sty                                   *}
% \typeout{*                                                   *}
% \typeout{* Documentation is in show2e.dvi or show2e.pdf      *}
% \typeout{*                                                   *}
% \typeout{* To produce the french documentation, run          *}
% \typeout{*      (pdf)latex show2e-fr.drv                     *}
% \typeout{*                                                   *}
% \typeout{* Happy TeXing!                                     *}
% \typeout{*                                                   *}
% \typeout{*****************************************************}
% \endgroup
% \iffalse
%</batchfile>
% \fi
\endinput