Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-22 Thread Hans Hagen

Michail Vidiassov wrote:


What about an analog of ucs LaTeX package,
when Unicode math subscripts (and other symbols) in TeX file are replaced
by \sub{3} etc., regardless of the font used for typesetting?


the reverse mapping is doable and on the agenda (normally i do such 
things when i run into it in a project)



It will give WYSIWYG-like appearance of the input file on the screen
in the editor using Unicode font and will not bring the mess deep into 
ConTeXt?


well, editors is another case as not all fonts used in editors have such 
characters so your file becomes quite unportable unless the editor 
implements some fallback mechanism


there's also a subscript font feature but often such features are 
implemented incomplete in fonts (like frac) and quite unuseable unless 
more logic in the engine is added (again, something that i will look 
into when i have a reason)



Is such thing doable?
(Not making a set of mappings for presonal use, but proper package
for public consumption?)


it would be core functionality as it involved manupulating the internal 
math node lists


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-22 Thread Hans Hagen

Aditya Mahajan wrote:


Microsoft implmented something like this in newer versions of Word. See the
developer's blog for more detials.
http://blogs.msdn.com/murrays/archive/2009/05/07/entering-math-via-the-linear-format.aspx 


Well, we can consider supporting linear math ..

\unexpanded\def\startmathzone
  {\ifvmode
 \Ustartdisplaymath
 \let\stopmathzone\Ustopdisplaymath
   \else
 \Ustartmath
 \let\stopmathzone\Ustopmath
   \fi}

\defineactivecharacter 23A8 \startmathzone
\defineactivecharacter 23AC \stopmathzone

\catcode3016=\begingroupcatcode
\catcode3017=\endgroupcatcode


\utfchar{23A8}x^\utfchar{3016}1+2\utfchar{3017}\utfchar{23AC}


The question is if we do it this way using a special math catcode 
regime, but that does not work when we pass it as argument unless we 
mess around with some math codes - like prime does) or use a parser 
(which is not that hard to do and is needed for things like sin/cos anyway)


i'll have a look at it (given that it's a frozen 'standard')

Hans



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


[NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Peter Münster
Hello,

Is support for unicode range 0x2080-0x2089 planned?

Superscript works well, but not the subscript:

\starttext
x³ x₃
\stoptext


I need it for something like this:

\usemodule[vim]
\definevimtyping[C][syntax=c]
\starttext
\startC
for(expr₁; expr₂; expr₃)
instruction
\stopC
\stoptext


Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Khaled Hosny
On Tue, Jul 21, 2009 at 11:54:02AM +0200, Peter Münster wrote:
 Hello,
 
 Is support for unicode range 0x2080-0x2089 planned?
 
 Superscript works well, but not the subscript:
 
 \starttext
 x³ x₃
 \stoptext

Unicode sub/superscripts aren't real sub/superscripts, and there use is
discouraged. Most fonts will align those subscript glyphs to the base
line not bellow it, and apparently LM fonts don't have them.

I think there is a way to use ConTeXt commands inside verbatim
environments, but I don't recall it.

Regards,
 Khaled


-- 
 Khaled Hosny
 Arabic localiser and member of Arabeyes.org team
 Free font developer


signature.asc
Description: Digital signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Matthijs Kooijman
Hi Peter  Khaled,

 I think there is a way to use ConTeXt commands inside verbatim
 environments, but I don't recall it.
I think this is the option=commands option for setuptyping  friends. AFAIK
this means you need to use /TEX /ETEX around your commands or something, but
I'm not completely sure. It seems this only works in MkII, it wasn't
implemented in MkIV a month ago at least.

Gr.

Matthijs


signature.asc
Description: Digital signature
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Mojca Miklavec
On Tue, Jul 21, 2009 at 12:27, Khaled Hosnykhaledho...@eglug.org wrote:
 On Tue, Jul 21, 2009 at 11:54:02AM +0200, Peter Münster wrote:
 Hello,

 Is support for unicode range 0x2080-0x2089 planned?

 Superscript works well, but not the subscript:

 \starttext
 x³ x₃
 \stoptext

 Unicode sub/superscripts aren't real sub/superscripts, and there use is
 discouraged. Most fonts will align those subscript glyphs to the base
 line not bellow it, and apparently LM fonts don't have them.

In MKIV one could theoretically fix the (virtual) font with subscript
three containing \sub{3} *** or lowered superscript 3 :)

*** The problem is that you would probably loose monospace by doing
that, but maybe you are not using monospace at all.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Peter Münster
On Tue, 21 Jul 2009, Khaled Hosny wrote:

 Unicode sub/superscripts aren't real sub/superscripts, and there use is
 discouraged. Most fonts will align those subscript glyphs to the base
 line not bellow it, and apparently LM fonts don't have them.

Hello,

In char-def.lua there is:

 [0x2074]={
  category=no,
  cjkwd=a,
  description=SUPERSCRIPT FOUR,
  direction=en,
  linebreak=ai,
  specials={ super, 0x0034 },
  unicodeslot=0x2074,
 },
[...]
 [0x2084]={
  category=no,
  cjkwd=a,
  description=SUBSCRIPT FOUR,
  direction=en,
  linebreak=ai,
  specials={ sub, 0x0034 },
  unicodeslot=0x2084,
 },

So I supposed, that the specials are for faking or simulating the unicode
character, for example ² - \superscript{2} or similar.
Perhaps, my assumption is just wrong...


 I think there is a way to use ConTeXt commands inside verbatim
 environments, but I don't recall it.

Yes, BTEX...ETEX, but not with the t-vim module.

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Peter Münster
On Tue, 21 Jul 2009, Peter Münster wrote:

 I need it for something like this:
 
 \usemodule[vim]
 \definevimtyping[C][syntax=c]
 \starttext
 \startC
 for(expr₁; expr₂; expr₃)
   instruction
 \stopC
 \stoptext

Finally I've found a simple solution:

\usemodule[vim]
\definevimtyping[C][syntax=c]
\defineactivecharacter ₁ {\low{\tx1}}
\defineactivecharacter ₂ {\low{\tx2}}
\defineactivecharacter ₃ {\low{\tx3}}
\starttext
\startC
for(expr₁; expr₂; expr₃)
instruction
\stopC
\stoptext

Cheers, Peter

-- 
Contact information: http://pmrb.free.fr/contact/


___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Aditya Mahajan

On Tue, 21 Jul 2009, Peter Münster wrote:


On Tue, 21 Jul 2009, Khaled Hosny wrote:


Unicode sub/superscripts aren't real sub/superscripts, and there use is
discouraged. Most fonts will align those subscript glyphs to the base
line not bellow it, and apparently LM fonts don't have them.


Hello,

In char-def.lua there is:

[0x2074]={
 category=no,
 cjkwd=a,
 description=SUPERSCRIPT FOUR,
 direction=en,
 linebreak=ai,
 specials={ super, 0x0034 },
 unicodeslot=0x2074,
},
[...]
[0x2084]={
 category=no,
 cjkwd=a,
 description=SUBSCRIPT FOUR,
 direction=en,
 linebreak=ai,
 specials={ sub, 0x0034 },
 unicodeslot=0x2084,
},

So I supposed, that the specials are for faking or simulating the unicode
character, for example ² - \superscript{2} or similar.
Perhaps, my assumption is just wrong...


I am not sure whethere specials work at all. I am assuming that 
SUPERSCIRPT ONE, TWO, and THREE work because the LM font contain them at 
the right spot. These are less than hex FF. The others, for example, 
SUPERSCIRPT ZERO and SUPERSCRIPT FOUR do not work because they are not 
(AFAIU) mapped to any place in LM fonts. I don't even know if LM fonts 
have these or not. The same is true for SUBSCRIPT.


If you use a opentype font like cambria, superscripts and subscripts work. 
I guess that is because they have these symbols. If you swich to \tt with 
cambria, only sup 1,2,3 work.


So, the easiest solution will be to use a (maybe) virtual font that has 
these glyphs. Otherwise, using the active character trick is the easiest 
option.


Aditya___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Hans Hagen

Matthijs Kooijman wrote:

Hi Peter  Khaled,


I think there is a way to use ConTeXt commands inside verbatim
environments, but I don't recall it.

I think this is the option=commands option for setuptyping  friends. AFAIK
this means you need to use /TEX /ETEX around your commands or something, but
I'm not completely sure. It seems this only works in MkII, it wasn't
implemented in MkIV a month ago at least.


indeed, if it is introduced again it will be done differently ...

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Hans Hagen

Mojca Miklavec wrote:

On Tue, Jul 21, 2009 at 12:27, Khaled Hosnykhaledho...@eglug.org wrote:

On Tue, Jul 21, 2009 at 11:54:02AM +0200, Peter Münster wrote:

Hello,

Is support for unicode range 0x2080-0x2089 planned?

Superscript works well, but not the subscript:

\starttext
x³ x₃
\stoptext

Unicode sub/superscripts aren't real sub/superscripts, and there use is
discouraged. Most fonts will align those subscript glyphs to the base
line not bellow it, and apparently LM fonts don't have them.


In MKIV one could theoretically fix the (virtual) font with subscript
three containing \sub{3} *** or lowered superscript 3 :)

*** The problem is that you would probably loose monospace by doing
that, but maybe you are not using monospace at all.


it's also font dependent and we would en dup with fallback mess etc etc

if the font has the glyph, you can use the unicode char, bu tit is 
unlikely that there will be a mapping mechanism



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
 tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
 | www.pragma-pod.nl
-
___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Michail Vidiassov

Dear Hans and All,

On Tue, 21 Jul 2009, Hans Hagen wrote:


Superscript works well, but not the subscript:

\starttext
x³ x₃
\stoptext

Unicode sub/superscripts aren't real sub/superscripts, and there use is
discouraged. Most fonts will align those subscript glyphs to the base
line not bellow it, and apparently LM fonts don't have them.


In MKIV one could theoretically fix the (virtual) font with subscript
three containing \sub{3} *** or lowered superscript 3 :)


it's also font dependent and we would en dup with fallback mess etc etc

if the font has the glyph, you can use the unicode char, bu tit is 
unlikely that there will be a mapping mechanism


What about an analog of ucs LaTeX package,
when Unicode math subscripts (and other symbols) in TeX file are replaced
by \sub{3} etc., regardless of the font used for typesetting?

It will give WYSIWYG-like appearance of the input file on the screen
in the editor using Unicode font and will not bring the mess deep into 
ConTeXt?


Is such thing doable?
(Not making a set of mappings for presonal use, but proper package
for public consumption?)

   Sincerely, Michail___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___


Re: [NTG-context] support for SUBSCRIPT THREE etc. ?

2009-07-21 Thread Aditya Mahajan

On Wed, 22 Jul 2009, Michail Vidiassov wrote:


Dear Hans and All,

On Tue, 21 Jul 2009, Hans Hagen wrote:


Superscript works well, but not the subscript:

\starttext
x³ x₃
\stoptext

Unicode sub/superscripts aren't real sub/superscripts, and there use is
discouraged. Most fonts will align those subscript glyphs to the base
line not bellow it, and apparently LM fonts don't have them.


In MKIV one could theoretically fix the (virtual) font with subscript
three containing \sub{3} *** or lowered superscript 3 :)


it's also font dependent and we would en dup with fallback mess etc etc

if the font has the glyph, you can use the unicode char, bu tit is unlikely 
that there will be a mapping mechanism


What about an analog of ucs LaTeX package,
when Unicode math subscripts (and other symbols) in TeX file are replaced
by \sub{3} etc., regardless of the font used for typesetting?


Most of the support is already there (except superscripts and subscripts). 
MKII implemented this support using active characters (similar to what ucs 
does). MKIV does this using virtual fonts.



It will give WYSIWYG-like appearance of the input file on the screen
in the editor using Unicode font and will not bring the mess deep into 
ConTeXt?


Is such thing doable?
(Not making a set of mappings for presonal use, but proper package
for public consumption?)


For most glyphs the support is already there. Making sure that multiple glyphs
are combined correctly is tricier. We can have an input like $ŵ¹$ and it is not
always easy to determine if it should be translated to ${\hat w}^1$ or $\hat
{w^1}$.

Microsoft implmented something like this in newer versions of Word. See the
developer's blog for more detials.
http://blogs.msdn.com/murrays/archive/2009/05/07/entering-math-via-the-linear-format.aspx

Aditya

___
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  : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___