Article View: comp.text.tex
Article #10643Re: NFSS: How change mathcodes?
From: Peter Dalg}rd
Date: Fri, 22 Jan 1993 16:19
Date: Fri, 22 Jan 1993 16:19
55 lines
2501 bytes
2501 bytes
Sorry about following up on my own postings, but noone else did and I
did find at least a partial solution.
In <1993Jan20.161638.7096@uts.uni-c.dk> kubipdal@uts.uni-c.dk (Peter Dalg}rd) writes:
>a) How would one know that \bffam is the family corresponding to
> \mathbf{} (In fact it is, but suppose I wanted do it for
> another alphabet)?
>b) Math alphabets do not seem to be defined unless there is reference
> to them in a formula (??) As it is now, $X_i$ gives me an
> error that textfont 4 is undefined, but $X_i+\mathbf{z}$
> works. How do I enforce definition of the relevant fonts?
Part b) is easily disposed of by creating a dummy formula with a font
selection inside, e.g.
\setbox0\hbox{$\mathbf\relax$}
Part a) is tricky. If the math alphabet has been created with
\new@internalmathalphabet or \newmathalphabet, then the control
sequence expands to something that starts with a call to
\select@group, whose second argument is the math family that I
was after. The first argument is the command sequence itself.
(I.e. \mathbf ->\select@group \mathbf \bffam ....)
So I need to extract the third token of the expansion of the
math alphabet control sequence. I ended up with this (setfam is my
original macro):
\newcount\h@ckedf@mily
\def \getthirdtoken#1#2#3#4***{#3}
\def \@wfulf@milyh@ck#1{
\h@ckedf@mily\expandafter\getthirdtoken#1***
\setbox0\hbox{$#1\relax$}
}
\def \mathletter#1#2{
\@wfulf@milyh@ck{#1}
\setfam{\h@ckedf@mily}{#2}
}
\def \bfmathletter#1{\mathletter{\mathbf}{#1}}
This doesn't work for rm and mi since they are set up differently
in newlfont.sty. However, they are in their usual places, so one can
just:
\def \mimathletter#1{\setfam 1 {#1}}
\def \rmmathletter#1{\setfam 0 {#1}}
Something tells me that this can't be the right way, but it's the best
I can do!
Peter
PS: Please note that I routinely \catcode RET SPC and TAB to 9 (ignored)
in my macros, people who prefer the usual TeX style need to delete a few
spaces and insert some % signs in various places.
Technical Details
Message-ID:
<1993Jan22.161957.7751@uts.uni-c.dk>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!uts!kubipdalReferences:
<1993Jan20.161638.7096@uts.uni-c.dk>Show Full Headers
Complete Article Headers
Newsgroups: comp.text.tex Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!uts!kubipdal From: kubipdal@uts.uni-c.dk (Peter Dalg}rd) Subject: Re: NFSS: How change mathcodes? Organization: UNI-C, Danish Computing Centre for Research and Education Date: Fri, 22 Jan 1993 16:19:57 GMT Message-ID: <1993Jan22.161957.7751@uts.uni-c.dk> References: <1993Jan20.161638.7096@uts.uni-c.dk> Keywords: NFSS, mathcode Lines: 55