ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Grouping with \dosingleempty
@ 2006-06-05 23:04 Aditya Mahajan
  2006-06-06  7:54 ` Taco Hoekwater
  0 siblings, 1 reply; 3+ messages in thread
From: Aditya Mahajan @ 2006-06-05 23:04 UTC (permalink / raw)


Hi,
  I am confused why the following definition does not work as expected.

\def\PM{\dosingleempty\doPM}
\def\doPM[#1]{\iffirstargument P_{M_{#1}}
   \else P_{M_t}\fi}

\starttext
Why is $\widetilde \PM[T]$ not the same as $\widetilde P_{M_T}$
\stoptext

Can I change the definition so that

$\widetilede \PM$ is same as $\widetilde P_{M_t}$
and
$\widetilede \PM[T]$ is same as $\widetilde P_{M_T}$

Thanks,
Aditya

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Grouping with \dosingleempty
  2006-06-05 23:04 Grouping with \dosingleempty Aditya Mahajan
@ 2006-06-06  7:54 ` Taco Hoekwater
  2006-06-06 13:49   ` Aditya Mahajan
  0 siblings, 1 reply; 3+ messages in thread
From: Taco Hoekwater @ 2006-06-06  7:54 UTC (permalink / raw)


Aditya Mahajan wrote:
> Hi,
>   I am confused why the following definition does not work as expected.
> 
> \def\PM{\dosingleempty\doPM}
> \def\doPM[#1]{\iffirstargument P_{M_{#1}}
>    \else P_{M_t}\fi}
> 
> \starttext
> Why is $\widetilde \PM[T]$ not the same as $\widetilde P_{M_T}$
> \stoptext

The argument to \widetilde cannot be a macro that requires
arguments, that just won't work. If you want the accent on
top of a single character, you have to give it a single
argument. It is possbile to do so, like this:

   \def\PM{P\dosingleempty\doPM}
   \def\doPM[#1]{\iffirstargument _{M_{#1}}\else _{M_t}\fi}
   \let\normalwidetilde\widetilde
   \def\widetilde{\expandafter\normalwidetilde}

But it is better to create a new set of macros \widetildePM.

Cheers,
Taco

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Grouping with \dosingleempty
  2006-06-06  7:54 ` Taco Hoekwater
@ 2006-06-06 13:49   ` Aditya Mahajan
  0 siblings, 0 replies; 3+ messages in thread
From: Aditya Mahajan @ 2006-06-06 13:49 UTC (permalink / raw)


On Tue, 6 Jun 2006, Taco Hoekwater wrote:

> Aditya Mahajan wrote:
>> Hi,
>>   I am confused why the following definition does not work as expected.
>>
>> \def\PM{\dosingleempty\doPM}
>> \def\doPM[#1]{\iffirstargument P_{M_{#1}}
>>    \else P_{M_t}\fi}
>>
>> \starttext
>> Why is $\widetilde \PM[T]$ not the same as $\widetilde P_{M_T}$
>> \stoptext
>
> The argument to \widetilde cannot be a macro that requires
> arguments, that just won't work. If you want the accent on
> top of a single character, you have to give it a single
> argument. It is possbile to do so, like this:
>
>   \def\PM{P\dosingleempty\doPM}
>   \def\doPM[#1]{\iffirstargument _{M_{#1}}\else _{M_t}\fi}
>   \let\normalwidetilde\widetilde
>   \def\widetilde{\expandafter\normalwidetilde}

Thanks. I will test around to see it this has undesired side-effects. 
If something else breaks, I will define

\def\ewidetilde{\expandafter\widetilde}

and use \ewidetilde before \PM.

> But it is better to create a new set of macros \widetildePM.

That is what I was doing till now. But I have a lot of costructs like 
this, \PM[t] <=> P_{M_t}, \PYM <=> P_{Y_t,M_{t-1}}, \PYMS <=> 
P_{Y_t,M_{t-1},S_t} and so on and all of them can have widetilde and 
wildehat. Gets kind of boring to define \tPM for widetilde \hPM for 
widehat for all of them.

Thanks,
Aditya

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-06-06 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-05 23:04 Grouping with \dosingleempty Aditya Mahajan
2006-06-06  7:54 ` Taco Hoekwater
2006-06-06 13:49   ` Aditya Mahajan

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).