Re: [NTG-context] strange output in math display mode

2015-12-22 Thread Alan BRASLAU
Wolfgang,

Can you explain to us why it should be preferable for ConTeXt users to
employ \frac12 rather than the native TeX construction {1\over 2}?
I understand that the macro \frac does some additional trickery but the
two constructions should *always* yield identical results (when
keyed-in properly).

Of course, Donald Knuth disagrees with \frac from the point of view
of the aesthetics of the syntax.

Alan



On Mon, 21 Dec 2015 15:17:18 +0100
Wolfgang Schuster  wrote:

> > However the command {1 \over 2} gives the correct result.
> > 
> It's a spurious "\??mathstylecache" in math-ini.mkiv and I sent a fix
> to the dev-list.
___
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] Pgfplots - "reverse legend" by Lua

2015-12-22 Thread Aditya Mahajan

On Tue, 22 Dec 2015, Hans Hagen wrote:


On 12/22/2015 5:36 PM, Aditya Mahajan wrote:

 On Tue, 22 Dec 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
> 
>  \starttikzpicture

> %\startaxis[legend entries={Cos,Sin2,Sin},reverse legend]
> \cldcommand{startaxis{["legend entries"] = "{Cos,Sin2,Sin}", "reverse
> legend"}}

 This is not valid lua. On a lua prompt, try

>

 t = {["legend entries"]="{Cos,Sin2,Sin}", "reverse legend"}


You are right. Sorry for the noise.

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

Re: [NTG-context] strange output in math display mode

2015-12-22 Thread Alan BRASLAU
So it it a TeX programming limitation.

The risk of leading to an exponential number of branches is addressed
by Knuth at the beginning of Chapter 17 of the TeXbook (p. 139):
"Mathematicians tend to \quote{overuse} \over when they first begin to
typeset their own work on a system like \TEX." ...

At one point, I went back to using \over rather than \frac as the later
was broken and gave no output. This has since been fixed, but I stayed
with \over as I find primary operators to be much more elegant syntax
than multiple argument macros. It is too bad that luatex does not
employ a better programming solution, as the use of \frac{}{} leads to
ugly mathematical source code.

I guess that I should not worry about it too much since, as Knuth points
out in Chapter 17, overuse of \over, etc. leads to ugly results
anyways, just as well as an overuse of \text in mathematical formulas
(as we physicists tend to abuse) also leads to ugly mathematics.

Alan


On Tue, 22 Dec 2015 17:30:22 -0500
Aditya Mahajan  wrote:

> On Tue, 22 Dec 2015, Alan BRASLAU wrote:
> 
> > Wolfgang,
> >
> > Can you explain to us why it should be preferable for ConTeXt users
> > to employ \frac12 rather than the native TeX construction {1\over
> > 2}? I understand that the macro \frac does some additional trickery
> > but the two constructions should *always* yield identical results
> > (when keyed-in properly).  
> 
> One of the troubles with {  \over ...} and the like is that TeX
> does not know which "style" to use. This can lead to extra processing
> when using any command defined using \mathpalatte (such as \text,
> stacked arrows, and others).
> 
> Consider \text{...}. Basically, we want \text{...} to typeset it's 
> argument in a \hbox with textsize equal to the normalsize in normal
> mode and equal to script size when used in a subscript and in
> scriptsciptsize when used in a sub-subscript. Now, in traditional
> tex, when parsing
> 
> {\text{hello} \over 2}
> 
> TeX does not kow what size to use for \text{...} until it encounters
> the \over. So, when parsing \text{hello}, TeX generates all possible
> sizes and then prunes them later on. With nested constructs like
> 
> {\text{hello}_{\text{world} \over 2} \over 2}
> 
> it can lead to exponential number of branches.
> 
> With \frac{\text{hello}}{2}, TeX "knows" what style to use for the 
> arguments. So, extra processing is not needed (at least, this is the
> idea in LuaTeX; in PDFTeX, multiple sizes need to be generated). This
> can lead to some slightly faster processing.
> 
> Also see http://tex.stackexchange.com/a/1261/ answer from Taco.
> Contrast the definition of \cramped given there from one in the LaTeX
> mathtools package 
> (http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) 
> [search from MT_cramped_clap_internal:Nn]
> 
> 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  :
> http://foundry.supelec.fr/projects/contextrev/ wiki :
> http://contextgarden.net
> ___


-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS UMR 3680
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.bras...@cea.fr
___
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] strange output in math display mode

2015-12-22 Thread Aditya Mahajan

On Tue, 22 Dec 2015, Alan BRASLAU wrote:


Wolfgang,

Can you explain to us why it should be preferable for ConTeXt users to
employ \frac12 rather than the native TeX construction {1\over 2}?
I understand that the macro \frac does some additional trickery but the
two constructions should *always* yield identical results (when
keyed-in properly).


One of the troubles with {  \over ...} and the like is that TeX does 
not know which "style" to use. This can lead to extra processing when 
using any command defined using \mathpalatte (such as \text, stacked 
arrows, and others).


Consider \text{...}. Basically, we want \text{...} to typeset it's 
argument in a \hbox with textsize equal to the normalsize in normal mode 
and equal to script size when used in a subscript and in scriptsciptsize 
when used in a sub-subscript. Now, in traditional tex, when parsing


   {\text{hello} \over 2}

TeX does not kow what size to use for \text{...} until it encounters the 
\over. So, when parsing \text{hello}, TeX generates all possible sizes and 
then prunes them later on. With nested constructs like


{\text{hello}_{\text{world} \over 2} \over 2}

it can lead to exponential number of branches.

With \frac{\text{hello}}{2}, TeX "knows" what style to use for the 
arguments. So, extra processing is not needed (at least, this is the idea 
in LuaTeX; in PDFTeX, multiple sizes need to be generated). This can lead 
to some slightly faster processing.


Also see http://tex.stackexchange.com/a/1261/ answer from Taco. Contrast 
the definition of \cramped given there from one in the LaTeX mathtools 
package 
(http://ctan.bppro.ca/macros/latex/contrib/mathtools/mathtools.dtx) 
[search from MT_cramped_clap_internal:Nn]


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

Re: [NTG-context] Pgfplots - "reverse legend" by Lua

2015-12-22 Thread Aditya Mahajan

On Tue, 22 Dec 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:


\starttikzpicture
   %\startaxis[legend entries={Cos,Sin2,Sin},reverse legend]
   \cldcommand{startaxis{["legend entries"] = "{Cos,Sin2,Sin}", "reverse
   legend"}}


This is not valid lua. On a lua prompt, try


t = {["legend entries"]="{Cos,Sin2,Sin}", "reverse legend"}

you get

stdin:1: table index is nil
stack traceback:
stdin:1: in main chunk
[C]: in ?

One can define a lua table using

{[key]=value, [key]=value, ... } etc

or

{value1, value2, ...} etc.

Mixing the two is not allowed.

In ConTeXt, the two are not mixed. But tikz (and pgfplot) freely mix the 
two syntax. So, one way to get the result using lua is (untested)


\ctxlua{"\\startaxis[legend entries={Cos,Sin2,Sin}, reverse legend]"}

where, if needed, you can build the string using string.format.

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

Re: [NTG-context] Pgfplots - "reverse legend" by Lua

2015-12-22 Thread Hans Hagen

On 12/22/2015 5:36 PM, Aditya Mahajan wrote:

On Tue, 22 Dec 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:


\starttikzpicture
   %\startaxis[legend entries={Cos,Sin2,Sin},reverse legend]
   \cldcommand{startaxis{["legend entries"] = "{Cos,Sin2,Sin}", "reverse
   legend"}}


This is not valid lua. On a lua prompt, try

 >

t = {["legend entries"]="{Cos,Sin2,Sin}", "reverse legend"}


such a table is valid lua (mixture of indexed and hashed) but of course 
the application using it has to know how to use it


Hans



-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___