ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Automatic character replacements/substitutions
@ 2015-05-28 19:39 Mojca Miklavec
  2015-05-29  0:55 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: Mojca Miklavec @ 2015-05-28 19:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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".

Thank you very much,
    Mojca
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Automatic character replacements/substitutions
  2015-05-28 19:39 Automatic character replacements/substitutions Mojca Miklavec
@ 2015-05-29  0:55 ` Wolfgang Schuster
  2015-05-29 12:08   ` Mojca Miklavec
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2015-05-29  0:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 28.05.2015 um 21:39 schrieb Mojca Miklavec <mojca.miklavec.lists@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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Automatic character replacements/substitutions
  2015-05-29  0:55 ` Wolfgang Schuster
@ 2015-05-29 12:08   ` Mojca Miklavec
  0 siblings, 0 replies; 3+ messages in thread
From: Mojca Miklavec @ 2015-05-29 12:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, May 29, 2015 at 2:55 AM, Wolfgang Schuster wrote:
>> Am 28.05.2015 um 21:39 schrieb Mojca Miklavec:
>>
>> 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

Perfect, thank you. Kerning is not a problem as the glyphs won't be
used for typesetting Greek.

Is there also some way to handle italic with "mathmojca"? (Taking the
glyphs from gentium works, but taking them from the math font only
works with bold, it doesn't work with italic.)

\startlines
alpha: α
beta: β
gamma: γ
\it
alpha: α ($α$)
beta: β ($β$)
gamma: γ ($γ$)
\bf
alpha: α
beta: β
gamma: γ
\stoplines

Mojca
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-29 12:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-28 19:39 Automatic character replacements/substitutions Mojca Miklavec
2015-05-29  0:55 ` Wolfgang Schuster
2015-05-29 12:08   ` Mojca Miklavec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).