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

Taco Hoekwater taco at elvenkind.com
Wed Jun 28 20:56:57 CEST 2006


Aditya Mahajan wrote:
> 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.

Same for me. I know that theoreticallu something would be possible
using \Var and special typescripts, but I do not know how that is
supposed to be done in actual code.

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

This does not work well, because

	HSO\low{4}\high{-}

is not correct.

> % \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}

(For educational purposes only, it cannot be used by
Mojca this way because of the staggered scripts)

Your macro has already parsed the argument. This way

   \def\molecule#1{{\activatelohi \scantokens{#1}}}

it would work (because \scantokens re-evaluates the argument).

And this way it does not need etex, nor the \gdef:

   \def\molecule%
     {\bgroup
      \catcode`\_=\active \uccode`\~=`\_ \uppercase{\let~\low}%
      \catcode`\^=\active \uccode`\~=`\^ \uppercase{\let~\high}%
      \domolecule }%
   \def\domolecule#1{#1\egroup}
> 
> I have not looked into it, but doesn't one of context's chem module 
> fit this need?

   \usemodule[chemic]
   \let\molecule\chemical

It only gets the size right, not the boldnes. But it can be argued
that that is the correct behaviour anyways.

Cheers, taco


More information about the ntg-context mailing list