Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 11:40, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/20/2015 6:09 PM, Hans Aberg wrote:
 
 On 20 Jul 2015, at 17:50, Manuel Blanco manue...@ucm.es wrote:
 
 A little bit more of intelligence can be given with
 
\begingroup\lccode`\~=`\:\lowercase{\endgroup
  \unexpanded\def~}{\futurelet\tmptoken\docolon}

 \unexpanded\def\docolon{\ifx=\tmptoken\mathrel{\mathop{\mathchar`\:}}\else\colon\fi}
\mathcode`\:=8000 %
 
 That lets you do $f: A \to B$ and $f(x) := x^2$
 
 For the second, one can use ≔ COLON EQUALS U+2254. But it is a good point, 
 though.
 
 there is actually a more modern trick:
 
 \starttext
 
 \startluacode
 characters.mathpairs[0x3A] = { [0x3D] = 0x2254 }
 characters.mathpairs[0x3E] = { [0x3D] = 0x2265 }
 characters.mathpairs[0x3C] = { [0x3D] = 0x2264 }
 characters.mathpairs[0x3D] = { [0x3A] = 0x2255 }
 \stopluacode
 
 \startTEXpage
 $a := b = = c =: d = e$
 \stopTEXpage
 
 \stoptext

I have experimented with a theorem proof assistant that admitted parallel ASCII 
and Unicode symbol names, but it turns out to be complicated. Think of C/C++ 
trigraphs, a chore to implement, only to be removed in the latest standards.

So I think one should only focus on UTF-8, and add TeX ASCII “\” commands as a 
complement.

One problem with this approach is the lack of Unicode input methods. But that 
may coming.

For example, instead having “:=“ in the input file and let Lua translate it, 
one can merely type it and let the text editor translate it ≔ COLON EQUALS 
U+2254.

It will save a lot of programming time, at least on the ConTEXt project. :-)


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 11:43, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/20/2015 6:22 PM, Hans Aberg wrote:
 
 On 20 Jul 2015, at 17:43, Manuel Blanco manue...@ucm.es wrote:
 
 Well, you can make the colon active in math mode and then let it output 
 \colon.
 
 This is a TeX way, I don't know if there's a ConTeXt way for this:
 
\begingroup\lccode`\~=`\:\lowercase{\endgroup
  \let~}\colon
\mathcode`\:=8000 %
 
 For some reason, the colon in ConTeXt is larger relative LuaTeX.
 
 you probably mean latex (macro package) here as luatex (engine) itself 
 doesn't do anything
 
 keep in mind that context implements much of math in a complete different 
 way, so solutions for problems or wishes are done differently too; in this 
 case we try to use unicode and some lua magic instead of character juggling 
 at the tex end
 
 we also need to keep in mind that characters have to behave well in tagged 
 pdf and exports and so


In the examples I mentioned (below), running ‘context’ on the first produces 
large colons, whereas ‘luatex’ on the second does not. The latter looks right 
to me.

There is a similar issue with integral symbols, where somehow ConTeXt add 
additional spacing after it.
  http://www.ntg.nl/pipermail/ntg-context/2015/082541.html


— context —
\setupbodyfont[xits,10pt]

\setupformulas[location=left]

\begingroup\lccode`\~=`\:\lowercase{\endgroup
 \let~}\colon
   \mathcode`\:=8000 %

\starttext

The function $f: A → B$, $g\colon A → B$.

\stoptext
—

— luatex —
\begingroup\lccode`\~=`\:\lowercase{\endgroup
 \let~}\colon
   \mathcode`\:=8000 %

The function $f: A \to B$.

\end
—


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 15:34, Hans Hagen pra...@wxs.nl wrote:

 I have experimented with a theorem proof assistant that admitted parallel 
 ASCII and Unicode symbol names, but it turns out to be complicated. Think of 
 C/C++ trigraphs, a chore to implement, only to be removed in the latest 
 standards.
 
 So I think one should only focus on UTF-8, and add TeX ASCII “\” commands as 
 a complement.
 
 One problem with this approach is the lack of Unicode input methods. But 
 that may coming.
 
 For example, instead having “:=“ in the input file and let Lua translate it, 
 one can merely type it and let the text editor translate it ≔ COLON EQUALS 
 U+2254.
 
 that is ok for some input sequences (this kind of input translation happens 
 for accented characters and some math like negated symbols) but replacing = 
 in the input is bad as it is only meaningful in math and not all input is 
 math (and unicode lacks script/language tagging); keep in mind that 
 'verbatim' in tex really means verbatim and input translation contradicts that

I have only the part that is used to produce math character output here, and it 
would be better to have it in the key map. But somehow, it would be possible to 
produce those Unicode characters. Right, there is a lot copy and paste, but it 
is slow.

 It will save a lot of programming time, at least on the ConTEXt project. :-)
 
 not really as that code is already in place for years; in this case it mainly 
 boils down to adding some extra entries in the character database
 
 (and this code is simple compared to other code so not much to save here)

You can add it if you think it is no problem. Proper Unicode characters in the 
input help the readability, so putting them at high priority seems good.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 16:26, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 4:08 PM, Hans Aberg wrote:
 
 I was thinking of just having the two, \colon and \ratio. Looking into some 
 books before electronic typesetting, the spacing of the latter can vary 
 widely: some do not use spaces at all. So a set might look
   {x:x  a}
 instead of
   {x : x  a}
 But that would be a typographical issue, rather than semantic.
 
 but we do need to deal with the typographic issue

Yes, that is what I meant, typographic adjustments on top.

 and unicode is not covering every symantic (otherwise we would have more)

It covers all standard symbols at the end of 1990s. Since then a number of 
symbols have come into use. There was a discussion about that on the Unicode 
list. Those using them might add them as well. But new characters are created, 
so there is a need for accessing them as well.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 16:28, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 4:13 PM, Hans Aberg wrote:
 
 You can add it if you think it is no problem. Proper Unicode characters in 
 the input help the readability, so putting them at high priority seems good.
 
 fyi, on the agenda for the gyre font project is to have a monospaced font 
 that has most of unicode math so that we can have decent editing (once we 
 have the funding covered)

The Unicode monospace characters were added by mistake, because in computer 
science, style does not affect semantics, as it does math. Looking into old 
computer science books, they do not have monospace, and a I recall a Pascal 
compiler on Mac OS 9 that used styled, non-monospace fonts. So a monospace font 
may not be strictly necessary, though current UTF-8 plain text does not look 
good. In Xcode, part of the reason is that one cannot choose font per Unicode 
code point segments.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 15:48, Hans Hagen pra...@wxs.nl wrote:

 In the examples I mentioned (below), running ‘context’ on the first produces 
 large colons, whereas ‘luatex’ on the second does not. The latter looks 
 right to me.
 
 define 'luatex' ... it's all about choices that macro packages make (or made 
 in the past)

I use Tex Live 2015 that came last month.

$ luatex --version
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238)

 
 There is a similar issue with integral symbols, where somehow ConTeXt add 
 additional spacing after it.
   http://www.ntg.nl/pipermail/ntg-context/2015/082541.html
 
 
 — context —
 \setupbodyfont[xits,10pt]
 
 \setupformulas[location=left]
 
 \begingroup\lccode`\~=`\:\lowercase{\endgroup
  \let~}\colon
\mathcode`\:=8000 %
 
 \starttext
 
 The function $f: A → B$, $g\colon A → B$.
 
 we could add a mathsymbol entry but I leave that to Aditya to decide
 
 {
  adobename=colon,
  category=po,
  cjkwd=na,
  description=COLON,
  direction=cs,
  linebreak=is,
  mathclass=relation,
 --mathsymbol=0x2236,
  unicodeslot=0x3A,
 },


Should it be 'mathclass=“relation”’? Mathematically, relations have extra space 
at both sides, whereas in the function $f: A → B$, there should not be much 
space before the “:”.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 21:58, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 6:57 PM, Hans Aberg wrote:

 The Unicode monospace characters were added by mistake, because in 
 computer science, style does not affect semantics, as it does math. 
 Looking into old computer science books, they do not have monospace, and a 
 I recall a Pascal compiler on Mac OS 9 that used styled, non-monospace 
 fonts. So a monospace font may not be strictly necessary, though current 
 UTF-8 plain text does not look good. In Xcode, part of the reason is that 
 one cannot choose font per Unicode code point segments.
 
 we're not talking of the monospace math alphabet (those are already covered 
 but the fonts) but about a monospaced font for editing and verbatim (handy 
 for manuals explaining math typesetting)
 
 Right. But it was added because it is popular in computer science to use a 
 monospace font, though not strictly necessary from the semantic point of 
 view.
 
 one extra alphabet is not putting that much of a burden on tex;

It is more a curiosity, the reason they were added. It might be useful some 
day, say using bold monospace for keywords in programming languages.

It reminds me, in math one can use the idea that upright for constants, italic 
for variables. But I think in LaTeX packages mathtools and/or unicode-math, it 
is difficult to do that in UTF-8, because the somehow translates them to italic.

And the Unicode sans-serif mathematical styles aren’t really semantic either 
from the mathematical point of view, but there is a technical standard to set 
tensors in sans-serif, and perhaps were added because of that. Physics books 
seem to be bit chaotic here. In pure math, it is all serif.

 let's hope math coders don't start using the many emoticons and alike that 
 unicode provides

From the Unicode list discussion, I think there was a fairly large number of 
additional symbols the poster wanted to be added. But it took a long time, via 
STIX, the get the current ones usable.

But as you note, any character could be in principle be used. That is how many 
started off.

 So it makes me think that, instead of a monospace font for all the math 
 characters, one  might switch to a variable-width font in the input code, as 
 actuallye been the case in the past.
 
 which is actually rather inconvenient for entering tables (and i'd also never 
 use it for programming)

Indeed, but that is the only use. The obsession in computer code to align 
vertically.

 All that monospace tabbing will break, that is for sure.
 
 right and proportial makes debugging hard (and how about blockwise copying)

So possibly, there should be some replacement when using a variable width font.

For the ASCII tabbing, the tab character was originally typically interpreted 
as being 8 spaces wide, but that is too much for computer code with higher 
indentation levels. So people switched using spaces instead, successively 
shrinking down to 2 spaces instead of tab, which is what I use.

Unicode has a number of tab characters, but haven’t seen them in use.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 18:34, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 6:18 PM, Hans Aberg wrote:
 
 On 24 Jul 2015, at 16:28, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 4:13 PM, Hans Aberg wrote:
 
 You can add it if you think it is no problem. Proper Unicode characters in 
 the input help the readability, so putting them at high priority seems 
 good.
 
 fyi, on the agenda for the gyre font project is to have a monospaced font 
 that has most of unicode math so that we can have decent editing (once we 
 have the funding covered)
 
 The Unicode monospace characters were added by mistake, because in computer 
 science, style does not affect semantics, as it does math. Looking into old 
 computer science books, they do not have monospace, and a I recall a Pascal 
 compiler on Mac OS 9 that used styled, non-monospace fonts. So a monospace 
 font may not be strictly necessary, though current UTF-8 plain text does not 
 look good. In Xcode, part of the reason is that one cannot choose font per 
 Unicode code point segments.
 
 we're not talking of the monospace math alphabet (those are already covered 
 but the fonts) but about a monospaced font for editing and verbatim (handy 
 for manuals explaining math typesetting)

Right. But it was added because it is popular in computer science to use a 
monospace font, though not strictly necessary from the semantic point of view.

So it makes me think that, instead of a monospace font for all the math 
characters, one  might switch to a variable-width font in the input code, as 
actuallye been the case in the past.

All that monospace tabbing will break, that is for sure.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 16:29, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 4:19 PM, Hans Aberg wrote:
 
 The function $f: A → B$, $g\colon A → B$.
 
 we could add a mathsymbol entry but I leave that to Aditya to decide
 
 {
  adobename=colon,
  category=po,
  cjkwd=na,
  description=COLON,
  direction=cs,
  linebreak=is,
  mathclass=relation,
 --mathsymbol=0x2236,
  unicodeslot=0x3A,
 },
 
 
 Should it be 'mathclass=“relation”’? Mathematically, relations have extra 
 space at both sides, whereas in the function $f: A → B$, there should not be 
 much space before the “:”.
 
 that's where the domain would kick in .. it can control that kind of spacing 
 issues

OK. The word “relation” makes me think of math relations. :-)


___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg

 On 24 Jul 2015, at 15:29, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/24/2015 2:32 PM, Hans Aberg wrote:
 [Note: I use the cc to know that I have received a reply.]
 
 On 24 Jul 2015, at 10:30, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/20/2015 6:06 PM, Hans Aberg wrote:
 
 On 20 Jul 2015, at 16:40, Aditya Mahajan adit...@umich.edu wrote:
 
 On Mon, 20 Jul 2015, Hans Aberg wrote:
 
 The LaTeX package unicode-math has an option colon=literal, which makes 
 it behave as in math functions (as in example below). Has ConTeXt a 
 similar option?
 
 No. You have to use \colon.
 
 It would be nice with such an option, as it helps the readability of the 
 input files.
 
 already for some years i'm thinking of something similar to openmath 
 dictionaries i.e. in many cases when one writes math it is in some field 
 that is consistent within a document, say logic or engineering
 
 it is rather trivial to support something
 
 \setupmathematics[domain=logic]
 
 or so, where we automatically relate the math class with the symbols used, 
 something that becomes more important once we start coding in unicode 
 instead of using names
 
 but ... in order to provide this, i need information about useful categories
 
 Unicode provides one such category. The reason is all math characters are 
 added and in that process analyzed. I worked with Taco on that in the late 
 1990s.
 
 So one main option, which might be the simplest, to assume that the input is 
 UTF-8. Oen can the added ASCII command names, based on the Unicode names. In 
 addition some options for special needs and legacy.
 
 i don't understand what you mean as the issue is not unicode or ascii but 
 categorizing symbols in classes

Right, but that has in part already been done by Unicode. It is not really 
possible to classify math symbols from the the mathematical point of view, as 
every author in principle use their own notation.

 when we have a symbol in the input (can be a : but also something else) in 
 some cases it is a binary but in other cases a relation or whatever

Right. When TeX was written, there was only ASCII, so Knuth set “:” to the 
ratio binary operator, and the function “:” to \colon.

Now, when Unicode is available, it sets the ratio binary operator to  ≔ COLON 
EQUALS U+2254, leaving : COLON U+003A open for other uses. So set the latter to 
\colon, and add a command \ratio for the former.

 this influences the spacing and the 'domain' (or dictionaries) group symbols 
 so that we can assign the right properties
 
 entering a utf sequence representing 0x2236 still doesn't always prescribe 
 what mathclass it is, 0x22A5 0x22C5 0x25B3 are examples of such dual face 
 characters
 
 (this is actually more important in for instance xml input)

I was thinking of just having the two, \colon and \ratio. Looking into some 
books before electronic typesetting, the spacing of the latter can vary widely: 
some do not use spaces at all. So a set might look
  {x:x  a}
instead of
  {x : x  a}
But that would be a typographical issue, rather than semantic.

___
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
___

Re: [NTG-context] Math literal colon

2015-07-24 Thread Hans Aberg
[Note: I use the cc to know that I have received a reply.]

 On 24 Jul 2015, at 10:30, Hans Hagen pra...@wxs.nl wrote:
 
 On 7/20/2015 6:06 PM, Hans Aberg wrote:

 On 20 Jul 2015, at 16:40, Aditya Mahajan adit...@umich.edu wrote:
 
 On Mon, 20 Jul 2015, Hans Aberg wrote:
 
 The LaTeX package unicode-math has an option colon=literal, which makes it 
 behave as in math functions (as in example below). Has ConTeXt a similar 
 option?
 
 No. You have to use \colon.
 
 It would be nice with such an option, as it helps the readability of the 
 input files.
 
 already for some years i'm thinking of something similar to openmath 
 dictionaries i.e. in many cases when one writes math it is in some field that 
 is consistent within a document, say logic or engineering
 
 it is rather trivial to support something
 
 \setupmathematics[domain=logic]
 
 or so, where we automatically relate the math class with the symbols used, 
 something that becomes more important once we start coding in unicode instead 
 of using names
 
 but ... in order to provide this, i need information about useful categories

Unicode provides one such category. The reason is all math characters are added 
and in that process analyzed. I worked with Taco on that in the late 1990s.

So one main option, which might be the simplest, to assume that the input is 
UTF-8. Oen can the added ASCII command names, based on the Unicode names. In 
addition some options for special needs and legacy.


___
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
___

[NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg
The LaTeX package unicode-math has an option colon=literal, which makes it 
behave as in  math functions (as in example below). Has ConTeXt a similar 
option?


 lualatex 
\documentclass[leqno]{article}

\usepackage[colon=literal]{unicode-math}

\begin{document}

The function $f: A → B$.

\end{document}



___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 16:40, Aditya Mahajan adit...@umich.edu wrote:
 
 On Mon, 20 Jul 2015, Hans Aberg wrote:
 
 The LaTeX package unicode-math has an option colon=literal, which makes it 
 behave as in math functions (as in example below). Has ConTeXt a similar 
 option?
 
 No. You have to use \colon.

It would be nice with such an option, as it helps the readability of the input 
files.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 17:50, Manuel Blanco manue...@ucm.es wrote:
 
 A little bit more of intelligence can be given with
 
\begingroup\lccode`\~=`\:\lowercase{\endgroup
  \unexpanded\def~}{\futurelet\tmptoken\docolon}

 \unexpanded\def\docolon{\ifx=\tmptoken\mathrel{\mathop{\mathchar`\:}}\else\colon\fi}
\mathcode`\:=8000 %
 
 That lets you do $f: A \to B$ and $f(x) := x^2$

For the second, one can use ≔ COLON EQUALS U+2254. But it is a good point, 
though.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 17:43, Manuel Blanco manue...@ucm.es wrote:
 
 Well, you can make the colon active in math mode and then let it output 
 \colon.
 
 This is a TeX way, I don't know if there's a ConTeXt way for this:
 
\begingroup\lccode`\~=`\:\lowercase{\endgroup
  \let~}\colon
\mathcode`\:=8000 %

For some reason, the colon in ConTeXt is larger relative LuaTeX.

Also, it seems that “\:” is not used for anything - error in luatex, and empty 
in context. So it might be used for the infix operator.

— context —
\setupbodyfont[xits,10pt]

\setupformulas[location=left]

\begingroup\lccode`\~=`\:\lowercase{\endgroup
 \let~}\colon
   \mathcode`\:=8000 %

\starttext

The function $f: A → B$, $g\colon A → B$.

\stoptext
—

— luatex —
\begingroup\lccode`\~=`\:\lowercase{\endgroup
 \let~}\colon
   \mathcode`\:=8000 %

The function $f: A → B$.
—

___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 18:37, Aditya Mahajan adit...@umich.edu wrote:
 
 On Mon, 20 Jul 2015, Hans Aberg wrote:
 
 
 On 20 Jul 2015, at 16:40, Aditya Mahajan adit...@umich.edu wrote:
 On Mon, 20 Jul 2015, Hans Aberg wrote:
 The LaTeX package unicode-math has an option colon=literal, which makes it 
 behave as in math functions (as in example below). Has ConTeXt a similar 
 option?
 No. You have to use \colon.
 
 It would be nice with such an option, as it helps the readability of the 
 input files.
 
 There are two uses of colon in math, as a relation (in sets \{ x : f(x) = 0 
 \} and in ratios A:B, etc) and as a punctuation ($f \colon A - B, etc.[1]). 
 Only one of them can be mapped to the literal :, the other must use a macro 
 name. Knuth chose to map : to the relation and mapped \colon to a punctuation 
 and every other macro package follows that convention.

Right. Perhaps he didn’t use functions much. :-)

 It is easy to change the mapping, but if the mapping is reversed, is there is 
 standard name for : as a relation?

It seems that “\:” might be used. I get an error when trying to use it in 
luatex. But note:

In pure math, “:” is also used for projective coordinates, it does not seem to 
have operator spaces around them. This is what I think is the right look:
  https://en.wikipedia.org/wiki/Homogeneous_coordinates#Notation

There is also Unicode ∶ RATIO U+2236.

So a proposal might be to keep \colon, and make a new \ratio for those that 
want to use the operator : in ASCII. The : without spaces might perhaps be 
called \proj or something.

Looking at
  https://en.wikipedia.org/wiki/Mathematical_Operators
a UTF-8 mapping would be sending U+2236 to \ratio, the operator :. There is no 
special colon for the other uses, function and projective coordinates, it seems.

So the \: might be mapped to \proj or \ratio according to taste.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 18:37, Aditya Mahajan adit...@umich.edu wrote:

 It is easy to change the mapping, but if the mapping is reversed, is there is 
 standard name for : as a relation?

Looking into a book on algebraic geometry, it seems fine to use operator : for 
projective coordinates. So skip the variation without spaces then.

Then one might use two short commands : and \: that correspond, by an option, 
to \colon and \ratio. Unicode ∶ RATIO U+2236 should always be operator :, i.e. 
\ratio, then, though.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 18:37, Aditya Mahajan adit...@umich.edu wrote:
 
 On Mon, 20 Jul 2015, Hans Aberg wrote:

 It would be nice with such an option, as it helps the readability of the 
 input files.
 
 There are two uses of colon in math, as a relation (in sets \{ x : f(x) = 0 
 \} and in ratios A:B, etc) and as a punctuation ($f \colon A - B, etc.[1]). 
 Only one of them can be mapped to the literal :, the other must use a macro 
 name.

 It is easy to change the mapping, but if the mapping is reversed, is there is 
 standard name for : as a relation?

It might be simplest to align towards Unicode and UTF-8, while retaining ASCII 
commands, avoiding a plethora of options:

So one has the commands \colon for function “: as is now, and the new \ratio 
for operator “:.

Then Unicode ∶ RATIO U+2236 is mapped to the same as \ratio, which leaves :
COLON U+003A the only possibility to be the same as \colon.

Such an option might be called say colon=unicode, and be a part other similar 
options.


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 21:34, Manuel Blanco manue...@ucm.es wrote:
 
 I'm not sure I understand what you mean. It's true that the colon used
 in \colon differs from the one used if you input : directly by default
 (it's smaller).

Right. For some reason, your code gives the right, smaller, colon when used 
with luatex, but not with context. (As in the examples I gave.)


___
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
___

Re: [NTG-context] Math literal colon

2015-07-20 Thread Hans Aberg

 On 20 Jul 2015, at 21:34, Manuel Blanco manue...@ucm.es wrote:

 The definition of a coordinate separator should be with \mathpunct,
 although it doesn't look particularly good, so may be better to use no
 space at all (as commented in other mails). 

 In the case of \ratio, since it's a binary operator, it should be
 \mathbin; but may be that's too much space and tighter spacing would
 be better.

Strictly speaking, the coordinate separator : for homogeneous coordinates is a 
ration symbol, and a book in algebraic used that.

So may be simplest to only do the operator : along with the function and set :.

 

___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 16:47, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 I get errors when using \MC - see example below.
 
 The \NR before \stopmathcases is missing in all your examples.

OK. Though I know it, it is hard to get used to, coming from LaTeX.

 But the spacing is wrong: too much between the two components. These are not 
 cases, but aligned formulas: one might have a number of alignments, not just 
 one. And I just happen to use left braces on them.
 
 Take a look at my previous example where I changed the distance between both 
 columns with the distance key.

I missed that. It fixes the spaces within the formula, but adds space between 
the two sets relative both TeX and AMS-LaTeX (which has about the same as TeX), 
cf. example below.

In AMS-LaTeX one can have more than one alignment, though when trying it 
between the “-“ and the “ω” in the second (right-most) set, it adds a lot of 
space, rather than just trying to align a compactly as possible. In ConTeXt, 
nothing happens with extra alignments; in TeX, there is an error.

So using \startmathcases is a workaround: trying to force it to do something it 
wasn’t intended for.


\starttext

\def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced

\startformula
 J^j:\startmathcases[distance=\spaceamount]\NC ω^0 \MC ↦ 0 \NR \NC ω^j \MC ↦ 0 
\NR \stopmathcases \quad
  \startmathcases[distance=\spaceamount] \NC ω^k \MC ↦ \MC ω^l \NR \NC ω^l \MC 
↦ -\MC ω^k \NR \stopmathcases
\stopformula

\startformula
 J^j:\equlb{ω^0 ↦ 0 \cr ω^j ↦ 0} \quad
 \equlb{ω^k ↦ ω^l \cr ω^l ↦ -ω^k} \stopformula

\stoptext



___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 04:46, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:
 
 The spacing is different in cases - TeX also has such a variation. 
 Specifically, there is extra space before the conditionals.
 
 In addition, it seems \startmathcases ... \stopmathcases is not working with 
 UTF-8: in the example below, the ω’s on the second line, after the arrows, 
 disappear in my PDF. 
 This is explained in section 8 of the document:

FYI, the TeX Live 2015 version from 2007 called context-latex-math.pdf does not 
have ch. 8.

 There are two ways of specifying the second column — \MC (Math Column)
 and \NC (New Column). If \MC is used, the second column is in \math mode,
 with \NC it is in ‘text mode’.

I get errors when using \MC - see example below.

But the spacing is wrong: too much between the two components. These are not 
cases, but aligned formulas: one might have a number of alignments, not just 
one. And I just happen to use left braces on them.


\starttext

\startformula
 J^j:\startmathcases\NC ω^0 \MC → 0 \NR \NC ω^j \MC → 0 \stopmathcases \quad
  \startmathcases \NC ω^k \MC → ω^l \NR \NC ω^l \MC → -ω^k \stopmathcases
\stopformula

\stoptext



___
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
___

[NTG-context] Environments

2015-07-07 Thread Hans Aberg
ConTeXt does not seem to have LaTeX style environments. FYI, for the latter, I 
developed [1] a long time ago more advanced ones:

The environments admit hooks, i.e., code executed before and after the local 
group. The name can be omitted in the closing, which works also when using one 
environment to define a new. And a more compact syntax.


1. 
https://secure2.storegate.com/Shares/Home.aspx?ShareID=db8465b3-112f-4194-8909-1d42ff149e32

Compile 'lualatex test0.tex’.


___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 20:17, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 You can set the alignment for each column in a matrix with the align key.
 
 \definemathmatrix
   [aligned]
   [n=2,
align={right,left},
distance=\spaceamount]
 
 \starttext
 
 \startformula
 J^j:
 \startaligned[left=\left\{,right=\right.]
 \NC ω^0 \NC ↦ 0 \NR
 \NC ω^j \NC ↦ 0 \NR
 \stopaligned
 \quad
 \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.]
 \NC ω^k \NC ↦ \NC  ω^l \NR
 \NC ω^l \NC ↦ \NC -ω^k \NR
 \stopaligned
 \stopformula
 
 \stoptext

That looks like the right thing. Thanks.

Your example is quite close to TeX, cf. example below.

I have also put in an extra alignment to see what happens, monospace code 
alignment style. Changing ‘left’ to ‘right did not seem to have any effect here.


\definemathmatrix
  [aligned]
  [n=2,
   align={right,left},
   distance=\spaceamount]

\starttext

\startformula
  J^j:
  \startaligned[left=\left\{,right=\right.]
\NC ω^0 \NC ↦ 0 \NR
\NC ω^j \NC ↦ 0 \NR
  \stopaligned
  \quad
  \startaligned[n=3,align={right,middle,left},left=\left\{,right=\right.]
\NC ω^k \NC ↦ \NC  \NC ω^l \NR
\NC ω^l \NC ↦ \NC -\NC ω^k \NR
  \stopaligned
\stopformula


\def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced

\startformula
 J^j:\equlb{ω^0 ↦ 0 \cr ω^j ↦ 0} \quad
 \equlb{ω^k ↦ ω^l \cr ω^l ↦ -ω^k} \stopformula

\stoptext


___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 21:49, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 You should google for mathalign.pdf which explains and shows examples for the 
 matrix, cases etc. environments.
 
 To get the same result as your LaTeX example you can use the m key for 
 \startalign.
 
 \starttext
 
 \startformula
 \startalign[m=3,distance=3em]
 \NC K \NC \approx G * H\NC  i   \NC = j+k 
 \NC B \NC \subset C  \NR
 \NC H \NC \approx A_{0}*B_{0}  \NC  i'  \NC = j'+k'   
 \NC C \NC = D\cap E  \NR
 \NC G \NC \approx \coprod_{\alpha\in A} L_{\alpha} \NC  i'' \NC  =j''+k'' 
 \NC A \NC = D \cup E \NR
 \stopalign
 \stopformula
 
 \stoptext

That is where I started - it does not work with \left\{ … \right. :-)


___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 20:17, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 You can set the alignment for each column in a matrix with the align key.

FYI, the document amshelp.pdf says that AMS-LaTeX environments align, align*, 
and aligned, can have multiple alignments, and gives this example:
\begin{align*}
  K \approx G * H   i= j+k  B \subset C\\
  H \approx A_{0}*B_{0}  i’= j’+k’  C = D\cap E\\
  G \approx \coprod_{\alpha\in A} L_{\alpha}  i’’=j’’+k’’ A = D \cup E
\end{align*}
which is typeset so that 'K \approx G * H’ is one equation aligned on the ‘’ 
with the others below, followed by 'i= j+k’ in the next column.

So the ampersands have multiple functions here, it seems: alignment and 
separating columns.

Translating into ConTeXt, one might have (pseudocode):
\startformula
  \startalign
\NC K \NA \approx G * H \NC  i\NA= j+k \NC B \NA \subset C \NR
\NC H \NA \approx A_{0}*B_{0} \NC   i’\NA= j’+k’ \NC   C \NA = D\cap E\NR
\NC G \NA \approx \coprod_{\alpha\in A} L_{\alpha}
  \NC   i’’\NA =j’’+k’’ \NC  A \NA = D \cup E \NR
  \stopalign
\stopformula
where I have introduce a symbol \NA for alignment.


___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 21:18, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 I have also put in an extra alignment to see what happens, monospace code 
 alignment style. Changing ‘left’ to ‘right did not seem to have any effect 
 here.
 
 Can you see the effect of the alignment?
 
 \starttext
 
 \startformula
 \startmatrix[align={left,middle,right}]
 \NC a   \NC b   \NC c   \NR
 \NC aa  \NC bb  \NC cc  \NR
 \NC aaa \NC bbb \NC ccc \NR
 \stopmatrix
 \stopformula
 
 \stoptext

Thanks. I know that example. I just noticed it seemed to have no effect in the 
other example, for some reason.


___
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
___

Re: [NTG-context] Math alignment

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 21:49, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:

 You should google for mathalign.pdf which explains and shows examples for the 
 matrix, cases etc. environments.

It looks rather basic, except for last formula of section 9. 

The document amshelp.pdf, ch. 7, has some nice pure math style examples.


___
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
___

Re: [NTG-context] Environments

2015-07-07 Thread Hans Aberg

 On 7 Jul 2015, at 11:05, luigi scarso luigi.sca...@gmail.com wrote:

 For  LaTeX style environments do you mean
 e.g.
 https://it.sharelatex.com/learn/Environments
 ?  (just to be sure )

Yes, the \begin{foo} … \end{foo} syntax. Technically, an environment means that 
variables are stacked in a syntactically local group, as in \begingroup … 
\endgroup.

The syntax in the example file is «foo· … ·» or «foo· … ·foo», so one does not 
have to write the ‘start' and ‘stop’ all the time, and does not have to write 
the name of the environment again at the end.

 In this case  context has the \definesomething commands as for example
 http://wiki.contextgarden.net/Command/definetyping

I think this corresponds (in pseudocode) to my
\new{Environment}{typing}%
  {}{before code}%
  {after code}{}

In LaTeX, if I remember correctly, it would expand to \begingroupbefore code 
… after code\endgroup.

I added so one can have 
\new{Environment}{typing}%
  {before code}{begin code}%
  {end code}{after code}
expanding to
  before code\begingroupbegin code … end code\endgroupafter code

So one has more control over designing the environment. One can then also 
define a new environment
\new{Environment}{typingmore}%
  {code}{code«typing·args}%
  {·typing»code}{code}
I think, to make specializations.

 Context has also 
 http://wiki.contextgarden.net/Command/startenvironment
 but I suppose it's not what you mean.

It looks like just adding a series of command names, rather than a stacked 
environment, or a namespace (module). If one wants to avoid name clashes, one 
can have names like in directory names, living without any local group.


___
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
___

[NTG-context] Smallmatrix not implemented

2015-07-06 Thread Hans Aberg
Smallmatrix from AMS-TeX is not implemented in ConTeXt (Tex Live 2015), though 
crossed out in m-newmat.tex. I found this old post:
  http://www.ntg.nl/pipermail/ntg-context/2005/013146.html


___
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
___

[NTG-context] Math alignment

2015-07-06 Thread Hans Aberg
The example below shows the intended output when using original TeX code 
(compiled with  ‘context' of TeX Live 2015): a pair of left braced formulas. 
The first comment shows what works in AMS-LaTeX.

However, when trying similar ConTeXt commands, I get the error shown in the 
comment below. What ConTeXt command might use here?

---
\setupformulas[location=left]

\starttext

\def\equlb#1{\left\{\eqalign{#1}\right.} %equation left braced

% AMS-LaTeX
%\def\equlb#1{\left\{ \begin{aligned} #1 \end{aligned}\right.} % equation left 
braced

% ConTeXt error: You can't use `\halign' in math mode.
%\def\equlb#1{\left\{ \startalign #1 \stopalign\right.}
%\def\equlb#1{\left\{ \startmathalignment #1 \stopmathalignment\right.}


\startformula \placeformula[JcoordDef]
 J^j:\equlb{ω^0 → 0 \cr ω^j → 0} \quad
 \equlb{ω^k → ω^l \cr ω^l → -ω^k} \stopformula

\stoptext
---


___
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
___

[NTG-context] Integral spacing

2015-07-06 Thread Hans Aberg
I get too much spacing after the integrals when using ‘context’ (TeX Live 2015) 
- see first example below. Cf. the second example below, compiled with luatex. 
In ConTeXt, the result is the same regardless of body font, and also if using 
original TeX \int.


--- context ---
\setupbodyfont[xits,10pt]
%\setupbodyfont[stix,10pt]

\starttext

\startformula
  ⟨φ|ψ⟩ ≔ ∫… ∫ dx_1 … dx_n\, φ(x_1, …, x_n)^* ψ(x_1, …, x_n)
\stopformula

\startformula
  ⟨φ|ψ⟩ ≔ \int … \int dx_1 … dx_n\, φ(x_1, …, x_n)^* ψ(x_1, …, x_n)
\stopformula

\stoptext
---

--- luatex ---
$$
  \left\phi|\psi\right = \int \ldots \int dx_1 \ldots dx_n\, \phi(x_1, 
\ldots, x_n)^* \psi(x_1, \ldots, x_n)
$$

\end
---


___
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
___

Re: [NTG-context] Math alignment

2015-07-06 Thread Hans Aberg
[I do not get copies from the list, though having signed up.]

Wolfgang Schuster wrote:

 On 6 Jul 2015, at 11:24, Hans Aberg haber...@telia.com wrote:
 
 The example below shows the intended output when using original TeX code 
 (compiled with  ‘context' of TeX Live 2015): a pair of left braced formulas. 
 The first comment shows what works in AMS-LaTeX.
 
 However, when trying similar ConTeXt commands, I get the error shown in the 
 comment below. What ConTeXt command might use here?
 
 Take a look at the wiki page [1] for multiline equations and also the 
 linked PDF at the start of the page.
 
 [1] 
 http://wiki.contextgarden.net/Multiline_equations#Cases

The spacing is different in cases - TeX also has such a variation. 
Specifically, there is extra space before the conditionals.

In addition, it seems \startmathcases ... \stopmathcases is not working with 
UTF-8: in the example below, the ω’s on the second line, after the arrows, 
disappear in my PDF. 


\startformula
 J^j:\startmathcases\NC ω^0 \NC→ 0 \NR \NC ω^j \NC→ 0 \stopmathcases \quad
  \startmathcases \NC ω^k \NC→ ω^l \NR \NC ω^l \NC→ -ω^k \stopmathcases
\stopformula


___
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
___

Re: [NTG-context] Smallmatrix not implemented

2015-07-06 Thread Hans Aberg
[I do not get copies from the list, though having signed up.]

 Smallmatrix from AMS-TeX is not implemented in ConTeXt (Tex Live 2015), 
 though crossed out in m-newmat.tex.
 
 You can create your own matrix environment for inline use:
 
 \definemathmatrix
[smallmatrix]
[left=\Big(,
 right=\Big),
 style=\scriptstyle,
 strut=0.7,
 distance=.25em]
 
 \starttext
 
 This is a example \m{ \startsmallmatrix \NC a \NC b \NR \NC c \NC d \NR 
 \stopsmallmatrix } for a smallmatrix environment.

It looks pretty much like the AMS-LaTeX variation. Below is another example of 
use, as a displayed formula.



% Defines a small two-by-two matrix.
\def\twomatrix#1#2#3#4{\startsmallmatrix\NC{#1}\NC{#2}\NR\NC{#3}\NC{#4}\NR\stopsmallmatrix}

% The Pauli spin matrices, explicit forms.
\def\pspint{{\twomatrix1001}}
\def\pspinx{{\twomatrix0110}}
\def\pspiny{{\twomatrix0{-핚}핚0}}
\def\pspinz{{\twomatrix100{-1}}}

Pauli spin matrices
\startformula
  σ^0 ≔ \pspint, \quad σ^3 ≔ \pspinz, \quad
  σ^1 ≔ \pspinx, \quad σ^2 ≔ \pspiny
\stopformula


___
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
___

[NTG-context] Font selection ranges

2011-09-30 Thread 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.

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
___