[NTG-context] Font selection ranges

Wolfgang Schuster schuster.wolfgang at googlemail.com
Fri Sep 30 10:33:32 CEST 2011


Am 29.09.2011 um 21:58 schrieb Hans Aberg:

> I want to define an environment for computer code including non-ASCII characters, using Xits or STIXGeneral except in the ASCII range, where some monospace font like Courier should be used.
> 
> If I do:
> \setupbodyfont[xits,10pt]
> \definetyping[code]
> \setuptyping[code][margin=yes]
> 
> \starttext
>  \startcode
> for ∀i, j ∈ I
>   do a(i, j) ≔ b(i, j)
>  \stopcode
> \stoptext
> 
> Then the math characters won't show. They will show using
>  \setuptyping[code][style=normal,margin=yes]
> but then the ASCII range isn't monospace.


You can use the lines environment when you don’t need syntax highlighting: 

\setupbodyfont[xits,10pt]

\definelines
  [code]
  [space=yes,
   style=mono,
   before=\startnarrower,
   after=\stopnarrower]

\starttext \showframe

\startcode
for $∀$i, j $∈$ I
  do a(i, j) $≔$ b(i, j)
\stopcode

\stoptext

Wolfgang



More information about the ntg-context mailing list