bug-texinfo
[Top][All Lists]
Advanced

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

Re: backslashes, macros, indexes, texinfo


From: Gavin Smith
Subject: Re: backslashes, macros, indexes, texinfo
Date: Mon, 22 Jun 2015 14:21:06 +0100

On 22 June 2015 at 00:37, Gavin Smith <address@hidden> wrote:
> However, you would still want to interpret backslashes, so that "\\",
> "\{" and "\}" (and maybe "\,") would be interpreted as "\", "{", "}"
> and "," respectively, while leaving "\a" as "\a" for any other
> character "a". You'd want to do this for compatibility with existing
> documents and makeinfo implementations. I've been experimenting with
> making "\" an active character to try to get this to work, however
> it's not there yet. (I'm still struggling to "grok" TeX; I've been
> working with "TeX by Topic" which has gotten me a lot further than any
> of my previous attempts.)

Hello David and Karl,

Allow me to post my work so far. I seem to have something working for
backslashes. I haven't got { and } to work yet.

My test file is "macro-backslash.texi", attached. I've tested macro
invocations both with and without braces, to check that I am not
messing anything up for the case with braces. To test this, try
replacing one of the instances of "\\yesbrace" with "\yesbrace", in
order to get an error message about an undefined control sequence. As
you can see from the output dvi file, both "\\" and "\" effect a "\"
in the output for a line argument.

The diff is attached for texinfo.tex. I've added a second macro
\oneargbraceorline, based on the existing \braceorline. This sets the
catcodes for reading the macro argument depending on whether a {
followed the use of the macro name. If it's a line argument, we simply
call \scanctxt, which doesn't set catcode for \ to 0, instead of
calling \macroargctxt. We also \let \ to a new \sometimesescape macro,
which is intended to escape backslashes only (and { and } as well, if
I ever get that to work).

To be honest I don't know why it is working: I don't understand is why
\ is active when reading the argument. Hopefully it is not a fluke.

Attachment: backslash-active.diff
Description: Text document

Attachment: macro-backslash.texi
Description: TeXInfo document

Attachment: macro-backslash.dvi
Description: TeX dvi file


reply via email to

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