ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Font selection ranges
@ 2011-09-29 19:58 Hans Aberg
  2011-09-30  8:31 ` luigi scarso
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hans Aberg @ 2011-09-29 19:58 UTC (permalink / raw)
  To: ntg-context

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.

In LaTeX, one can use \setmathfont[range={"0001-...,}] to set ranges for fonts, but I could not find that for ConTeXt.

Hans


___________________________________________________________________________________
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] 4+ messages in thread

* Re: Font selection ranges
  2011-09-29 19:58 Font selection ranges Hans Aberg
@ 2011-09-30  8:31 ` luigi scarso
  2011-09-30  8:33 ` Wolfgang Schuster
  2011-09-30 14:42 ` Khaled Hosny
  2 siblings, 0 replies; 4+ messages in thread
From: luigi scarso @ 2011-09-30  8:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Sep 29, 2011 at 9:58 PM, Hans Aberg <haberg-1@telia.com> wrote:
> 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.
It's not a solution of your problem, but this work

\setupbodyfont[dejavu]
\definetyping[code]
\setuptyping[code][margin=yes]

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


-- 
luigi
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Font selection ranges
  2011-09-29 19:58 Font selection ranges Hans Aberg
  2011-09-30  8:31 ` luigi scarso
@ 2011-09-30  8:33 ` Wolfgang Schuster
  2011-09-30 14:42 ` Khaled Hosny
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2011-09-30  8:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

___________________________________________________________________________________
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] 4+ messages in thread

* Re: Font selection ranges
  2011-09-29 19:58 Font selection ranges Hans Aberg
  2011-09-30  8:31 ` luigi scarso
  2011-09-30  8:33 ` Wolfgang Schuster
@ 2011-09-30 14:42 ` Khaled Hosny
  2 siblings, 0 replies; 4+ messages in thread
From: Khaled Hosny @ 2011-09-30 14:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, Sep 29, 2011 at 09:58:07PM +0200, Hans Aberg wrote:
> 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.
> 
> In LaTeX, one can use \setmathfont[range={"0001-...,}] to set ranges
> for fonts, but I could not find that for ConTeXt.

You can use the fallback feature, but then you've to define your own
typescripts, see font-col.mkiv for examples.

Regards,
 Khaled

-- 
 Khaled Hosny
 Egyptian
 Arab
___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2011-09-30 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 19:58 Font selection ranges Hans Aberg
2011-09-30  8:31 ` luigi scarso
2011-09-30  8:33 ` Wolfgang Schuster
2011-09-30 14:42 ` Khaled Hosny

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