bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

backslashes, macros, indexes, texinfo


From: Karl Berry
Subject: backslashes, macros, indexes, texinfo
Date: Tue, 2 Jun 2015 00:15:06 GMT

Werner, David,

Coming back to:

    http://lists.gnu.org/archive/html/bug-texinfo/2011-08/msg00002.html

where the crux of the test document is

@macro funindex {TEXT}
@findex \TEXT\
@kindex \TEXT\
@c
@end macro
@funindex \relative
@funindex relative

Here are some ideas to cope with the regrettably extant
incompatibilities between Perl makeinfo, C makeinfo, and different
versions of texinfo.tex.

---------
1) In the (unlikely but happy) event that the \foo index entries are
paired with foo entries, I think you could move the \ into the macro
definition.  In what I've tried, this works reliably across all the
above implementations.  As in:

@macro funindexbs {TEXT}
@findex \\\TEXT\
@kindex \\\TEXT\
@findex \TEXT\
@kindex \TEXT\
@c
@end macro
@funindexbs relative

-------
2) In the (also unlikely but happy) case that you're willing to
require Texinfo 5, you could use @backslashchar{}.  In what I've tried,
this works reliably in both Perl makeinfo and different texinfo.tex
versions.  It doesn't exist in C makeinfo.  As in (with the original
@macro funindex):

@funindex @backslashchar{}relative
@funindex relative

-------
3) I could add a simple (@set) option to execute or not execute the
\catcode`\\=0 in \macroargctxt, so you could control it from your
Texinfo source.  But then you'd need to require the latest texinfo.tex,
so I doubt that would satisfy.

-------
4) Of course you could just write out the double-index entries instead
of using a @macro.  Then everything works.  But I doubt you want to do that.

-------
5) Not a solution, but just to mention -- you don't need to physically
modify texinfo.tex to override \macroargctxt.  For instance, your .texi
could have:

@tex
\gdef\macroargctxt{\scanctxt}
@end tex

-------
6) I recognize that you want me to just omit the \catcode`\\=0.  That
may solve your problem, but it creates problems for other people doing
other things with @macro.  For instance, you're invoking the macro with
a whole-line argument; macros taking braced arguments have a different
set of problems in this area.  

So either way there are incompatibilities between the various
implementations, just different sets of incompatibilities.  And what
texinfo.tex is doing now is what matches the documentation, as it
stands.  (I could write a lot more about the discrepancies I've found in
the various scenarios, but I'll spare you.)

It's theoretically conceivable to change the TeX behavior (and
documentation) to be closer to makeinfo, but it would remain inevitably
imperfect, and be fraught with potential problems (\futurelet, catcodes,
etc.).  Therefore I don't want to expend the time and effort if any
simpler solution will suffice.

karl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]