ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Nikolai Weibull <context-list@pcppopper.org>
Subject: \doifnextcharelse problem
Date: Thu, 26 Feb 2004 17:38:13 +0100	[thread overview]
Message-ID: <20040226163813.GG26896@puritan.pcp.ath.cx> (raw)

[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]

It seems that I can't get \definecomplexorsimpleempty to work right.
The command I define works fine unless the simple version is called, in
which case the first character in the body of the command is checked
\doifnextcharelse[... which thus fails but in some manner eats it (even
though it is output).  The problem with the \doifnextcharelse is that
the character it checks against is \catcode'd to \@@active, but it won't
work when the character has been checked.  Is there any way to fix this?

I understand if my problem isn't that clear, so I've attached the module.
The idea is to be able to write
  \startbnfgrammar
    <exp>: <num>.
    <num>: "0";"1".
  \stopbnfgrammar
and this is then typeset as a table, but currently you're forced to write
  \startbnfgrammar[]
    <exp>: <num>.
    <num>: "0";"1".
  \stopbnfgrammar
or the first < in <exp> gets eaten by \doifnextcharelse and the
\def<{... won't be called causing problems down the line when the > is
encountered, which expands into a \egroup which stops tex as there is no
matching \bgroup.  Now, is there any way to get \doifnextcharelse to
properly deal with \catcode'd characters (such as my <) that it
encounters when looking for other characters (such as the [ for optional
arguments to commands)?  I'd really like to resolve this, so any
comments or tips are appreciated.

Second, is there any good reference to programming TeX?  I mean, one can
figure out most stuff from reading CONTEXT's source for example, but it
would be great to find out the exact implications of builtins such as
\relax and so on.
	nikolai

--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

[-- Attachment #2: m-bnf.tex --]
[-- Type: application/x-tex, Size: 4150 bytes --]

             reply	other threads:[~2004-02-26 16:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26 16:38 Nikolai Weibull [this message]
2004-02-26 18:00 ` Hans Hagen
2004-02-26 19:05   ` Nikolai Weibull
2004-02-27  7:53     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040226163813.GG26896@puritan.pcp.ath.cx \
    --to=context-list@pcppopper.org \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).