[NTG-context] adding an icon (flushed left) in a displayed formula with equation number
Aditya Mahajan
adityam at umich.edu
Mon Aug 7 17:40:57 CEST 2006
On Mon, 7 Aug 2006, Taco Hoekwater wrote:
>
> David Arnold wrote:
>> All,
>>
>> We have:
>>
>> \placeformula[eq:commonb]
>> \startformula
>> (1)^2+(\sqrt{4x+13})^2=(2x)^2,
>> \stopformula
>>
>>
>> This gives us a centered equation with an number pushed to the right
>> edge of the page (I probably should say text area).
>>
>> What we'd like to do, just in this one example (not globally), is add
>> a little "smiley face" icon on the same line as the displayed
>> equation and equation number, but pushed to the left edge of the page
>> (I probably should say text area).
>>
>> Possible?
>
> It should be possible to do this using a special version of \startalign,
> but I cannot figure it out. Maybe Aditya can help?
Here is one solution. Explaination inline.
% I do not know what you want for a smiley, so I use square instead
\def\smiley{\square}
\starttext
This is the basic idea. Have an alignment structure with three blocks,
each block of 1 column, put the simley in the first block, the
equation in the second block, and keep the third block empty. The
trick here is to have {\em 1 fil} in the distance.
\definemathalignment[dosmiley]
[n=1,m=3,distance=3em plus 1 fil]
\placeformula[+] \startformula \startdosmiley
\NC \smiley \NC (1)^2 + (\sqrt{4x+13})^2 = (2x)^2 \NC \NR[+]
\stopdosmiley \stopformula
Ah, it works. So we can add some syntax sugar around this, so that the
formula is easier to key in.
\def\startsmileyformula%
{\startformula \startdosmiley
\NC \smiley \NC}
\def\stopsmileyformula%
{\NC \NR[+]
\stopdosmiley \stopformula}
\placeformula[+] \startsmileyformula
(1)^2 + (\sqrt{4x+13})^2 = (2x)^2
\stopsmileyformula
If you only want a smiley without the equation, it also works.
:-)
\startsmileyformula
(1)^2 + (\sqrt{4x+13})^2 = (2x)^2
\stopsmileyformula
\stoptext
Can you send me how you make a smiley. I will then put the code in
myway on alignment.
Aditya
More information about the ntg-context
mailing list