Print

Print


I began putting together a script to facilitate the process of
converting an LaTeX2e package to LaTeX3. (Since, in fact, there is a
largish package that I want to try converting.) Then it occurred to me
I ought to check with the readers of this list to guard against
reinventing a wheel that someone else has done already.

Consider this (slightly simplified) fragment from ltdefns.dtx:

  % \begin{macro}{\CheckCommand}
  %    |\CheckCommand| takes the same arguments as |\newcommand|. If
  %    the command already exists, with the same definition, then
  %    nothing happens, otherwise a warning is issued. Useful for
  %    checking the current state befor a macro package starts
  %    redefining things.  Currently two macros are considered to have
  %    the same definition if they are the same except for different
  %    default arguments.  That is, if the old definition was:
  %    |\newcommand\xxx[2][a]{(#1)(#2)}| then
  %    |\CheckCommand\xxx[2][b]{(#1)(#2)}| would \emph{not} generate a
  %    warning, but, for instance |\CheckCommand\xxx[2]{(#1)(#2)}|
  %    would.
  %    \begin{macrocode}
  \def\CheckCommand{\@star@or@long\check@command}
  %    \end{macrocode}
  % \end{macro}

Naturally we want to convert control sequences in the macrocode
blocks to LaTeX3 equivalents. We also want to convert the argument
of \begin{macro}, as well as references in the commentary to LaTeX2e
internal control sequences. But the mention of \newcommand should
probably be left alone, not to mention the \xxx, and the \emph also
should not be converted.

Macro name references usually take one of the following forms:

  |\foo|
  \verb|\foo|
  \verb'\foo'
  \cs{foo}

I will probably write the script in Emacs Lisp with the idea of
reusing some fragments later in setting up a LaTeX3 programmer's mode
for Emacs. The largest part of the work would seem to be setting up a
table of name pairs.

Michael Downes