• No results found

The show2e package Manuel Pégourié-Gonnard mpg@elzevir.fr v1.0 (2008/03/13)

N/A
N/A
Protected

Academic year: 2021

Share "The show2e package Manuel Pégourié-Gonnard mpg@elzevir.fr v1.0 (2008/03/13)"

Copied!
2
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

The show2e package

Manuel Pégourié-Gonnard

mpg@elzevir.fr

v1.0 (2008/03/13)

Important note for French readers: the file show2e-fr.pdf contains the same documenation in French.

1

Introduction

This small package aims at making debugging (esp. in an interactive way) easier, by providing \show variants suited to LATEX 2ε’s commands (with optional arguments or robust) and environments.

2

Usage

The \showcmd command displays a command like TEX’s \show, but with a

\showcmd

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 \DeclareRobustCommandor fixltx2e’s \MakeRobust. Such commands use other(s) internal command(s), which \showcmd will also display for you.

The \showcs command does the same thing as \showcmd, but takes the

com-\showcs

\showenv mand’s name as its argument: \showcmd\truc is equivalent to \showcs{truc}. Finally, the \showenv command does the same for environments.

The previous commands will only work on simple commands defined with standard LATEX 2ε commands (or, by the way, with xargs): they do not try to guess such things as a direct use of \@ifnextchar, or even \@ifstar (at the moment).

3

Implementation

\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.

(2)

8 \showe@if@meaning@prefix@NoT #1 {\string\@protected@testopt}

9 {\showe@show@backslash@macro@N #1}%

10 \endgroup} \showcs

\showenv

The two variants are only wrappers for \showcmd. 11\newcommand* \showcs [1] {%

12 \expandafter \showcmd \csname#1\endcsname}

13\newcommand* \showenv [1] {%

14 \showcs{#1}%

15 \expandafter \show\csname end#1\endcsname} \showe@show@backslash@macro@N

\showe@show@space@macro@N

Macros for showing the internal macros found, either with \show or with \showcmd. 16\newcommand* \showe@show@backslash@macro@N [1] {%

17 \expandafter \show \csname\string#1\endcsname} 18\newcommand* \showe@show@space@macro@N [1] {% 19 \begingroup \escapechar\m@ne \expandafter\endgroup

20 \expandafter \showcmd \csname\string#1 \endcsname} \showe@if@meaning@prefix@NnT

\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).

21\newcommand* \showe@if@meaning@prefix@NnT [2] {%

22 \def \@tempa {#2}%

23 \showe@if@prefix@ooT {\meaning #1} {\meaning \@tempa}} 24\newcommand* \showe@if@meaning@prefix@NoT [2] {% 25 \expandafter \showe@if@meaning@prefix@NnT 26 \expandafter #1% 27 \expandafter {#2}} \showe@if@prefix@nnT \showe@if@prefix@ooT

Check if string 2 is a prefix of string 1. Variant expanding the two arguments once before checking.

28\newcommand* \showe@if@prefix@nnT [2] {%

29 \def \@tempa ##1#2##2\@nil {% 30 \ifx\empty##2\empty 31 \expandafter\@gobble 32 \else 33 \expandafter\@firstofone 34 \fi}% 35 \@tempa#1#2\@nil} 36\newcommand* \showe@if@prefix@ooT [2] {% 37 \edef \@tempa {{#1}{#2}}% 38 \expandafter \showe@if@prefix@nnT\@tempa}

That’s all folks!

Happy TEXing!

Referenties

GERELATEERDE DOCUMENTEN

As for example , covington checks if there is already an examples environment defined, and if this is the case, covington does not define its own one.. The

Macro \LetLtxMacro behaves similar to TEX’s \let assignment, but it takes care of macros that are defined by \DeclareRobustCommand and/or have optional ar-

The ling-macros package is designed to allow easier use of formal symbols used in formal linguistics, especially in formal linguistics.. The set arose from the macros that I have

Each stub file will declare the document class and load some packages (including this one) and then input the rest of the document from a file common to all

\robust@new@command{ hkommandoi}[hparam-numi][hdefault i]{hdefni} Dies definiert hkommandoi, falls noch nicht vorhanden, als robustes Makro (mit kurzen Argumenten) mit

tive \show de TEX, mais en effectuant en plus quelques tests pour savoir si la com- mande est une macro qui prend un argument optionnel (comme on peut en définir avec \newcommand ),

La version étoilée de \Substitute a pour but de vous simplifier la vie quand vous ne voulez pas spécifier explicitement une liste de lexèmes en entrée, mais plutôt utiliser le

However, we need to do one more test to detect the character tokens whose charcode is 32, before we apply \string to it in order to check if it was a control sequence.