| 1 |
% |
| 2 |
% \iffalse /!\ this file contains non-ascii -- encoding is utf-8 /!\ |
| 3 |
% |
| 4 |
% show2e package by Manuel P\'egouri\'e-Gonnard <[email protected]> |
| 5 |
% -------------------------------------------------------------- |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the conditions of |
| 8 |
% the LaTeX Project Public License, either version 1.3c of this license |
| 9 |
% or (at your option) any later version. The latest version of this |
| 10 |
% license is in: |
| 11 |
% |
| 12 |
% http://www.latex-project.org/lppl.txt |
| 13 |
% |
| 14 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 15 |
% version 2006/05/20 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status `maintained'. |
| 18 |
% |
| 19 |
% The current maintainer of this work is Manuel P\'egouri\'e-Gonnard. |
| 20 |
% |
| 21 |
% This work consists of the file show2e.dtx and the derived files |
| 22 |
% show2e.sty, show2e.pdf and show2e-fr.pdf. |
| 23 |
% |
| 24 |
% |
| 25 |
%<*gobble> |
| 26 |
\ProvidesFile{show2e.dtx} |
| 27 |
%</gobble> |
| 28 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 29 |
%<package>\ProvidesPackage{show2e} |
| 30 |
%<*package> |
| 31 |
% \fi |
| 32 |
% \ProvidesFile{show2e.dtx} |
| 33 |
[2008/03/13 v1.0 \space \show variants for latex2e \space (mpg)] |
| 34 |
% \iffalse |
| 35 |
%</package> |
| 36 |
% \fi |
| 37 |
% \CheckSum{85} |
| 38 |
% \CharacterTable |
| 39 |
% {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 |
| 40 |
% 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 |
| 41 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 42 |
% Exclamation \! Double quote \" Hash (number) \# |
| 43 |
% Dollar \$ Percent \% Ampersand \& |
| 44 |
% Acute accent \' Left paren \( Right paren \) |
| 45 |
% Asterisk \* Plus \+ Comma \, |
| 46 |
% Minus \- Point \. Solidus \/ |
| 47 |
% Colon \: Semicolon \; Less than \< |
| 48 |
% Equals \= Greater than \> Question mark \? |
| 49 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 50 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 51 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 52 |
% Right brace \} Tilde \~} |
| 53 |
% \iffalse |
| 54 |
%<*gobble> |
| 55 |
\begingroup |
| 56 |
%</gobble> |
| 57 |
%<*batchfile> |
| 58 |
\input docstrip |
| 59 |
\keepsilent |
| 60 |
\preamble |
| 61 |
|
| 62 |
show2e package by Manuel P\string\'egouri\string\'e-Gonnard % |
| 63 |
<[email protected]> |
| 64 |
This is a generated file. See show2e.dtx for license information. |
| 65 |
|
| 66 |
\endpreamble |
| 67 |
\askforoverwritefalse |
| 68 |
%\generate{\file{show2e.ins}{\from{show2e.dtx}{batchfile}}} |
| 69 |
%\generate{\file{show2e.drv}{\from{show2e.dtx}{driver}}} |
| 70 |
\generate{\file{show2e.sty}{\from{show2e.dtx}{package}}} |
| 71 |
\generate{\file{show2e-fr.drv}{\from{show2e.dtx}{pilote}}} |
| 72 |
%</batchfile> |
| 73 |
%<*gobble> |
| 74 |
\endgroup |
| 75 |
%</gobble> |
| 76 |
%<*driver|pilote> |
| 77 |
\documentclass[oneside, a4paper]{ltxdoc} |
| 78 |
\usepackage[utf8]{inputenc} |
| 79 |
\usepackage[T1]{fontenc} |
| 80 |
\usepackage{lmodern} |
| 81 |
\usepackage[babel=true, expansion=false]{microtype} |
| 82 |
\usepackage{fixltx2e} |
| 83 |
\expandafter\newif\csname iffrenchdoc\endcsname % cachez ce if... |
| 84 |
%<pilote>\frenchdoctrue |
| 85 |
%</driver|pilote> |
| 86 |
%<*gobble> |
| 87 |
\iffrenchdoc |
| 88 |
%</gobble> |
| 89 |
%<*pilote> |
| 90 |
\usepackage[lmargin=4.5cm, rmargin=3cm]{geometry} |
| 91 |
\OnlyDescription |
| 92 |
\usepackage[english, french]{babel} |
| 93 |
\FrenchFootnotes \AddThinSpaceBeforeFootnotes |
| 94 |
\newcommand*\eng[1]{\emph{\foreignlanguage{english}{#1}}} |
| 95 |
\usepackage[bookmarks=false]{hyperref} |
| 96 |
\hypersetup{% |
| 97 |
pdftitle=L'extension show2e |
| 98 |
pdfsubject=Une DESCRIPTION} |
| 99 |
%</pilote> |
| 100 |
%<*gobble> |
| 101 |
\else |
| 102 |
%</gobble> |
| 103 |
%<*driver> |
| 104 |
\AlsoImplementation |
| 105 |
\usepackage[english]{babel} |
| 106 |
\usepackage[bookmarks=false]{hyperref} |
| 107 |
\hypersetup{% |
| 108 |
pdftitle=The show2e package, |
| 109 |
pdfsubject=A DESCRIPTION} |
| 110 |
\settowidth\MacroIndent{\rmfamily\scriptsize 000\ } |
| 111 |
\setlength\MacroTopsep{0pt} |
| 112 |
\setcounter{tocdepth}{1} |
| 113 |
%</driver> |
| 114 |
%<*gobble> |
| 115 |
\fi |
| 116 |
%</gobble> |
| 117 |
%<*driver|pilote> |
| 118 |
\hypersetup{% |
| 119 |
colorlinks=true, linkcolor=black, urlcolor=black, |
| 120 |
pdfauthor=Manuel Pégourié-Gonnard} |
| 121 |
\newcommand\file{\nolinkurl} |
| 122 |
\newcommand\pf{\textsf} |
| 123 |
\newcommand\optstar{\meta{$*$}} |
| 124 |
\newcommand\topcs[1]{\texorpdfstring{\cs{#1}}{#1}} |
| 125 |
\begin{document} |
| 126 |
\DocInput{show2e.dtx} |
| 127 |
\end{document} |
| 128 |
%</driver|pilote> |
| 129 |
%<*package> |
| 130 |
% \fi |
| 131 |
% |
| 132 |
% \GetFileInfo{show2e.dtx} |
| 133 |
% |
| 134 |
% \title{\iffrenchdoc L'extension \pf{show2e}\else The \pf{show2e} package\fi} |
| 135 |
% \author{Manuel Pégourié-Gonnard\\ |
| 136 |
% \href{mailto:[email protected]}{[email protected]}} |
| 137 |
% \date{\fileversion\ (\filedate)} |
| 138 |
% |
| 139 |
% \maketitle |
| 140 |
% |
| 141 |
% \iffrenchdoc\else |
| 142 |
% \bigbreak\noindent |
| 143 |
% \emph{Important note for French readers}: the file |
| 144 |
% \file{show2e-fr.pdf} contains the same documenation in French. |
| 145 |
% \fi |
| 146 |
% |
| 147 |
% \section{Introduction} |
| 148 |
% |
| 149 |
% \iffrenchdoc |
| 150 |
% |
| 151 |
% Cette toute petite extension a pour but de simplifier légèrement le |
| 152 |
% déboguage, notamment interactif, en fournissant quelques variantes de |
| 153 |
% |\show| adaptées aux objets introduits par \LaTeXe{} : commandes à |
| 154 |
% arguments optionnels, commandes robustes, environnements. |
| 155 |
% |
| 156 |
% \else |
| 157 |
% |
| 158 |
% This small package aims at making debugging (esp.\@ in an interactive |
| 159 |
% way) easier, by providing |\show| variants suited to \LaTeXe's |
| 160 |
% commands (with optional arguments or robust) and environments. |
| 161 |
% |
| 162 |
% \fi |
| 163 |
% |
| 164 |
% \section{Usage} |
| 165 |
% |
| 166 |
% \iffrenchdoc |
| 167 |
% |
| 168 |
% \DescribeMacro{\showcmd} |
| 169 |
% La commande |\showcmd| sert à afficher une commande comme le ferait la |
| 170 |
% primitive |\show| de \TeX, mais en effectuant en plus quelques tests |
| 171 |
% pour savoir si la commande est une macro qui prend un argument |
| 172 |
% optionnel (comme on peut en définir avec |\newcommand|), ou qui a été |
| 173 |
% définie comme robuste avec |\DeclareRobustCommand|, ou ultérieurement |
| 174 |
% rendue robuste par |\MakeRobust| (fourni par \pf{fixltx2e}). Dans ce |
| 175 |
% cas, la commande utilise aussi une ou plusieurs macros interne, que |
| 176 |
% |\showcmd| affichera automatiquement pour vous. |
| 177 |
% |
| 178 |
% \DescribeMacro{\showcs} |
| 179 |
% \DescribeMacro{\showenv} |
| 180 |
% La variante |\showcs| fonctionne de la même manière, mais prend comme |
| 181 |
% argument le \emph{nom} de la commande entre accolades : les deux |
| 182 |
% formes |\showcmd\truc| et |\showcs{truc}| sont donc équivalentes. |
| 183 |
% Enfin, |\showenv| montre les definitions de début et de fin d'un |
| 184 |
% environnement. |
| 185 |
% |
| 186 |
% \medbreak |
| 187 |
% |
| 188 |
% C'est tout pour la description des commandes. Il faut bien remarquer |
| 189 |
% qu'elles ne sont pas infaillibles, et ne fonctionnent qu'avec les |
| 190 |
% commandes crées par les macros standard de \LaTeXe{} (et celles de |
| 191 |
% \pf{xargs}, d'ailleurs) : elles n'essayent pas de prendre en compte |
| 192 |
% des usages directs de |\@ifnextchar|, ni même de |\@ifstar| (pour le |
| 193 |
% moment). |
| 194 |
% |
| 195 |
% Pour les curieux, le code commenté apparaît à la fin de la version |
| 196 |
% anglaise de cette documentation |
| 197 |
% |
| 198 |
% \begin{center}\large |
| 199 |
% C'est tout pour cette fois ! \\ |
| 200 |
% Amusez-vous bien avec \LaTeX{} ! |
| 201 |
% \end{center} |
| 202 |
% |
| 203 |
% \else |
| 204 |
% |
| 205 |
% \DescribeMacro{\showcmd} |
| 206 |
% The |\showcmd| command displays a command like \TeX's |\show|, but |
| 207 |
% with a little bonus: it also checks if the macros takes an optional |
| 208 |
% argument (like some commands defined with |\newcommand| do), or was |
| 209 |
% made robust by using |\DeclareRobustCommand| or \pf{fixltx2e}'s |
| 210 |
% |\MakeRobust|. Such commands use other(s) internal command(s), which |
| 211 |
% |\showcmd| will also display for you. |
| 212 |
% |
| 213 |
% \DescribeMacro{\showcs} |
| 214 |
% \DescribeMacro{\showenv} |
| 215 |
% The |\showcs| command does the same thing as |\showcmd|, but takes the |
| 216 |
% command's \emph{name} as its argument: |\showcmd\truc| is equivalent |
| 217 |
% to |\showcs{truc}|. Finally, the |\showenv| command does the same for |
| 218 |
% environments. |
| 219 |
% |
| 220 |
% \medbreak |
| 221 |
% |
| 222 |
% The previous commands will only work on simple commands defined with |
| 223 |
% standard \LaTeXe{} commands (or, by the way, with \pf{xargs}): they |
| 224 |
% do not try to guess such things as a direct use of |\@ifnextchar|, or |
| 225 |
% even |\@ifstar| (at the moment). |
| 226 |
% |
| 227 |
% \fi |
| 228 |
% |
| 229 |
% \StopEventually{} |
| 230 |
% |
| 231 |
% \section{Implementation} |
| 232 |
% |
| 233 |
% \begin{macro}{\showcmd} |
| 234 |
% The |\showcmd| macro just checks to beginning of the meaning of is |
| 235 |
% argument, in order to decide if there are any internal macro to |
| 236 |
% show too. It also sets a default value for |\escapechar| for sake of |
| 237 |
% readability. |
| 238 |
% \begin{macrocode} |
| 239 |
\newcommand* \showcmd [1] {% |
| 240 |
\begingroup \escapechar92 |
| 241 |
\show#1% |
| 242 |
\showe@if@meaning@prefix@NnT #1 {\x@protect} |
| 243 |
{\showe@show@space@macro@N #1}% |
| 244 |
\showe@if@meaning@prefix@NnT #1 {\protect} |
| 245 |
{\showe@show@space@macro@N #1}% |
| 246 |
\showe@if@meaning@prefix@NoT #1 {\string\@protected@testopt} |
| 247 |
{\showe@show@backslash@macro@N #1}% |
| 248 |
\endgroup} |
| 249 |
% \end{macrocode} |
| 250 |
% \end{macro} |
| 251 |
% \begin{macro}{\showcs} |
| 252 |
% \begin{macro}{\showenv} |
| 253 |
% The two variants are only wrappers for |\showcmd|. |
| 254 |
% \begin{macrocode} |
| 255 |
\newcommand* \showcs [1] {% |
| 256 |
\expandafter \showcmd \csname#1\endcsname} |
| 257 |
% \end{macrocode} |
| 258 |
% \begin{macrocode} |
| 259 |
\newcommand* \showenv [1] {% |
| 260 |
\showcs{#1}% |
| 261 |
\expandafter \show\csname end#1\endcsname} |
| 262 |
% \end{macrocode} |
| 263 |
% \end{macro} |
| 264 |
% \end{macro} |
| 265 |
% \begin{macro}{\showe@show@backslash@macro@N} |
| 266 |
% \begin{macro}{\showe@show@space@macro@N} |
| 267 |
% Macros for showing the internal macros found, either with |\show| or |
| 268 |
% with |\showcmd|. |
| 269 |
% \begin{macrocode} |
| 270 |
\newcommand* \showe@show@backslash@macro@N [1] {% |
| 271 |
\expandafter \show \csname\string#1\endcsname} |
| 272 |
% \end{macrocode} |
| 273 |
% \begin{macrocode} |
| 274 |
\newcommand* \showe@show@space@macro@N [1] {% |
| 275 |
\begingroup \escapechar\m@ne \expandafter\endgroup |
| 276 |
\expandafter \showcmd \csname\string#1 \endcsname} |
| 277 |
% \end{macrocode} |
| 278 |
% \end{macro} |
| 279 |
% \end{macro} |
| 280 |
% \begin{macro}{\showe@if@meaning@prefix@NnT} |
| 281 |
% \begin{macro}{\showe@if@meaning@prefix@NoT} |
| 282 |
% Check if the second argument is a prefix for the meaning of the first. |
| 283 |
% Variant expanding the second argument once before (named in l3 style). |
| 284 |
% \begin{macrocode} |
| 285 |
\newcommand* \showe@if@meaning@prefix@NnT [2] {% |
| 286 |
\def \@tempa {#2}% |
| 287 |
\showe@if@prefix@ooT {\meaning #1} {\meaning \@tempa}} |
| 288 |
% \end{macrocode} |
| 289 |
% \begin{macrocode} |
| 290 |
\newcommand* \showe@if@meaning@prefix@NoT [2] {% |
| 291 |
\expandafter \showe@if@meaning@prefix@NnT |
| 292 |
\expandafter #1% |
| 293 |
\expandafter {#2}} |
| 294 |
% \end{macrocode} |
| 295 |
% \end{macro} |
| 296 |
% \end{macro} |
| 297 |
% \begin{macro}{\showe@if@prefix@nnT} |
| 298 |
% \begin{macro}{\showe@if@prefix@ooT} |
| 299 |
% Check if string 2 is a prefix of string 1. Variant expanding the two |
| 300 |
% arguments once before checking. |
| 301 |
% \begin{macrocode} |
| 302 |
\newcommand* \showe@if@prefix@nnT [2] {% |
| 303 |
\def \@tempa ##1#2##2\@nil {% |
| 304 |
\ifx\empty##2\empty |
| 305 |
\expandafter\@gobble |
| 306 |
\else |
| 307 |
\expandafter\@firstofone |
| 308 |
\fi}% |
| 309 |
\@tempa#1#2\@nil} |
| 310 |
% \end{macrocode} |
| 311 |
% \begin{macrocode} |
| 312 |
\newcommand* \showe@if@prefix@ooT [2] {% |
| 313 |
\edef \@tempa {{#1}{#2}}% |
| 314 |
\expandafter \showe@if@prefix@nnT\@tempa} |
| 315 |
% \end{macrocode} |
| 316 |
% \end{macro} |
| 317 |
% \end{macro} |
| 318 |
% |
| 319 |
% |
| 320 |
% \bigskip |
| 321 |
% \begin{center}\Large |
| 322 |
% That's all folks!\\ |
| 323 |
% Happy \TeX ing! |
| 324 |
% \end{center} |
| 325 |
% |
| 326 |
% \Finale |
| 327 |
% |
| 328 |
% \iffalse |
| 329 |
%</package> |
| 330 |
%<*batchfile> |
| 331 |
% \fi |
| 332 |
% \begingroup\obeyspaces |
| 333 |
% \typeout{*****************************************************} |
| 334 |
% \typeout{* *} |
| 335 |
% \typeout{* To finish the installation you have to move the *} |
| 336 |
% \typeout{* following file into a directory searched by TeX: *} |
| 337 |
% \typeout{* *} |
| 338 |
% \typeout{* show2e.sty *} |
| 339 |
% \typeout{* *} |
| 340 |
% \typeout{* Documentation is in show2e.dvi or show2e.pdf *} |
| 341 |
% \typeout{* *} |
| 342 |
% \typeout{* To produce the french documentation, run *} |
| 343 |
% \typeout{* (pdf)latex show2e-fr.drv *} |
| 344 |
% \typeout{* *} |
| 345 |
% \typeout{* Happy TeXing! *} |
| 346 |
% \typeout{* *} |
| 347 |
% \typeout{*****************************************************} |
| 348 |
% \endgroup |
| 349 |
% \iffalse |
| 350 |
%</batchfile> |
| 351 |
% \fi |
| 352 |
\endinput |