Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Wolfgang Schuster



Pablo Rodriguez 
19. März 2017 um 22:08via Postbox 



Yes, this might work, but I’m afraid I need to disable other default
features such as ligatures (not only liga, but TeX ligatures).

I had this problem typesetting XML sources and I didn’t know how to
disable the other features.
The default setting is “feature=default” and to get expansion/protrusion 
additional

to kerning etc. you have two options:

1. Add them to the default feature with 
\definefontfeature[default][default][expansion=quality,protrusion=quality]


2. Set multiple feature with 
\definefontfamily[...][...][...][features={default,quality}]


You can use the second method when you want only expansion/protrusion. 
When you
set only “features=quality” kerning isn’t enabled because the default 
features aren’t

applied to your font.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 09:58 PM, Wolfgang Schuster wrote:
>> Pablo Rodriguez 19. März 2017 schrieb:
>> But [features={none, quality}] disables everything and I canot enable
>> protrusion plus expansion only.
>>
>> At least, it doesn’t work with \definefontfamily. I haven’t tested this
>> with \setupfontfamily.
>
> \definefontfamily[mainface][mono][Latin Modern Mono Prop][features=quality]

Yes, this might work, but I’m afraid I need to disable other default
features such as ligatures (not only liga, but TeX ligatures).

I had this problem typesetting XML sources and I didn’t know how to
disable the other features.

My main interest in having mono with quality are standard paragraphs
with Roman text. Expansion and protrusion enable better line breaking.
And if mono doesn’t get protrusion, you may find wrong optical margins
(protrusion), because the lack of it only on the mono face.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Wolfgang Schuster



Pablo Rodriguez 
19. März 2017 um 21:40via Postbox 



But [features={none, quality}] disables everything and I canot enable
protrusion plus expansion only.

At least, it doesn’t work with \definefontfamily. I haven’t tested this
with \setupfontfamily.

\definefontfamily[mainface][mono][Latin Modern Mono Prop][features=quality]

\setupbodyfont[mainface]

\setupalign[hanging]

\showframe[text][text]

\starttext
\input{zapf}
\input{tufte}
\input{weisman}
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Wolfgang Schuster



Pablo Rodriguez 
19. März 2017 um 21:40via Postbox 



But [features={none, quality}] disables everything and I canot enable
protrusion plus expansion only.

At least, it doesn’t work with \definefontfamily. I haven’t tested this
with \setupfontfamily.

The "none" feature disables ligatures, kerning etc. which makes sense
when you use amonospaced font for code listings etc.

When you plan to use a monospaced font for normal text setting the
alignment to flushleft makes more sense.

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 09:32 PM, Wolfgang Schuster wrote:
>> Pablo Rodriguez 19. März 2017 um 21:07via Postbox
>> [...]
>> BTW, does it happen the same to mono fonts? In the past, I wanted to
>> check whether quality values for protrusion and expansion would make
>> sense in the document I was typesetting, but I couldn’t make it work for
>> mono fonts.
> 
> No, mono fonts use the global feature settings but you can change this
> for allmono fonts with \setupfontfamily[tt][features=none].

But [features={none, quality}] disables everything and I canot enable
protrusion plus expansion only.

At least, it doesn’t work with \definefontfamily. I haven’t tested this
with \setupfontfamily.

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Wolfgang Schuster



Pablo Rodriguez 
19. März 2017 um 21:07via Postbox 



Many thanks for your explanation, Wolfgang.

I didn’t consider that Neo Euler might be a default font. And I didn’t
know that the values would be internal values which had to be
overwritten by feature values for each alternative.

The default values are only a thing for math fonts (but you’re using
it outside of math) and I want to ensure goodies files etc. with
font fixes are loaded.


BTW, does it happen the same to mono fonts? In the past, I wanted to
check whether quality values for protrusion and expansion would make
sense in the document I was typesetting, but I couldn’t make it work for
mono fonts.
No, mono fonts use the global feature settings but you can change this 
for all

mono fonts with \setupfontfamily[tt][features=none].

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] \showlayout values

2017-03-19 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\setuplayout[backspace=2.5cm, cutspace=2.5\backspace,
  rightmargin=1.75\leftmarginwidth, width=middle]
\showframe
\starttext
\showlayout
\stoptext

Values equal to 0pt are written as 0ptpt. I guess this might be a typo
somewhere in the code.

But I would like to know the actual values of rightedge and
rightedgedistance.

I assume I’m missing something. But if the right margin shows its outer
edge, there should be a measure that shows the distance between the
right margin edge and the right paper rim. Or shouldn’t it be?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 08:38 PM, Wolfgang Schuster wrote:
>> Pablo Rodriguez 19. März 2017 schrieb:
>> [...]
>> Is this a bug or what am I missing?
> 
> When you use a math font (which Neo Euler is) the argument of the 
> features key is ignored and \definefontfamily uses internal default 
> values instead. These default values can only be overwritten by
> feature values for each alternative, e.g.
> 
>   \definefontfamily[...][...][Neo Euler][tf={style:regular,features:default}]

Many thanks for your explanation, Wolfgang.

I didn’t consider that Neo Euler might be a default font. And I didn’t
know that the values would be internal values which had to be
overwritten by feature values for each alternative.

BTW, does it happen the same to mono fonts? In the past, I wanted to
check whether quality values for protrusion and expansion would make
sense in the document I was typesetting, but I couldn’t make it work for
mono fonts.

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] bug in \definefontfamily?

2017-03-19 Thread Wolfgang Schuster



Pablo Rodriguez 
19. März 2017 um 13:38via Postbox 



Hi Joseph,

sorry, the second sample was different. The first line was TeX Gyre
Pagella and the second line was Neo Euler.

The default feature for the whole text was old numbers. TeX Gyre Pagella
works fine with it, but Neo Euler (with \definefontfamily) doesn’t
honour "onum".

But \definefont works fine, so I guess something might be improved in
\definefontfamily. See the sample:

\definefontfeature[default][default][onum=yes]
\definefontfamily[mainface][rm][TeX Gyre Pagella]
\definefontfamily[mainface][hw][Neo Euler]
\definefont[directFont][euler.otf:+onum]
\setupbodyfont[mainface]
\starttext
\startTEXpage[offset=5ex]
1110

{\hw 1110}

\directFont 1110
\stopTEXpage
\stoptext

BTW, Neo Euler has "Neo-Euler" as PostScript name (according to
otfinfo). Maybe this is causing problems to the font loading mechanism.

Wolfgang, what do you think of this issue?

Many thanks for your help,

Pablo
Pablo Rodriguez 
19. März 2017 um 11:11via Postbox 



The issue is with the font:

\definefontfeature[default][default][onum=yes]
\definefontfamily[mainface][rm][TeX Gyre Pagella]
\definefontfamily[mainface][hw][Neo Euler]
\setupbodyfont[mainface]
\starttext
\startTEXpage[offset=5ex]
1110

\hw 1110
\stopTEXpage
\stoptext

Just in case it helps, LuaTeX-0.95 from TeX Live 2016 works fine with
both features in this font:

\input ifluatex.sty
\ifluatex\input luaotfload.sty\fi
\font\1="euler.otf:+salt"
\font\2="euler.otf:+onum"
\1 1110\2 1110
\bye

I don’t know why this happens. Could anyone confirm the issue?

Many thanks for your help,

Pablo
Pablo Rodriguez 
18. März 2017 um 23:05via Postbox 


Dear list,

I have the following sample:

\definefontfeature[default][default][salt=yes]
\definefontfamily[mainface][rm][Neo Euler]
\setupbodyfont[mainface]
\starttext
\startTEXpage[offset=1em]
1110

\type{1110}
\stopTEXpage
\stoptext

I get the same results with or without the first line commented out.
(I’m using latest beta from 2017.03.02 22:23.)

Is this a bug or what am I missing?
When you use a math font (which Neo Euler is) the argument of the 
features key
is ignored and \definefontfamily uses internal default values instead. 
These default

values can only be overwritten by feature values for each alternative, e.g.

\definefontfamily[...][...][Neo 
Euler][tf={style:regular,features:default}]


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Passing data back and forth between metapost and lua

2017-03-19 Thread Hans Hagen

On 3/19/2017 7:29 PM, Aditya Mahajan wrote:

On Sun, 19 Mar 2017, Aditya Mahajan wrote:


On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


I finally need to write a macro where I want to pass data from lua to
metapost. I could not find an example in the source code showing this.
Can someone show a basic example of how lua-metapost interface works
or point me to the appropriate files in the source.


Found some information in the CLD manual. That is sufficient for the
task at hand for me. But a pointer to a more detailed source will be
welcome.


real low level

\starttext

\startluacode

document.mydata = { foo = "foo", bar = 123 }

\stopluacode

\startMPcode

draw fullcircle scaled lua("mp.print(document.mydata.bar)") ;
draw textext (lua("mp.quoted(document.mydata.foo)")) ;

\stopMPcode

\stoptext

i'll mail you the new chapter in the metafun manual

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Passing data back and forth between metapost and lua

2017-03-19 Thread Aditya Mahajan

On Sun, 19 Mar 2017, Aditya Mahajan wrote:


On Tue, 20 Dec 2016, Alan Braslau wrote:


On Mon, 19 Dec 2016 08:19:25 -0800
Aditya Mahajan  wrote:


The ability to pass parameters to metapost has been around since the
beginning. See the metafun manual for details (search for MPvar).


Hans has developed tools making it quite easy to pass data back and
forth between MetaPost and lua. This is quite efficient, and it is
being used more and more in the development of macro functionality.


I finally need to write a macro where I want to pass data from lua to 
metapost. I could not find an example in the source code showing this. 
Can someone show a basic example of how lua-metapost interface works or 
point me to the appropriate files in the source.


Found some information in the CLD manual. That is sufficient for the 
task at hand for me. But a pointer to a more detailed source will be 
welcome.


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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Calculating with \measure

2017-03-19 Thread Marco Patzer
On Sun, 19 Mar 2017 18:18:48 +0100
Wolfgang Schuster  wrote:

> > Is it possible to calculate with \measure or do I have to resort to
> > dimens? Example:
> >
> > \definemeasure [mymeasure] [4cm]
> > \newdimen\mydim \mydim4cm
> >
> > \starttext
> > \framed[width=4cm]{Foobar}
> > \framed[width=\measure{mymeasure}]{Foobar}
> > \framed[width=2\mydim]{Foobar}
> > \framed[width=2\measure{mymeasure}]{Foobar}
> > \stoptext  
> You can use \measured

That's what I was looking for.

> or just create more named lengths.
> 
> \definemeasure [onemeasure] [4cm]
> \definemeasure [twomeasure] [\measure{onemeasure}*2]
> %\definemeasure [twomeasure] [2\measured{onemeasure}]

That's exactly what I initially did. After I ended up with

  \measure{Small}
  \measure{TwoSmall}
  \measure{ThreeSmall}
  \measure{FourSmall}
  \measure{Big}
  \measure{TwoBig}
  \measure{ThreeBig}
  \measure{FourBig}

I deleted the whole mess and went with \dimen.

Thanks for the quick response.

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Hans Hagen

On 3/19/2017 4:51 PM, Thomas A. Schmitz wrote:

On 19.03.2017 16:30, Otared Kavian wrote:

I would like to print in a text the values of a array computed in a
\startluacode …. \stopluacode combination.
How can I do it properly? Please have a look at the example below and
its output, which is not satisfactory because the right parenthesis is
separated from the number by a space. How can I suppress this unwanted
space?
For instance I get (1, 103 ) instead of (1, 103).


Otared,

is there a reason why you don't use context(vecteurY[i]) and
context(vecteurX[i])? This gets rid of the spurious space for me (and
makes your code more consistent). But I assume you must have tried it
because you use the "context" command in other places of your lua code.


always try to use the context command because it deals with catcodes and 
is more robust than a tex.(s)print


Hans


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Hans Hagen

On 3/19/2017 5:56 PM, Wolfgang Schuster wrote:



Otared Kavian 
19. März 2017 um 17:46via Postbox

Hi Aditya,

Thanks, as Thomas, Pablo and you mentioned the right way is to use
context() instead of tex.print()
Actually I just saw that one can also concatenate with context() as in:

context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

which is equivalent to
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

You can use the string.formatters function for this.

\starttext

\startluacode

local string_a = "12"
local string_b = "23"

context(string.formatters["(%s,%s)"](string_a,string_b))

\stopluacode

\stoptext


\starttext

\startluacode

local string_a = "12"
local string_b = "23"

context("(%s,%s)",string_a,string_b)

context.formatted.bold("(%s,%s)",string_a,string_b)

\stopluacode

\stoptext


-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Calculating with \measure

2017-03-19 Thread Wolfgang Schuster



Marco Patzer 
19. März 2017 um 18:06via Postbox 


Hi!

Is it possible to calculate with \measure or do I have to resort to
dimens? Example:

\definemeasure [mymeasure] [4cm]
\newdimen\mydim \mydim4cm

\starttext
\framed[width=4cm]{Foobar}
\framed[width=\measure{mymeasure}]{Foobar}
\framed[width=2\mydim]{Foobar}
\framed[width=2\measure{mymeasure}]{Foobar}
\stoptext

You can use \measured or just create more named lengths.

\definemeasure [onemeasure] [4cm]
\definemeasure [twomeasure] [\measure{onemeasure}*2]
%\definemeasure [twomeasure] [2\measured{onemeasure}]

\starttext
  \framed[width=\measure{onemeasure}]{Foobar}
  \framed[width=2\measured{onemeasure}]{Foobar}
  \framed[width=\measure{twomeasure}]{Foobar}
\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Wolfgang,

Thanks for letting me know the command string.formatters[….]. It allows to 
avoid the concatenation, which is to avoid as Thomas points out.

Now that I have solved the issue with the spurious space, I have one more 
question: how could one print the values (vecteuX[i],vecteurY[i]) in a 
tabulated environment so that when for instance one has 15 such values, one 
gets 3 lines with 5 values on each line?

Best regards: OK

> On 19 Mar 2017, at 17:56, Wolfgang Schuster  
> wrote:
> 
> 
>> Otared Kavian 19. März 2017 um 17:46 via Postbox
>> Hi Aditya,
>> 
>> Thanks, as Thomas, Pablo and you mentioned the right way is to use context() 
>> instead of tex.print()
>> Actually I just saw that one can also concatenate with context() as in:
>> 
>> context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
>> 
>> which is equivalent to
>> tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
> You can use the string.formatters function for this.
> 
> \starttext
> 
> \startluacode
> 
> local string_a = "12"
> local string_b = "23"
> 
> context(string.formatters["(%s,%s)"](string_a,string_b))
> 
> \stopluacode
> 
> \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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Calculating with \measure

2017-03-19 Thread Marco Patzer
Hi!

Is it possible to calculate with \measure or do I have to resort to
dimens? Example:

\definemeasure [mymeasure] [4cm]
\newdimen\mydim \mydim4cm

\starttext
  \framed[width=4cm]{Foobar}
  \framed[width=\measure{mymeasure}]{Foobar}
  \framed[width=2\mydim]{Foobar}
  \framed[width=2\measure{mymeasure}]{Foobar}
\stoptext

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Wolfgang Schuster



Otared Kavian 
19. März 2017 um 17:46via Postbox 


Hi Aditya,

Thanks, as Thomas, Pablo and you mentioned the right way is to use 
context() instead of tex.print()

Actually I just saw that one can also concatenate with context() as in:

context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

which is equivalent to
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

You can use the string.formatters function for this.

\starttext

\startluacode

local string_a = "12"
local string_b = "23"

context(string.formatters["(%s,%s)"](string_a,string_b))

\stopluacode

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Thomas A. Schmitz

On 19.03.2017 16:56, Pablo Rodriguez wrote:

is there any reason not to use the following instead of your way below?

  for i = 1,n do
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
  end


I don't think that this is a good approach. Refer to chapter 11.6 of 
"Programming in Lua" to see why string concatenation is computationally 
expensive. (It wouldn't matter in this simple case, but it's not a good 
habit to develop.)


All best

Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Aditya,

Thanks, as Thomas, Pablo and you mentioned the right way is to use context() 
instead of tex.print()
Actually I just saw that one can also concatenate with context() as in:

context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

which is equivalent to
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")

Best regards: OK

> On 19 Mar 2017, at 17:37, Aditya Mahajan  wrote:
> 
> On Sun, 19 Mar 2017, Otared Kavian wrote:
> 
>> Hi,
>> 
>> I would like to print in a text the values of a array computed in a  
>> \startluacode …. \stopluacode combination.
>> How can I do it properly? Please have a look at the example below and its 
>> output, which is not satisfactory because the right parenthesis is separated 
>> from the number by a space. How can I suppress this unwanted space?
>> For instance I get (1, 103 ) instead of (1, 103).
> 
> use context() to print instead of tex.print(...).
> 
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Pablo,

Thanks for your answer: actually I did not know that it is possible to 
concatenate so easily in lua… Your solution is indeed simpler than what I did 
and solves also the problem of the spurious space before the closing 
parenthesis.

Best regards: OK

> On 19 Mar 2017, at 16:56, Pablo Rodriguez  wrote:
> 
> On 03/19/2017 04:30 PM, Otared Kavian wrote:
>> Hi,
>> 
>> I would like to print in a text the values of a array computed in a
>> \startluacode …. \stopluacode combination.
>> How can I do it properly? Please have a look at the example below
>> and its output, which is not satisfactory because the right parenthesis is
>> separated from the number by a space. How can I suppress this unwanted
>> space?
>> For instance I get (1, 103 ) instead of (1, 103).
> 
> Hi Otared,
> 
> is there any reason not to use the following instead of your way below?
> 
>  for i = 1,n do
>tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
>  end
> 
>>  for i = 1,n do
>>  context("(") 
>>  tex.print(vecteurX[i]) 
>>  context(", ") 
>>  tex.print(vecteurY[i])
>>  tex.print(")")
>>  context.par()
>>  end
> 
> I think this is shorter and clearer (to me, at least).
> 
> Just in case it helps,
> 
> Pablo
> -- 
> http://www.ousia.tk
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Thomas,

Thanks for your answer.
Indeed I did not know that I could use directly 
context(vecteurY[i])
Now this solves my problem!

Best regards: OK

> On 19 Mar 2017, at 16:51, Thomas A. Schmitz  
> wrote:
> 
> On 19.03.2017 16:30, Otared Kavian wrote:
>> I would like to print in a text the values of a array computed in a  
>> \startluacode …. \stopluacode combination.
>> How can I do it properly? Please have a look at the example below and its 
>> output, which is not satisfactory because the right parenthesis is separated 
>> from the number by a space. How can I suppress this unwanted space?
>> For instance I get (1, 103 ) instead of (1, 103).
> 
> Otared,
> 
> is there a reason why you don't use context(vecteurY[i]) and 
> context(vecteurX[i])? This gets rid of the spurious space for me (and makes 
> your code more consistent). But I assume you must have tried it because you 
> use the "context" command in other places of your lua code.
> 
> Thomas
> ___
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Aditya Mahajan

On Sun, 19 Mar 2017, Otared Kavian wrote:


Hi,

I would like to print in a text the values of a array computed in a  
\startluacode …. \stopluacode combination.
How can I do it properly? Please have a look at the example below and its 
output, which is not satisfactory because the right parenthesis is separated 
from the number by a space. How can I suppress this unwanted space?
For instance I get (1, 103 ) instead of (1, 103).


use context() to print instead of tex.print(...).

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 04:30 PM, Otared Kavian wrote:
> Hi,
> 
> I would like to print in a text the values of a array computed in a
> \startluacode …. \stopluacode combination.
> How can I do it properly? Please have a look at the example below
> and its output, which is not satisfactory because the right parenthesis is
> separated from the number by a space. How can I suppress this unwanted
> space?
> For instance I get (1, 103 ) instead of (1, 103).

Hi Otared,

is there any reason not to use the following instead of your way below?

  for i = 1,n do
tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par")
  end

>   for i = 1,n do
>   context("(") 
>   tex.print(vecteurX[i]) 
>   context(", ") 
>   tex.print(vecteurY[i])
>   tex.print(")")
>   context.par()
>   end

I think this is shorter and clearer (to me, at least).

Just in case it helps,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Thomas A. Schmitz

On 19.03.2017 16:30, Otared Kavian wrote:

I would like to print in a text the values of a array computed in a  
\startluacode …. \stopluacode combination.
How can I do it properly? Please have a look at the example below and its 
output, which is not satisfactory because the right parenthesis is separated 
from the number by a space. How can I suppress this unwanted space?
For instance I get (1, 103 ) instead of (1, 103).


Otared,

is there a reason why you don't use context(vecteurY[i]) and 
context(vecteurX[i])? This gets rid of the spurious space for me (and 
makes your code more consistent). But I assume you must have tried it 
because you use the "context" command in other places of your lua code.


Thomas
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread josephcanedo
Hi,

I think you can use tex.write() instead of tex.print() (pretty much the same as 
in lua io functions).
Hope this helps

Joseph

De : Otared Kavian
Envoyé le :dimanche 19 mars 2017 16:31
À : mailing list for ConTeXt users
Objet :[NTG-context] How to use tex.print in ctxlua

Hi,

I would like to print in a text the values of a array computed in a  
\startluacode …. \stopluacode combination.
How can I do it properly? Please have a look at the example below and its 
output, which is not satisfactory because the right parenthesis is separated 
from the number by a space. How can I suppress this unwanted space? 
For instance I get (1, 103 ) instead of (1, 103).

Thanks in advance for any help,
Best regards: OK

%%% begin ctxlua-print.tex
\starttext
\startluacode
n = 6 ;
vecteurX = {} ;
for i = 1,n do
vecteurX[i] = i ;
end
vecteurY = {} ;
for i = 1,n do
vecteurY[i] = 3*vecteurX[i] + 100 ;
end
for i = 1,n do
context("(") 
tex.print(vecteurX[i]) 
context(", ") 
tex.print(vecteurY[i])
tex.print(")")
context.par()
end
\stopluacode
\stoptext
%%% begin ctxlua-print.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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi,

I would like to print in a text the values of a array computed in a  
\startluacode …. \stopluacode combination.
How can I do it properly? Please have a look at the example below and its 
output, which is not satisfactory because the right parenthesis is separated 
from the number by a space. How can I suppress this unwanted space? 
For instance I get (1, 103 ) instead of (1, 103).

Thanks in advance for any help,
Best regards: OK

%%% begin ctxlua-print.tex
\starttext
\startluacode
n = 6 ;
vecteurX = {} ;
for i = 1,n do
vecteurX[i] = i ;
end
vecteurY = {} ;
for i = 1,n do
vecteurY[i] = 3*vecteurX[i] + 100 ;
end
for i = 1,n do
context("(") 
tex.print(vecteurX[i]) 
context(", ") 
tex.print(vecteurY[i])
tex.print(")")
context.par()
end
\stopluacode
\stoptext
%%% begin ctxlua-print.tex



ctxlua-print.pdf
Description: Adobe PDF 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] bug in \definefontfamily? (was: Re: OT salt feature not working?)

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 12:19 PM, josephcan...@gmail.com wrote:
> Hi Pablo,
> 
> When I typeset your MWE below with latest beta version (on win 10) you
> use too, I see 2 lines of 1110 with different appearance.

Hi Joseph,

sorry, the second sample was different. The first line was TeX Gyre
Pagella and the second line was Neo Euler.

The default feature for the whole text was old numbers. TeX Gyre Pagella
works fine with it, but Neo Euler (with \definefontfamily) doesn’t
honour "onum".

But \definefont works fine, so I guess something might be improved in
\definefontfamily. See the sample:

\definefontfeature[default][default][onum=yes]
\definefontfamily[mainface][rm][TeX Gyre Pagella]
\definefontfamily[mainface][hw][Neo Euler]
\definefont[directFont][euler.otf:+onum]
\setupbodyfont[mainface]
\starttext
\startTEXpage[offset=5ex]
1110

{\hw 1110}

\directFont 1110
\stopTEXpage
\stoptext

BTW, Neo Euler has "Neo-Euler" as PostScript name (according to
otfinfo). Maybe this is causing problems to the font loading mechanism.

Wolfgang, what do you think of this issue?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] OT salt feature not working?

2017-03-19 Thread Pablo Rodriguez
On 03/18/2017 11:05 PM, Pablo Rodriguez wrote:
> Dear list,
> 
> I have the following sample:
> [...]
> I get the same results with or without the first line commented out.
> (I’m using latest beta from 2017.03.02 22:23.)
> 
> Is this a bug or what am I missing?

The issue is with the font:

\definefontfeature[default][default][onum=yes]
\definefontfamily[mainface][rm][TeX Gyre Pagella]
\definefontfamily[mainface][hw][Neo Euler]
\setupbodyfont[mainface]
\starttext
\startTEXpage[offset=5ex]
1110

\hw 1110
\stopTEXpage
\stoptext

Just in case it helps, LuaTeX-0.95 from TeX Live 2016 works fine with
both features in this font:

\input ifluatex.sty
\ifluatex\input luaotfload.sty\fi
\font\1="euler.otf:+salt"
\font\2="euler.otf:+onum"
\1 1110\2 1110
\bye

I don’t know why this happens. Could anyone confirm the issue?

Many thanks for your help,

Pablo
-- 
http://www.ousia.tk
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___