ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* The \frac macro.
@ 2007-04-22 17:01 John R. Culleton
  2007-04-22 17:21 ` Mojca Miklavec
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John R. Culleton @ 2007-04-22 17:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Knuth defines a macro for simple fractions such as 3/4 etc. and calls 
it \frac:
\def\frac#1/#2{\leavevmode
\kern.1em \raise .5ex \hbox{\the\scriptfont0 #1}%
\kern-.1em $/$%
\kern -.15em \lower .25ex \hbox{\the\scriptfont0 #2}}%

The call is e.g., \frac 3/4.


This works fine in Context. However if I undefine the Knuth macro and 
still use the same \frac call I don't get an error message but the 
results are quite different.  I get both a stroke and a bar between 
the 3 and the 4. 

Is there another macro in Context called \frac and if so how is it 
called?
-- 
John Culleton
Able Indexing and Typesetting
Precision typesetting (tm) at reasonable cost.
Satisfaction guaranteed. 
http://wexfordpress.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The \frac macro.
  2007-04-22 17:01 The \frac macro John R. Culleton
@ 2007-04-22 17:21 ` Mojca Miklavec
  2007-04-22 18:07 ` Aditya Mahajan
  2007-04-23  8:39 ` luigi scarso
  2 siblings, 0 replies; 4+ messages in thread
From: Mojca Miklavec @ 2007-04-22 17:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 4/22/07, John R. Culleton <john@wexfordpress.com> wrote:
> Knuth defines a macro for simple fractions such as 3/4 etc. and calls
> it \frac:
> \def\frac#1/#2{\leavevmode
> \kern.1em \raise .5ex \hbox{\the\scriptfont0 #1}%
> \kern-.1em $/$%
> \kern -.15em \lower .25ex \hbox{\the\scriptfont0 #2}}%
>
> The call is e.g., \frac 3/4.
>
>
> This works fine in Context. However if I undefine the Knuth macro and
> still use the same \frac call I don't get an error message but the
> results are quite different.  I get both a stroke and a bar between
> the 3 and the 4.

Because what you type is then equal to "\frac{3}{/}4", similar to the
standard command in LaTeX. \frac already exists and accepts two
arguments.

Mojca

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The \frac macro.
  2007-04-22 17:01 The \frac macro John R. Culleton
  2007-04-22 17:21 ` Mojca Miklavec
@ 2007-04-22 18:07 ` Aditya Mahajan
  2007-04-23  8:39 ` luigi scarso
  2 siblings, 0 replies; 4+ messages in thread
From: Aditya Mahajan @ 2007-04-22 18:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 22 Apr 2007, John R. Culleton wrote:

> Knuth defines a macro for simple fractions such as 3/4 etc. and calls
> it \frac:
> \def\frac#1/#2{\leavevmode
> \kern.1em \raise .5ex \hbox{\the\scriptfont0 #1}%
> \kern-.1em $/$%
> \kern -.15em \lower .25ex \hbox{\the\scriptfont0 #2}}%
>
> The call is e.g., \frac 3/4.
>
>
> This works fine in Context. However if I undefine the Knuth macro and
> still use the same \frac call I don't get an error message but the
> results are quite different.  I get both a stroke and a bar between
> the 3 and the 4.
>
> Is there another macro in Context called \frac and if so how is it
> called?

\frac {a}{b} is equivalent to plain tex's {a \over b}.

There is also a command similar to what you want to define in ConTeXt. 
It is called vulgar fraction. From core-mis.tex

%D \starttabulate
%D \HL
%D \NC \bf method \NC \bf visualization \NC\NR
%D \HL
%D \NC 0 \NC \chardef\vulgarfractionmethod0\vulgarfraction{1}{2} 
\NC\NR
%D \NC 1 \NC \chardef\vulgarfractionmethod1\vulgarfraction{1}{2} 
\NC\NR
%D \NC 2 \NC \chardef\vulgarfractionmethod2\vulgarfraction{1}{2} 
\NC\NR
%D \NC 3 \NC \chardef\vulgarfractionmethod3\vulgarfraction{1}{2} 
\NC\NR
%D \HL
%D \stoptabulate

However, if you plan to use such fractions in serious work, do read 
the introduction of xfrac 
(ftp://tug.ctan.org/pub/tex-archive/macros/latex/exptl/xfrac/doc/xfrac.pdf)
I think that the vigrule vs solidus argument also applies to ConTeXt's 
definition.

Aditya

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: The \frac macro.
  2007-04-22 17:01 The \frac macro John R. Culleton
  2007-04-22 17:21 ` Mojca Miklavec
  2007-04-22 18:07 ` Aditya Mahajan
@ 2007-04-23  8:39 ` luigi scarso
  2 siblings, 0 replies; 4+ messages in thread
From: luigi scarso @ 2007-04-23  8:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> Is there another macro in Context called \frac and if so how is it
> called?
I use  (e)grep in this situations, it's more texnician.


luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-23  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-22 17:01 The \frac macro John R. Culleton
2007-04-22 17:21 ` Mojca Miklavec
2007-04-22 18:07 ` Aditya Mahajan
2007-04-23  8:39 ` luigi scarso

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).