[NTG-context] Automatic character replacements/substitutions

Wolfgang Schuster schuster.wolfgang at gmail.com
Fri May 29 02:55:30 CEST 2015


> Am 28.05.2015 um 21:39 schrieb Mojca Miklavec <mojca.miklavec.lists at gmail.com>:
> 
> Hi,
> 
> Can someone please help me remind how to automatically "replace" a
> Greek letter (gamma (γ) in particular, but I wouldn't mind if the
> whole alphabet would be replaced) with $\mathgreekupright γ$.
> 
> The OpenType font (Lucida) doesn't have Greek characters (except for
> maybe μ), but the math alphabets in the math font are complete, so I
> would like to automatically use the characters from the Greek math in
> main text (possibly upright math in upright text and italic math in
> italic text).
> 
> Of course I can always create a shortcut for $\mathgreekupright γ$ but
> it would be great if things like "γ rays" or "α particles" would be
> typeset "automatically“.


You can use the fallback mechanism for fonts but I don’t there are problems
(e.g. missing kerning) when you use the math font as fallback.

\definefallbackfamily [textmojca] [rm] [Gentium] [scale=1.15,range={greekandcoptic,greekextended}]
\definefontfamily     [textmojca] [rm] [Lucida Bright OT]
\definefontfamily     [textmojca] [mm] [Lucida Bright Math OT]

\definefallbackfamily [mathmojca] [rm] [Lucida Bright Math OT] [range=lowercasegreeknormal]
\definefontfamily     [mathmojca] [rm] [Lucida Bright OT]
\definefontfamily     [mathmojca] [mm] [Lucida Bright Math OT]

\starttext

\switchtobodyfont[textmojca]

\startlines
alpha: α
beta: β
gamma: γ
\stoplines

\switchtobodyfont[mathmojca]

\startlines
alpha: α
beta: β
gamma: γ
\stoplines

\stoptext

Wolfgang


More information about the ntg-context mailing list