ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: adding an icon (flushed left) in a displayed formula with equation number
Date: Mon, 7 Aug 2006 11:40:57 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0608071136170.3468@nqvgln> (raw)
In-Reply-To: <44D71576.7060203@elvenkind.com>

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

      reply	other threads:[~2006-08-07 15:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-05 20:37 David Arnold
2006-08-07 10:27 ` Taco Hoekwater
2006-08-07 15:40   ` Aditya Mahajan [this message]

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=Pine.WNT.4.63.0608071136170.3468@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).