[texhax] Is redefining primitives a good idea?

Paul Isambert zappathustra at free.fr
Tue Apr 24 07:29:31 CEST 2012


Vafa Khalighi <simurgh12 at gmail.com> a écrit:
> 
> On Tue, Apr 24, 2012 at 3:38 AM, Khaled Hosny <khaledhosny at eglug.org> wrote:
> 
> > On Mon, Apr 23, 2012 at 12:48:16PM +1000, Vafa Khalighi wrote:
> > > As an example amsmath.sty redefines \eqno and \leqno. Would not it be better to
> > > define new macros rather than redefining existing primitives?

As far as I'm concerned, I've always thought it is a very bad idea to
redefine primitives. Some people do know the meaning of primitives and
do use them that way; as soon as you redefine them, you create a
discrepancy between the way the engine works and the way it is
supposed to work (according to the reference manual, TeXbook, etc.).

>                                                                   and how one can
> > > (if a package already redefines some primitives), restore the original
> > > definition of the primitive? so that a primitive is really a primitive?
> >
> > PdfTeX has \pdfprimitive that can be used to access the original
> > definition of any primitive, e.g. \pdfprimitive\eqno. LuaTeX and XeTeX
> > have it under \primitive name.
> 
> TeX (PDFTeX, XeTeX, luatex) complains that:
> 
> You can't use \eqno in vertical mode.

It should be used in display math only: $$...\eqno(15)$$

Best,
Paul



More information about the texhax mailing list