ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: \placeformula and $$ doesn't work anymore
Date: Tue, 5 Dec 2006 17:09:44 -0500 (EST)	[thread overview]
Message-ID: <alpine.WNT.0.8.0612051705470.3752@nqvgln> (raw)
In-Reply-To: <alpine.WNT.0.8.0612051626400.3752@nqvgln>

On Tue, 5 Dec 2006, Aditya Mahajan wrote:

> On Mon, 4 Dec 2006, Hubertus Schmidt wrote:
> 
> > Hi all,
> > for some weeks I need to tex formulas again and tried the way I used to do it:
> > 
> > \placeformula
> > $$
> > f(t)={1\over2\pi}\int_0^\infty e^{i(\omega t-kx)} dx
> > $$
> > 
> > It didn't work anymore?!? It doesn't place a number nor does it do the spacing
> > properly. It does work the "context" way using
> > 
> > \placeformula
> > \startformula
> > f(t)={1\over2\pi}\int_0^\infty e^{i(\omega t-kx)} dx
> > \stopformula
> 
> This is a bug in doplaceformula. I do not know how to avoid it, but 
> the next code illustrates what is happening.
> 
> \def\dotest{
>    \def\nextnext{$}%
>    \ifx\next\nextnext
>      Inside dispplaceformula\ldots % This always fails
>    \else
>      Inside dodoplaceformula\ldots
>   \fi}
> 
> \def\test{\futurelet\next\dotest}
> 
> \test$$A = B$$
> 
> This prints "Inside dodoplaceformula" even though the next character 
> is \$.
> 
> So, the \next=\nextnext branch never matches. I do not know why this 
> happens, but a more robust check is needed in doplaceformula.

\ifcat seems to be working, but I do not really know how robust this 
is?

\unprotect

\def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces
   {\def\redoplaceformula
      {\bgroup
       \ifx\next\bgroup
         \egroup \@EA\moreplaceformula % [ref]{}
       \else
%      \def\nextnext{$}%
%      \ifx\next\nextnext
       \ifcat\next$%
           \egroup \@EAEAEA\dispplaceformula % [ref]$$
         \else
           \egroup \@EAEAEA\dodoplaceformula % [ref]\start
         \fi
       \fi[#1]{}}%
    \futurelet\next\redoplaceformula}

\long\def\moreplaceformula[#1]#2#3#4% #2 dummy #4 gobbles spaces
   {\def\redoplaceformula
      {\bgroup
%      \def\nextnext{$}%
%      \ifx\next\nextnext
       \ifcat\next$%
         \egroup \@EA\dispplaceformula % [ref]$$
       \else
         \egroup \@EA\dodoplaceformula % [ref]\start
       \fi
       [#1]{#3}}%
    \futurelet\next\redoplaceformula#4}

\protect

\starttext

\placeformula[eq:test]  $$A = B$$

\stoptext


Aditya

  reply	other threads:[~2006-12-05 22:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-04 21:24 Hubertus Schmidt
2006-12-05 21:46 ` Aditya Mahajan
2006-12-05 22:09   ` Aditya Mahajan [this message]
2006-12-05 22:53   ` Taco Hoekwater
2006-12-15 20:07   ` Hubertus
2006-12-16  8:32     ` Taco Hoekwater
2006-12-21 15:48       ` Aditya Mahajan

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=alpine.WNT.0.8.0612051705470.3752@nqvgln \
    --to=adityam@umich.edu \
    --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).