ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* The real numbers
@ 2000-10-01 18:31 David Arnold
  2000-10-01 21:33 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: David Arnold @ 2000-10-01 18:31 UTC (permalink / raw)


All,

Here's another font question. If I am typing my paper in Lucida, what
character is usually used to denote the real numbers? the complex numbers?

How can I define a macro, to be used in math mode, to use these characters?

\def\R{definition here}
\def\C{definition here}

Maybe I should get some instruction how to do this in the Context way as
well. Or is using the TeX \def OK?


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

* Re: The real numbers
  2000-10-01 18:31 The real numbers David Arnold
@ 2000-10-01 21:33 ` Hans Hagen
  2000-10-04 20:34   ` Giuseppe Bilotta
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2000-10-01 21:33 UTC (permalink / raw)
  Cc: ntg-context

[-- Attachment #1: Type: text/plain, Size: 4662 bytes --]

At 11:31 AM 10/1/00 -0700, David Arnold wrote:
>All,
>
>Here's another font question. If I am typing my paper in Lucida, what
>character is usually used to denote the real numbers? the complex numbers?
>
>How can I define a macro, to be used in math mode, to use these characters?
>
>\def\R{definition here}
>\def\C{definition here}
>
>Maybe I should get some instruction how to do this in the Context way as
>well. Or is using the TeX \def OK?

\definefontsynonym [BlackBoard] [msbm10] % the font where to ick the glyphs
from

\definesymbol [naturalnumbers]  [\hbox{\getglyph{BlackBoard}{N}}]
\definesymbol [integernumbers]  [\hbox{\getglyph{BlackBoard}{I}}]
\definesymbol [rationalnumbers] [\hbox{\getglyph{BlackBoard}{Z}}]
\definesymbol [realnumbers]     [\hbox{\getglyph{BlackBoard}{R}}]
\definesymbol [complexnumbers]  [\hbox{\getglyph{BlackBoard}{C}}]

$\symbol[naturalnumbers]^{\symbol[naturalnumbers]}$
$\symbol[integernumbers]$
$\symbol[rationalnumbers]$
$\symbol[realnumbers]$
$\symbol[complexnumbers]$

Now, this is far from perfect, and since a few weeks ago i needed those
blackboards myself (it was discussed on this list btw) I cooked up these
macros which are under construction, look horrible, are not meant for the
users who get nightmares from seeing this kind of code etc etc so that that
may stop reading now: 

% output=pdftex

\unprotect

\def\@mch@{@m@ch@} % math char 
\def\@mfm@{@m@fm@} % math family

\expandafter\chardef\csname\@mch@               0\endcsname = 0 
\expandafter\chardef\csname\@mch@               1\endcsname = 1 
\expandafter\chardef\csname\@mch@               2\endcsname = 2 
\expandafter\chardef\csname\@mch@               3\endcsname = 3 
\expandafter\chardef\csname\@mch@               4\endcsname = 4 
\expandafter\chardef\csname\@mch@               5\endcsname = 5 
\expandafter\chardef\csname\@mch@               6\endcsname = 6 
\expandafter\chardef\csname\@mch@               7\endcsname = 7 

\expandafter\chardef\csname\@mch@        ordinary\endcsname = 0
\expandafter\chardef\csname\@mch@           large\endcsname = 1 
\expandafter\chardef\csname\@mch@          binary\endcsname = 2 
\expandafter\chardef\csname\@mch@        relation\endcsname = 3
\expandafter\chardef\csname\@mch@         opening\endcsname = 4 
\expandafter\chardef\csname\@mch@         closing\endcsname = 5 
\expandafter\chardef\csname\@mch@     punctuation\endcsname = 6
\expandafter\chardef\csname\@mch@        variable\endcsname = 7 

\expandafter\chardef\csname\@mch@   largeoperator\endcsname = 1 
\expandafter\chardef\csname\@mch@ binaryoperation\endcsname = 2 
\expandafter\chardef\csname\@mch@   openingsymbol\endcsname = 4 
\expandafter\chardef\csname\@mch@   closingsymbol\endcsname = 5 
\expandafter\chardef\csname\@mch@  variablefamily\endcsname = 7 

\def\definemathfamily#1 % 
  {\expandafter\chardef\csname\@mfm@#1\endcsname=}

\def\definemathcharacter#1 #2 #3 #4 % name class family n  
  {\doifnumberelse{#4}
     {\dodefinemathcharacter{#1}{#2}{#3}{#4}}  
     {\dodefinemathcharacter{#1}{#2}{#3}{`#4}}}

\def\dodefinemathcharacter#1#2#3#4% name class family n  
  {\scratchcounter=\the\csname\@mch@#2\endcsname
   \multiply\scratchcounter by 2048
   \advance\scratchcounter  by \the\csname\@mfm@#3\endcsname
   \multiply\scratchcounter by 256
   \advance\scratchcounter  by #4 
   \expandafter\mathchardef\csname#1\endcsname=\scratchcounter}

\def\mathfamily#1{\expandafter\fam\csname\@mfm@#1\endcsname}

\newtoks\mathdefinitions

\long\def\startmathdefinitions#1\stopmathdefinitions
  {\appendtoks#1\to\mathdefinitions}  

\protect

\startmathdefinitions
  \definemathcharacter naturalnumbers  ordinary blackboard N 
  \definemathcharacter integernumbers  ordinary blackboard I 
  \definemathcharacter rationalnumbers ordinary blackboard Z 
  \definemathcharacter realnumbers     ordinary blackboard R 
  \definemathcharacter complexnumbers  ordinary blackboard C 
\stopmathdefinitions

\startbuffer
$\naturalnumbers  ^ \naturalnumbers  \quad 
 \naturalnumbers  ^ \naturalnumbers  \quad 
 \rationalnumbers ^ \rationalnumbers \quad 
 \realnumbers     ^ \realnumbers     \quad 
 \complexnumbers  ^ \complexnumbers  \quad
 \mathfamily{blackboard}X^X\quad Q^Q $ 
\stopbuffer

\appendtoks \the\mathdefinitions \to \everymath 

\starttext

\setupbodyfont[lbr] \definemathfamily blackboard \mafam  \getbuffer

\setupbodyfont[ams] \definemathfamily blackboard \mbfam  \getbuffer

\setupbodyfont[mt]  \definemathfamily blackboard \mbfam  \getbuffer

\stoptext

As you can see, I need to extend the font files with some defs as well as
define a bunch of math symbols which i first have to discuss with taco of
course,

Hans

[-- Attachment #2: mathtest.pdf --]
[-- Type: application/pdf, Size: 12682 bytes --]

[-- Attachment #3: Type: text/plain, Size: 370 bytes --]

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      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
-------------------------------------------------------------------------

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

* Re: The real numbers
  2000-10-01 21:33 ` Hans Hagen
@ 2000-10-04 20:34   ` Giuseppe Bilotta
  2000-10-05  8:03     ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: Giuseppe Bilotta @ 2000-10-04 20:34 UTC (permalink / raw)


> >All,
> >
> >Here's another font question. If I am typing my paper in Lucida, what
> >character is usually used to denote the real numbers? the complex
numbers?
> >
> >How can I define a macro, to be used in math mode, to use these
characters?
> >
> >\def\R{definition here}
> >\def\C{definition here}
> >
> >Maybe I should get some instruction how to do this in the Context way as
> >well. Or is using the TeX \def OK?
>
> \definefontsynonym [BlackBoard] [msbm10] % the font where to ick the
glyphs
> from
>
> \definesymbol [naturalnumbers]  [\hbox{\getglyph{BlackBoard}{N}}]
> \definesymbol [integernumbers]  [\hbox{\getglyph{BlackBoard}{I}}]
> \definesymbol [rationalnumbers] [\hbox{\getglyph{BlackBoard}{Z}}]

Uh ... I believe it's integer -> Z and rational -> Q

> \definesymbol [realnumbers]     [\hbox{\getglyph{BlackBoard}{R}}]
> \definesymbol [complexnumbers]  [\hbox{\getglyph{BlackBoard}{C}}]

Sice you were at it,

\definesymbol [hypercomplexnumbers] [\hbox{\getglyph{BlackBoard}{H}}]

:-) [hey, it's a _joke_]

In LaTeX I used something like

\newcommand{field}[1]{\ds{#1}} % where \ds stands for DoubleStruck, a synom
of BB
\newcommand{\R}{\field{R}} % and so on. I knwo some of them like \N and \Z
are not fields, but ... that helped in case I wanted to switch to plain bold

[snip]
>
> Now, this is far from perfect, and since a few weeks ago i needed those
> blackboards myself (it was discussed on this list btw) I cooked up these
> macros which are under construction, look horrible, are not meant for the
> users who get nightmares from seeing this kind of code etc etc so that
that
> may stop reading now:
>
[snap! No, I don't get nightmares from that code, but ...]

Why all those chiffchaffing around? That looks much like redefining a lot of
TeX's default behaviour (or at least, providing hooks to rederfine etc).

> As you can see, I need to extend the font files with some defs as well as
> define a bunch of math symbols which i first have to discuss with taco of
> course,
>
> Hans

Giuseppe Bilotta


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

* Re: The real numbers
  2000-10-04 20:34   ` Giuseppe Bilotta
@ 2000-10-05  8:03     ` Hans Hagen
  0 siblings, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2000-10-05  8:03 UTC (permalink / raw)
  Cc: ConTeXt

At 10:34 PM 10/4/00 +0200, Giuseppe Bilotta wrote:

>Uh ... I believe it's integer -> Z and rational -> Q

Ah, then I'm glad it's not official yet. 

>[snap! No, I don't get nightmares from that code, but ...]
>
>Why all those chiffchaffing around? That looks much like redefining a lot of
>TeX's default behaviour (or at least, providing hooks to rederfine etc).

The main reason is that there are smalle details involved. For instance,
math times uses a different font size for math roman than text roman, while
cmr uses the same (normally). Also, some fonts have design sizes, some
haven't. Some symbols should obey math shifting, some text shifting. [i
leave encoding, which differs per font] .Actually, what is tex's default
behavior? TeX does not have a concept of a body font, that's up to the
macro package. TeX in itself has nothing defined at all, that happens in
plain, which ie very cmr dependent. 

Hans

-------------------------------------------------------------------------
                                                  Hans Hagen | PRAGMA ADE
                      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
-------------------------------------------------------------------------


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

end of thread, other threads:[~2000-10-05  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-01 18:31 The real numbers David Arnold
2000-10-01 21:33 ` Hans Hagen
2000-10-04 20:34   ` Giuseppe Bilotta
2000-10-05  8:03     ` Hans Hagen

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