ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
Subject: Re: New math feature requests
Date: Sat, 26 Aug 2006 12:37:56 -0400 (EDT)	[thread overview]
Message-ID: <Pine.WNT.4.63.0608261229490.2292@nqvgln> (raw)
In-Reply-To: <Pine.WNT.4.63.0608250057150.2420@nqvgln>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1108 bytes --]

On Fri, 25 Aug 2006, Aditya Mahajan wrote:

> On Tue, 8 Aug 2006, Aditya Mahajan wrote:
>
> [ A long list of feature requests ]
>
> Here is something that was not in my original list: subformula
> numbering.
>
> [...]
>
> I was thinking of a better (rather more familar) way of treating
> subformulas by imitating the \begin{subequations} ....
> \end{subeqations} environment of latex.
>
> I propose a \startsubformula .... \stopsubformula environment, so
> that inside it, I will get subformula numbers rather than formula
> numbers. Having discovered conversions (see my previous mail on tagged
> formulas), I tried to implement it using conversions. The following
> straightforward approach works fine. This is just a stop gap code, I
> do not take care of inherting the right settings for formulas, but
> it conveys the idea.
>
> Hans and Taco, can something like this be added to the core? If so, I
> will try to make this macro more robust (correct inheritence, etc.)

Here is a more robust version. I use \??sf as a namespace for 
subformulas. I do not think that this is used anywhere else.

Aditya


[-- Attachment #2: subformulas.tex --]
[-- Type: TEXT/PLAIN, Size: 2022 bytes --]

\unprotect

%D \macros{setupsubformulas}

\def\setupsubformulas
  {\dodoubleargument\getparameters[\??sf]}

\definenumber
  [parentformula]
  [\c!text=parentformula,
   \c!way=\@@fmway]

\def\subformulaconversion#1%
  {\getnumber[parentformula]%
   \@@sfseparator%
   \convertnumber{\@@sfconversion}{#1}}

\defineconversion[subformulaconversion][\subformulaconversion]

%D \macros{startsubformulas}

\def\startsubformulas%
  {\bgroup
   \incrementnumber[\v!formula]
   \expanded{\setupnumber[parentformula][start={\rawnumber[\v!formula]}]}
   \savenumber[\v!formula]
   \setupformulas[conversion=subformulaconversion,way=\@@sfway]
   \resetnumber[\v!formula]}

\def\stopsubformulas%
  {\restorenumber[\v!formula]
   \resetlastlinewidth
   \nonoindentation
   \dochecknextindentation{\??sf}%
   \egroup
   \dorechecknextindentation} % here ?

% I have just copied the indentation checking from \stopformulas. I am not
% sure on how this works.


\setupsubformulas
  [\c!way=\v!by\v!text,
   \c!sectionnumber=\v!no,
   \c!conversion=\v!character,
   \c!separator=\@@fmseparator,
   \c!indentnext=\@@fmindentnext]

\protect

%D The test cases

\startbuffer
\placeformula \startformula
  a^2 + b^2 = c^2
\stopformula
\stopbuffer

\startsetups[test]
\dorecurse{3}{\getbuffer}

Lets start subformulas
\startsubformulas
  \dorecurse{3}{\getbuffer}
\stopsubformulas

Also works inside alignments
\startsubformulas
\placeformula \startformula \startalign
  \NC A \EQ B + C \NR[first]
  \NC D \EQ E + F \NR[+]
\stopalign \stopformula
\stopsubformulas

Notice that in \in formula[first] we get the correct reference.

\dorecurse{3}{\getbuffer}
\stopsetups


\starttext
\section{Default}
\setups[test]\page

\section{Section}
\setupformulas[way=bysection]
\setups[test]\page

\section{Roman}
\setupsubformulas[conversion=romannumerals]
\setups[test]\page

\section{Separator}
\setupsubformulas[separator=-]
\setups[test]\page

\stoptext

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

  reply	other threads:[~2006-08-26 16:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08  5:49 Aditya Mahajan
2006-08-08  5:59 ` Aditya Mahajan
2006-08-08  8:14   ` Hans Hagen
2006-08-08 14:20 ` Taco Hoekwater
2006-08-08 15:38   ` Aditya Mahajan
2006-08-25  1:34 ` Aditya Mahajan
2006-08-25  5:15 ` Aditya Mahajan
2006-08-26 16:37   ` Aditya Mahajan [this message]
2006-08-28 15:12     ` Wolfgang Schuster
2006-08-28 15:21       ` Hans Hagen
2006-08-28 17:10         ` Aditya Mahajan
2006-08-28 21:55           ` 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=Pine.WNT.4.63.0608261229490.2292@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).