From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/31626 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: formula, bookmarks and misc Date: Sun, 29 Oct 2006 01:38:21 -0500 (EST) Message-ID: References: <4543FF4E.5050905@free.fr> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1162103921 12271 80.91.229.2 (29 Oct 2006 06:38:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 29 Oct 2006 06:38:41 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Sun Oct 29 07:38:38 2006 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ge4JW-0002Fy-Nf for gctc-ntg-context-518@m.gmane.org; Sun, 29 Oct 2006 07:38:34 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 612191FE2F; Sun, 29 Oct 2006 07:38:33 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 32025-01; Sun, 29 Oct 2006 07:38:28 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 253201FE34; Sun, 29 Oct 2006 07:38:28 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 2842B1FE39 for ; Sun, 29 Oct 2006 07:38:26 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31869-03 for ; Sun, 29 Oct 2006 07:38:23 +0100 (CET) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.93.161]) by ronja.ntg.nl (Postfix) with SMTP id EA6511FE2F for ; Sun, 29 Oct 2006 07:38:22 +0100 (CET) Original-Received: FROM aditya.annarb01.mi.comcast.net (c-68-40-50-205.hsd1.mi.comcast.net [68.40.50.205]) BY tombraider.mr.itd.umich.edu ID 45444C5D.49C11.29733 ; 29 Oct 2006 01:38:21 -0500 Original-To: mailing list for ConTeXt users In-Reply-To: <4543FF4E.5050905@free.fr> X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.7 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:31626 Archived-At: On Sun, 29 Oct 2006, Sebastian Rooks wrote: > Dear ConTeXters, > > 1/ I would like to use a named formula with a reference containing > several subformulae each with a reference. The closer I can get to is to > add an empty namedformula followed by subformulae (see test file below). > How can I get rid of the empty line with a number in the pdf ? I took a different approach to this. I had written some macros that do automatic subformula numbering, and I added a macro there to do have a named subformulas. See the code at the end. > 4/ How can I redefine the \vec command in my formulae without having a > warning "system : command \vec is already defined" \def\vec#1{whatever} will not give you a warning. You get a warning only if you use \define. > 5/ I do like a lot the minimum distribution so easy to install. It would > be even better if bibtex can be added. It's only 82.8 KiB bibtex is part of the minimal distribution for windows. It is in texmf-mswin/bin/ Now, coming back to the code for subformulas. I defined a \startnamedsubformulas[tag]{name} to take care of "named" subformulas. This is build on top of an existing \startsubformulas ... \stopsubformulas that do automatic numbering of subformulas. See the examples in the end. \unprotect \definesystemvariable {fn} % subForMulas % Suggestion by Hans to use fn %D \macros{setupsubformulas} \def\setupsubformulas {\dodoubleargument\getparameters[\??fn]} \definenumber [parent\v!formula] \def\subformulaconversion#1% {\getnumber[parent\v!formula]% \@@fnseparator% \convertnumber{\@@fnconversion}{#1}} \defineconversion[sub\v!formula\c!conversion][\subformulaconversion] %D \macros{startsubformulas} \def\startsubformulas% {\dosingleempty\dostartsubformulas} \def\dostartsubformulas[#1]% {\incrementnumber[\v!formula] \makesectionnumber[\v!formula] \iffirstargument \rawreference{\s!for}{#1}{\composedsectionnumber} \fi \expanded{\setupnumber [parent\v!formula] [start={\rawnumber[\v!formula]}, \c!way=\@@fmway, conversion=\@@fmconversion]} \savenumber[\v!formula] \bgroup \setupformulas[\c!conversion=sub\v!formula\c!conversion,\c!way=\v!by\v!text] \resetnumber[\v!formula]} \def\stopsubformulas% {\restorenumber[\v!formula] \resetlastlinewidth \nonoindentation \dochecknextindentation{\??fn}% \egroup \dorechecknextindentation} % here ? % I have just copied the indentation checking from \stopformulas. I am not % sure on how this works. I did not change this to take care of side % floats %D Named subformulas \def\startnamedsubformulas% {\dosingleempty\dostartnamedsubformulas} \def\dostartnamedsubformulas[#1]#2% {\iffirstargument \def\next{\startsubformulas[#1]}% \else \let\next\startsubformulas \fi \setformulalistentry{#2}% \next} \def\stopnamedsubformulas{\stopsubformulas} \setupsubformulas [\c!conversion=\v!character, \c!separator=\@@fmseparator, \c!indentnext=\@@fmindentnext] \protect %D Possible features %D * One should be able to refer to the subformula number, without the formula %D number, e.g., see equations 3a--c. %D * Allow %D a = b 1 %D c = d 2.a %D e = f 2.b %D g = h 3 %D Algorithm do do this automatically %D flag = previous_subnumbered ; %D \let\afterNR\relax %D previous_subnumbered = false ; %D for (each row) %D if (subnumber_present_row == true) %D if (previous_subnumbered == true) %D \def\afterNR{\decrementnumber[formula]} %D end %D previous_subnumbered = true ; %D else %D previous_subnumbered = false ; %D end % Examples \starttext \placelist[formula] \section{Math Formulas} \startnamedsubformulas[eq:well_known]{Well Known Equalities} \placeformula[eq:first] \startformula 1 + 0 = 1 \stopformula \placeformula[eq:second] \startformula 1 + 1 = 2 \stopformula \stopnamedsubformulas \page Other examples from an email discussion with Mojca. \startbuffer \placeformula \startformula a^2 + b^2 = c^2 \stopformula \stopbuffer \setupsubformulas [conversion=romannumerals] \startsubformulas[Maxwell] \placeformula \startformulas \startformula \startalign \NC \nabla\cdot\bf E \NC = \frac{\rho}{\varepsilon_0} \NR[Maxwell 1] \NC \nabla\times\bf E \NC = - \frac{\partial\bf B}{\partial t} \NR[Maxwell II] \stopalign \stopformula \startformula \startalign \NC \nabla\cdot \bf B \NC = 0 \NR[Maxwell III] \NC \nabla\times\bf B \NC = \mu_0{\bf j}+\varepsilon_0\mu_0\frac{\partial\bf E}{\partial t} \NR[Maxwell IV] \stopalign \stopformula \stopformulas \stopsubformulas Maxwell : \in [Maxwell] II : \in [Maxwell II] \section{conversion} \setupformulas [conversion=character] \setupsubformulas [conversion=n] \getbuffer \startsubformulas[subformula] \dorecurse{2}{\getbuffer} \placeformula[my x formula] \startformula x \stopformula \stopsubformulas \placeformula[my y formula] \startformula y \stopformula reference for subformula: \in [subformula] reference for x: \in [my x formula] reference for y: \in [my y formula] \setupformulas[way=bysection] \section{a} \getbuffer \startsubformulas \dorecurse{2}{\getbuffer} \placeformula[my x2 formula] \startformula x \stopformula \stopsubformulas \placeformula[my y2 formula] \startformula y \stopformula reference for x: \in [my x2 formula] reference for y: \in [my y2 formula] \stoptext