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 | [EMAIL PROTECTED]
                       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
-------------------------------------------------------------------------

Reply via email to