ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: The real numbers
Date: Sun, 01 Oct 2000 23:33:36 +0200	[thread overview]
Message-ID: <3.0.6.32.20001001233336.01d61de0@pop.wxs.nl> (raw)
In-Reply-To: <3.0.5.32.20001001113159.007f7de0@mail.northcoast.com>

[-- 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
-------------------------------------------------------------------------

  reply	other threads:[~2000-10-01 21:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-01 18:31 David Arnold
2000-10-01 21:33 ` Hans Hagen [this message]
2000-10-04 20:34   ` Giuseppe Bilotta
2000-10-05  8:03     ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3.0.6.32.20001001233336.01d61de0@pop.wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).