Re: [NTG-context] User-Defined Commands With Key-Value Options

2015-07-23 Thread Rik

On 2015-07-22 05:20, Joas Yannick wrote:

On 7/20/2105 11:28 AM Joas Yannick wrote:

  On 7/20/2105 0:50 AM Hans Hagen wrote:
  So how would you like to use lua? Is the data stored in lua?

 Yes, I imagine that the data (for instance, the value of
 the keys number, name, abbreviation, title, etc.)
 is stored somewhere when the compilation process reads, say,
 \startbiblebook, and that they are available to define the
 the formatting done by \startbiblebook.

 Thank you.

I have found this wiki:

http://wiki.contextgarden.net/Commands_with_KeyVal_arguments

But since I do not know Lua, I would appreciate that someone gets me
started with my example.


Joas,

Perhaps there some confusion here about how ConTeXt is used to create a 
document, and what role Lua plays in it. ConTeXt is a macro-based 
language that provides a level of abstraction over TeX, which is also a 
macro language. Documents can be completely specified with the use of 
ConTeXt. Lua is a traditional programming language that is used by some 
versions of ConTeXt to optimize and extend some of the internal 
capabilities of ConTeXt and TeX. There are very few situations, if any, 
in which a document writer /must/ resort to using Lua; ConTeXt almost 
always suffices.


Only the first example you found in the ConTeXt wiki uses Lua, and that 
example is not really useful for your problem. The other examples on 
that page are coded in the ConTeXt macro language.


You might also look at 
http://wiki.contextgarden.net/System_Macros/Handling_Arguments and 
http://wiki.contextgarden.net/Commands_with_optional_arguments for more 
examples, and on the mailing list. I would also recommend looking in the 
mailing list for discussions of the \getrawparameters and \getbufferdata 
and related commands (in particular 
http://www.mail-archive.com/ntg-context%40ntg.nl/msg78808.html).


Here is some code I use to format verse. It provides default values for 
the language, margin inset and continuation line indents that can be 
overridden when needed:


   \starttexdefinition unexpanded startPoem
  \begingroup
  \dosingleempty\dostartPoem
   \stoptexdefinition

   \starttexdefinition dostartPoem [#SETUPS]
   \getrawparameters[Poem][inset=2em,indent=0em,before=,font=,
  language=en,#SETUPS]
  \grabbufferdata[Poem][startPoem][stopPoem]
   \stoptexdefinition

   \starttexdefinition stopPoem
\obeylines
\language[\Poemlanguage]
\Poembefore
\Poemfont
   \setupnarrower[left={\dimexpr\Poemindent+\Poeminset\relax},
   right=\Poeminset,
   before=]
\startnarrower[left,right]
  \startparagraph
  \setupindenting[-\Poemindent,yes]
  \inlinebuffer[Poem]
  \stopparagraph
\stopnarrower
  \endgroup
  \blank[halfline]
   \stoptexdefinition

This type of code can easily be used to deal with the names, numbers, 
and abbreviations you describe in your requirements.


--
Rik Kabel
___
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] can't run external lua library

2015-07-23 Thread DesdeChaves
Luigi, you saved my day. Thanks a lot.  Now all works fine.

2015-07-23 8:30 GMT+01:00 luigi scarso luigi.sca...@gmail.com:



 On Thu, Jul 23, 2015 at 1:37 AM, DesdeChaves desdecha...@gmail.com
 wrote:

 I'm trying to reuse a old library to generate poisson numbers. In old
  context versions the library works fine, but in the current  beta (ConTeXt
  ver: 2015.07.16 13:30 MKIV beta  fmt: 2015.7.23  int: english/english) the
 execution fails.

 This code works perfectly in lua 5.3 but not in luatex. why?

 \startluacode


 require meurandist
 ARRAY_SIZE=3
 arr=meurandist.new_int(ARRAY_SIZE)
 meurandist.rpoisson(arr,ARRAY_SIZE,4)
 for i=0,ARRAY_SIZE-1 do
 print(meurandist.int_getitem(arr,i))
 end


 \stopluacode


 Thanks a lot



 luatex 0.80.1 (the latest luatex) still uses lua 5.2.4

 --
 luigi


 ___
 If your question is of interest to others as well, please add an entry to
 the Wiki!

 maillist : ntg-context@ntg.nl /
 http://www.ntg.nl/mailman/listinfo/ntg-context
 webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
 archive  : http://foundry.supelec.fr/projects/contextrev/
 wiki : http://contextgarden.net

 ___




-- 
Atentamente

DesdeChaves
___
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] Illegal parameter number in definition

2015-07-23 Thread Pablo Rodriguez
On 07/20/2015 11:42 AM, juh wrote:
 [...]
 But for now I am better off with the coontains statement.
 
 \xmlsetsetup{#1}{hi[contains(@rendition, 'in')]}{xml:hi:in}
 
 It matches
 
 hi rendition=#inS/hi
 
 without problems

Hi Jan Urlich,

sorry for the delayed reply. (I’m still dealing with the technical
support from GMX and the banned replies.)

All you have to do is to escape the hash character, one way or another:

\xmlsetsetup{#1}
{hi[@rendition='\letterhash in']}
{xml:rend:in}

\xmlsetsetup{#1}
{hi[contains(@rendition,'\letterhash in')]}
{xml:rend:in

With the first option, the value of rendition must be unique (the TEI P5
Guidelines include examples with multiple rendition values).

With the second option, the value #indian would be also matched.

I hope it helps (and it reaches the list ;-)),


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

Re: [NTG-context] Critical editions with ConTeXt

2015-07-23 Thread Pablo Rodriguez
On 07/22/2015 11:33 PM, tala...@fastmail.fm wrote:
 Dear Pablo,
 
 Thank you very much for what you proposed — it did work indeed. I
 tried to achieve the same at some length this afternoon. I think I
 understand what is going on in the first macro, but wouldn’t have been
 able to arrive at the the second one for \variant, or the counter (and
 still don’t fully understand it). Thanks again.

Dear Talal,

well, both macros come from Hans... I’m afraid I’m not smart enough for
that code ;-).

BTW, I just accidentally discovered a possible fix for the hyphenation
issue (although I’m not sure it is a bug itself).

I will open another thread to discuss that with the experts.


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

[NTG-context] issue with hyphenation in linenotes

2015-07-23 Thread Pablo Rodriguez
Dear list (especially Hans, Thomas or Luigi),

some time ago I reported
(http://www.ntg.nl/pipermail/ntg-context/2013/076021.html) a bug with
not hyphenated code in linenotes.

Now I have an updated sample that seems to fix it:

\setuppapersize[A8]
\starttext
\startlinenumbering
This text shows a \startlinenote[one]{bariant
H} variant \stoplinenote[one].

This text shows a \startlinenote[two]{bariant
H}\prewordbreak variant\stoplinenote[two].

This text shows a \startlinenote[three]{bariant
H}\prewordbreak variant\stoplinenote[three].
\stoplinenumbering
\stoptext

It seems that locating \prewordbreak before the text to be hyphenated
(and not after it) enables hyphenation in body.

Is this a bug or is it actually the way \prewordbreak should work?

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

[NTG-context] can't run external lua library

2015-07-23 Thread DesdeChaves
I'm trying to reuse a old library to generate poisson numbers. In old
 context versions the library works fine, but in the current  beta (ConTeXt
 ver: 2015.07.16 13:30 MKIV beta  fmt: 2015.7.23  int: english/english) the
execution fails.

This code works perfectly in lua 5.3 but not in luatex. why?

\startluacode


require meurandist
ARRAY_SIZE=3
arr=meurandist.new_int(ARRAY_SIZE)
meurandist.rpoisson(arr,ARRAY_SIZE,4)
for i=0,ARRAY_SIZE-1 do
print(meurandist.int_getitem(arr,i))
end


\stopluacode


Thanks a lot

Jorge
___
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] can't run external lua library

2015-07-23 Thread luigi scarso
On Thu, Jul 23, 2015 at 1:37 AM, DesdeChaves desdecha...@gmail.com wrote:

 I'm trying to reuse a old library to generate poisson numbers. In old
  context versions the library works fine, but in the current  beta (ConTeXt
  ver: 2015.07.16 13:30 MKIV beta  fmt: 2015.7.23  int: english/english) the
 execution fails.

 This code works perfectly in lua 5.3 but not in luatex. why?

 \startluacode


 require meurandist
 ARRAY_SIZE=3
 arr=meurandist.new_int(ARRAY_SIZE)
 meurandist.rpoisson(arr,ARRAY_SIZE,4)
 for i=0,ARRAY_SIZE-1 do
 print(meurandist.int_getitem(arr,i))
 end


 \stopluacode


 Thanks a lot



luatex 0.80.1 (the latest luatex) still uses lua 5.2.4

-- 
luigi
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___