[NTG-context] small caps italic and font switching inside math

Aditya Mahajan adityam at umich.edu
Wed Jun 28 20:33:34 CEST 2006


On Wed, 28 Jun 2006, Mojca Miklavec wrote:

> Hello,
>
> I have to tiny questions:
>
> 1. How do I get small caps [bold] italic (except with the
> \definedfont[ec-lmxxx])?

No idea.

> 2. I defined \molecule to be
>    \def\molecule#1{$\rm#1$},

better use {\mathematics{\rm #1}} so that you can also write in 
equations.

> an usage example would be:
>    \molecule{HSO_4^{-}}
> But how should I modify this it so that it would also work properly
> with examples such as:
>
> {\bfa A story about \molecule{SF_6}}
> {\scx A story about \molecule{SF_6}}
> {\bsb A story about \molecule{SF_6}}
>
> As a workaround I now keep hardcoding \molecule{\bsb SF_6}.

Some catcode trickery might work. This is all I could manage.

% \def\molecule#1{\mathematics{ {\rm #1}}}

\bgroup
\catcode`\_=\active
\catcode`\^=\active
\gdef\activatelohi%
   {\catcode`\_=\active
    \def_{\low}
    \catcode`\^=\active
    \def^{\high}}

% This does not work. Why?
% \gdef\molecule#1{\activatelohi #1}

\glet\molecule=\activatelohi
\egroup



\starttext

  {\bfa A story about {\molecule SF_6}}
  {\scx A story about {\molecule SF_6}}
  {\bsb A story about {\molecule SF_6}}

\stoptext

Though this uses a different syntax than what you had.

I have not looked into it, but doesn't one of context's chem module 
fit this need?

Aditya


More information about the ntg-context mailing list