From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/7656 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: "nicefrac" LaTeX package equivalent? Date: Sun, 14 Apr 2002 22:47:24 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <5.1.0.14.1.20020414223846.02c93e30@server-1> References: <87vgay65ho.fsf@inanna.rimspace.net> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed X-Trace: main.gmane.org 1035398103 20999 80.91.224.250 (23 Oct 2002 18:35:03 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 18:35:03 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: Daniel Pittman In-Reply-To: <87vgay65ho.fsf@inanna.rimspace.net> Xref: main.gmane.org gmane.comp.tex.context:7656 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:7656 At 05:48 PM 4/11/2002 +1000, Daniel Pittman wrote: >I have tried to find some predefined code in ConTeXt to do the >equivalent of the 'nicefrace' package for LaTeX. This, basically, hm, dunno packages that well -) does this mean that one macro has a whole package? >involves typesetting a fraction as: > > 1/ > /2 > >This is scaled down somewhat to make it fairly close to the size of the >surrounding text and positioned such that the spacing between the >numbers and the dividing slash is quite tight. > >I can do this myself using raise, lower and kern operations, but it >would be nicer and (presumably) much more reliable if written by someone >who knew more about TeX character layout than I do. well, let me show you a couple of tricks then, see below: >I only have a need for this in running text, incidentally, and don't >care at all about math mode. This is text mode anyway, so take your choice: \def\textfrac#1#2% {\hbox{\high{\tx#1\kern-.25em}/\low{\kern-.25em\tx#2}}} test \textfrac{1}{2} test \textfrac{123}{456} test \def\textfrac#1#2% {\hbox{\high{\tx#1}\hbox to \zeropoint{\hss/\hss}\low{\tx#2}}} test \textfrac{1}{2} test \textfrac{123}{456} test \def\textfrac#1#2% {\dontleavehmode \hbox {\setbox0\hbox{/}% \setbox2\hbox{\txx57}% \raise\ht0\hbox{\lower\ht2\hbox{\txx#1}}% \hbox to \zeropoint{\hss/\hss}% \lower\dp0\hbox{\raise\dp2\hbox{\txx#2}}}} test \textfrac{1}{2} test \textfrac{123}{456} test Now, if you really want to see something nice, say \showmakeup before the calls to this macro -) What do others think? Which one is the nicest for default (i opt for the (as usual best) third one, so that one goes into core-mis.tex and will end up in the documentation void -) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------