* more nath patches
@ 2004-10-26 13:08 Christopher Creutzig
2004-10-26 14:16 ` Hans Hagen
2004-10-26 14:21 ` Giuseppe Bilotta
0 siblings, 2 replies; 12+ messages in thread
From: Christopher Creutzig @ 2004-10-26 13:08 UTC (permalink / raw)
Salvete,
I finally managed to make t-nath work with \eqalign and \eqalignno. (I
assume I was not the only one having trouble there?) As it appears,
nath gets really confused when subformulas are enclosed in {} and
contain some form of delimiters. Therefore, the original definitions
just don't work, but these modifications do, at least in some sense of
“work”:
\def\eqalignno#1%
{\displ@y
\tabskip\centering
\vcenter{%
\openup\jot\m@th
\halign to \displaywidth
{\hfil{\startnathdmath\@lign ##\stopnathdmath}\tabskip\z@skip
&{\startnathdmath\@lign {}##\stopnathdmath}\hfil\tabskip\centering
&\llap{$\@lign##$}\tabskip\z@skip\crcr
#1\crcr}}}
\def\eqalign#1%
{\null
\,%
\vcenter
{\openup
\jot\m@th
\ialign
{\strut\hfil{\startnathdmath ##\stopnathdmath}&%
{\startnathdmath {}##\stopnathdmath}\hfil\crcr
#1\crcr}}%
\,}
And I've got another snippet I'd like to share, which helps displaying
continued fractions in a linear format, using the “best” way of doing so
I've met so far:
\def\contfrac#1#2{%
% To get the lines at the top right and bottom left
% at the correct lengths, we need to know the final heights
% of both top and bottom. Since styles ``C-up'' and ``C-down''
% are used only in generalized fractions, we need a trial
% typesetting run for this.
\begingroup
\setbox\!!boxa\hbox{\trialtypesettingtrue\o@math\dcurrstyle@
{\setbox\nathbox\currstyle@hbox{%\vrule\!!depth .7\mex\!!width 0pt
\botrestricted@false #1}%
\!!dimena=\ht\nathbox \advance\!!dimena-\ht\sizebox@
\global\htdecrement@=\!!dimena
% \!!dimena=\dp\nathbox \advance\!!dimena .5ex \dp\nathbox=\!!dimena
\global\!!dimend=\dp\nathbox
\box\nathbox
\above\fracrulethickness@
\setbox\nathbox\currstyle@hbox{%\vrule\!!height 2\mex\!!width 0pt
\toprestricted@false #2}%
\!!dimenb=\dp\nathbox \advance\!!dimenb-\dp\sizebox@
\global\dpdecrement@=\!!dimenb
% \!!dimenb=\ht\nathbox \advance\!!dimenb .5ex \ht\nathbox=\!!dimenb
\global\!!dimene=\ht\nathbox
\box\nathbox
}%
\o@math}%
%
%
%% See the TeXbook, page 444 f., for what is happening here.
\ifcase\mathcount@
\!!dimenf=\fontdimen8\textfont2
\!!dimeng=\fontdimen11\textfont2
\!!dimenh=3\fracrulethickness@
\!!dimeni=\fontdimen22\textfont2
\or
\!!dimenf=\fontdimen9\scriptfont2
\!!dimeng=\fontdimen12\scriptfont2
\!!dimenh=\fracrulethickness@
\!!dimeni=\fontdimen22\scriptfont2
\else
\!!dimenf=\fontdimen9\scriptscriptfont2
\!!dimeng=\fontdimen12\scriptscriptfont2
\!!dimenh=\fracrulethickness@
\!!dimeni=\fontdimen22\scriptscriptfont2
\fi
%
\!!dimenj=\dimexpr(\!!dimenf-\!!dimend)-
(\!!dimeni+0.5\fracrulethickness@)\relax
\ifdim\!!dimenj<\!!dimenh
\advance\!!dimenf by \dimexpr(\!!dimenh-\!!dimenj)\relax
\fi
\!!dimenj=\dimexpr(\!!dimeni-0.5\fracrulethickness@)-
(\!!dimene-\!!dimeng)\relax
\ifdim\!!dimenj<\!!dimenh
\advance\!!dimeng by \dimexpr(\!!dimenh-\!!dimenj)\relax
\fi
%
\advance\!!dimenf by\dimexpr(-\!!dimeni)\relax
\advance\!!dimeng by\dimexpr(+\!!dimeni)\relax
%
\setbox\!!boxa\hbox{%
\o@math\dcurrstyle@
{\setbox\nathbox\currstyle@hbox{%\vrule\!!depth .7\mex\!!width 0pt
\botrestricted@false #1}%
\ifdim\ht\nathbox<1.6ex
\ht\nathbox=1.6ex
\fi
\!!dimena=\ht\nathbox \advance\!!dimena-\ht\sizebox@
\global\htdecrement@=\!!dimena
\setbox\!!boxb\hbox{%
\vrule
\!!depth\!!dimenf
\!!height\ht\nathbox
\!!width\fracrulethickness@
}%
\dp\!!boxb=0pt
\hfill\,
\box\nathbox
\,\hfill
\hskip\fracrulethickness@\box\!!boxb
\above\fracrulethickness@
\setbox\nathbox\currstyle@hbox{%\vrule\!!height 2\mex\!!width 0pt
\toprestricted@false #2}%
\ifdim\dp\nathbox<.4ex
\dp\nathbox=.4ex
\fi
\!!dimenb=\dp\nathbox \advance\!!dimenb-\dp\sizebox@
\global\dpdecrement@=\!!dimenb
\setbox\!!boxb\hbox{%
\vrule
\!!depth\dp\nathbox
\!!height\!!dimeng
\!!width\fracrulethickness@
}%
\ht\!!boxb=0pt
\box\!!boxb\hskip\fracrulethickness@
\hfill\,
\box\nathbox
\,\hfill
}%
\o@math}%
\setbox\nathbox\copy\!!boxa
\iftoprestricted@ \else
\!!dimenb=\ht\nathbox \advance\!!dimenb .4\mex \ht\nathbox=\!!dimenb
\fi
\ifbotrestricted@ \else
\!!dimenb=\dp\nathbox \advance\!!dimenb .5\mex \dp\nathbox=\!!dimenb
\fi
\box\nathbox % print
\!!dimena=\ht\!!boxa \advance\!!dimena-\htdecrement@
\ht\!!boxa=\!!dimena
\!!dimena=\dp\!!boxa \advance\!!dimena-\dpdecrement@
\dp\!!boxa=\!!dimena
\global\setbox\sizebox@\copy\!!boxa
\endgroup
\resizebox@{\sizebox@}}
I do assume the whole thing could be done with about half as many
lines of code, but I was glad to finally understand how TeX typesets
fractions and just ignored beautifying the code. Also note that the
snippet uses \fracrulethickness@ from t-nath.tex, while I honestly
consider using \fontdimen8\textfont3 or whichever font size is in use
for the fraction. Well, work in progress.
regards,
Christopher Creutzig
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 13:08 more nath patches Christopher Creutzig
@ 2004-10-26 14:16 ` Hans Hagen
2004-10-26 15:36 ` Christopher Creutzig
2004-10-26 14:21 ` Giuseppe Bilotta
1 sibling, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2004-10-26 14:16 UTC (permalink / raw)
Christopher Creutzig wrote:
> \setbox\nathbox\currstyle@hbox{%\vrule\!!height 2\mex\!!width 0pt
since you are going the fast and efficient way (\using \!!dimena etc),
0pt can become \zeropoint (less space interference as well)
> \!!dimenf=\fontdimen8\textfont2
\!!dimenf\fontdimen8\textfont\syfam
is more independent; maybe i should define symbolic names for the font
dimens as well (no time to make a list now)
> (\!!dimeni+0.5\fracrulethickness@)\relax
is \fracrulethickness@ a nath specific thing?
> \hfill\,
maybe you need a % after this line
> I do assume the whole thing could be done with about half as many lines
> of code, but I was glad to finally understand how TeX typesets fractions
> and just ignored beautifying the code. Also note that the snippet uses
it's not that bad, tricky code seldom looks nice
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 13:08 more nath patches Christopher Creutzig
2004-10-26 14:16 ` Hans Hagen
@ 2004-10-26 14:21 ` Giuseppe Bilotta
1 sibling, 0 replies; 12+ messages in thread
From: Giuseppe Bilotta @ 2004-10-26 14:21 UTC (permalink / raw)
Tuesday, October 26, 2004 Christopher Creutzig wrote:
> Salvete,
[snip]
Christopher,
thank you very much for the patches. I'll give them a better
look as soon as I have some more time.
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 14:16 ` Hans Hagen
@ 2004-10-26 15:36 ` Christopher Creutzig
2004-10-26 15:55 ` Hans Hagen
0 siblings, 1 reply; 12+ messages in thread
From: Christopher Creutzig @ 2004-10-26 15:36 UTC (permalink / raw)
Hans Hagen wrote:
>> \!!dimenf=\fontdimen8\textfont2
>
>
> \!!dimenf\fontdimen8\textfont\syfam
OK, I should look those names up.
> is more independent; maybe i should define symbolic names for the font
Independent of what? \textfont2 is exactly the font TeX would use, no?
>> (\!!dimeni+0.5\fracrulethickness@)\relax
>
>
> is \fracrulethickness@ a nath specific thing?
Yes. As I said, I'm thinking of using the proper fontdimen of the
correct font instead.
>> \hfill\,
>
>
> maybe you need a % after this line
Should have one just for code cleanliness, yes. But it's all in math
mode, so the spce should not do anything.
Christopher
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 15:36 ` Christopher Creutzig
@ 2004-10-26 15:55 ` Hans Hagen
2004-10-26 16:18 ` Maurice Diamantini
0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2004-10-26 15:55 UTC (permalink / raw)
Christopher Creutzig wrote:
> Should have one just for code cleanliness, yes. But it's all in math
> mode, so the spce should not do anything.
ah .. i'm not that math aware -)
if you make that fontdimen list i'll add the names to the kernel
also, i think that we need to sort out nath interference some day soon
is there a test suite? if not, maybe it's worth the effort to cook up a
nice math example document (like the one with tables and chemistry)
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 15:55 ` Hans Hagen
@ 2004-10-26 16:18 ` Maurice Diamantini
2004-10-27 3:50 ` David Arnold
0 siblings, 1 reply; 12+ messages in thread
From: Maurice Diamantini @ 2004-10-26 16:18 UTC (permalink / raw)
Cc: Maurice Diamantini
Le 26 oct. 04, à 17:55, Hans Hagen a écrit :
> Christopher Creutzig wrote:
>
> also, i think that we need to sort out nath interference some day soon
>
> is there a test suite? if not, maybe it's worth the effort to cook up
> a nice math example document (like the one with tables and chemistry)
Or perhaps the nath manual itself?
-- Maurice,
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-26 16:18 ` Maurice Diamantini
@ 2004-10-27 3:50 ` David Arnold
2004-10-27 6:22 ` Maurice Diamantini
0 siblings, 1 reply; 12+ messages in thread
From: David Arnold @ 2004-10-27 3:50 UTC (permalink / raw)
Is there a nath manual?
At 06:18 PM 10/26/04 +0200, you wrote:
>
>Le 26 oct. 04, à 17:55, Hans Hagen a écrit :
>
>> Christopher Creutzig wrote:
>>
>> also, i think that we need to sort out nath interference some day soon
>>
>> is there a test suite? if not, maybe it's worth the effort to cook up
>> a nice math example document (like the one with tables and chemistry)
>
>Or perhaps the nath manual itself?
>
>-- Maurice,
>
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-27 3:50 ` David Arnold
@ 2004-10-27 6:22 ` Maurice Diamantini
2004-10-27 7:13 ` Hans Hagen
0 siblings, 1 reply; 12+ messages in thread
From: Maurice Diamantini @ 2004-10-27 6:22 UTC (permalink / raw)
Cc: Maurice Diamantini
Le 27 oct. 04, à 05:50, David Arnold a écrit :
> Is there a nath manual?
http://www.ctan.org/tex-archive/macros/latex/contrib/nath/
But it is for LaTeX only, and I'm am not sure of what is already
implemented in the m-nath module from Giuseppe Bilotta
...
Hum, I just see that this is already mention on the context portail
http://contextgarden.net/Math_with_nath
(So I just had the url)
-- Maurice
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-27 6:22 ` Maurice Diamantini
@ 2004-10-27 7:13 ` Hans Hagen
2004-10-27 11:11 ` Nikolai Weibull
0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2004-10-27 7:13 UTC (permalink / raw)
Cc: Maurice Diamantini
Maurice Diamantini wrote:
> Hum, I just see that this is already mention on the context portail
> http://contextgarden.net/Math_with_nath
> (So I just had the url)
as far as i know most functionality is available
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: more nath patches
2004-10-27 7:13 ` Hans Hagen
@ 2004-10-27 11:11 ` Nikolai Weibull
2004-10-27 12:15 ` Hans Hagen
0 siblings, 1 reply; 12+ messages in thread
From: Nikolai Weibull @ 2004-10-27 11:11 UTC (permalink / raw)
* Hans Hagen <pragma@wxs.nl> [Oct 27, 2004 12:50]:
> >Hum, I just see that this is already mention on the context portail
> >http://contextgarden.net/Math_with_nath
> >(So I just had the url)
>
> as far as i know most functionality is available
Are there any plans of integrating stuff from m-nath to the math support
in ConTeXt any time soon?
nikolai
--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: more nath patches
2004-10-27 11:11 ` Nikolai Weibull
@ 2004-10-27 12:15 ` Hans Hagen
2004-10-27 14:43 ` Re[2]: " Giuseppe Bilotta
0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2004-10-27 12:15 UTC (permalink / raw)
Nikolai Weibull wrote:
> * Hans Hagen <pragma@wxs.nl> [Oct 27, 2004 12:50]:
>
>>>Hum, I just see that this is already mention on the context portail
>>>http://contextgarden.net/Math_with_nath
>>>(So I just had the url)
>>
>>as far as i know most functionality is available
>
>
> Are there any plans of integrating stuff from m-nath to the math support
> in ConTeXt any time soon?
as soon as mr GB declares the module 'finished' i'll go over it and see
where we can resolve conflicts with the context kernel
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re[2]: Re: more nath patches
2004-10-27 12:15 ` Hans Hagen
@ 2004-10-27 14:43 ` Giuseppe Bilotta
0 siblings, 0 replies; 12+ messages in thread
From: Giuseppe Bilotta @ 2004-10-27 14:43 UTC (permalink / raw)
Wednesday, October 27, 2004 Hans Hagen wrote:
> Nikolai Weibull wrote:
>> * Hans Hagen <pragma@wxs.nl> [Oct 27, 2004 12:50]:
>>
>>>>Hum, I just see that this is already mention on the context portail
>>>>http://contextgarden.net/Math_with_nath
>>>>(So I just had the url)
>>>
>>>as far as i know most functionality is available
>>
>>
>> Are there any plans of integrating stuff from m-nath to the math support
>> in ConTeXt any time soon?
> as soon as mr GB declares the module 'finished' i'll go over it and see
> where we can resolve conflicts with the context kernel
That's gonna take *some* time :)
--
Giuseppe "Oblomov" Bilotta
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2004-10-27 14:43 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-26 13:08 more nath patches Christopher Creutzig
2004-10-26 14:16 ` Hans Hagen
2004-10-26 15:36 ` Christopher Creutzig
2004-10-26 15:55 ` Hans Hagen
2004-10-26 16:18 ` Maurice Diamantini
2004-10-27 3:50 ` David Arnold
2004-10-27 6:22 ` Maurice Diamantini
2004-10-27 7:13 ` Hans Hagen
2004-10-27 11:11 ` Nikolai Weibull
2004-10-27 12:15 ` Hans Hagen
2004-10-27 14:43 ` Re[2]: " Giuseppe Bilotta
2004-10-26 14:21 ` Giuseppe Bilotta
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).