Re: [NTG-context] MKIV caption separator, revisited

2014-04-22 Thread Wolfgang Schuster

Am 22.04.2014 um 02:57 schrieb Rik Kabel cont...@rik.users.panix.com:

 Has any progress been made in the past few years implementing modifiable 
 separators for captions under MKIV? This was raised as an issue by (at least) 
 Mojca Miklavec in December 2010 
 (http://www.mail-archive.com/ntg-context%40ntg.nl/msg51542.html) and by Andy 
 Thomas 18 months later 
 (http://www.mail-archive.com/ntg-context%40ntg.nl/msg63937.html). (Their 
 issues with stopper have been resolved. In MKIV it is numberstopper.)
 
 Here is an MWE demonstrating the problem. It compiles cleanly, but the 
 separator remains the default period. With MKII, it generates a figure with a 
 hyphen and not a period.
 \setupcaptions[separator=-]

\setupcaptions[prefixconnector=-]

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

Re: [NTG-context] Attributes

2014-04-22 Thread Hans Hagen

On 4/20/2014 3:14 PM, Stéphane Goujet wrote:

Hello,

   I would like to know what is the recommended way to use attributes in
Context.

   I manage to use use them with numbers, i.e. :
in Context : \attribute123=1
in Lua : has_attribute(my_node, 123)

   But I would like to make that cleaner and use named attributes.
What is the Context way to declare and set attributes? Is it something
like this?
\defineattribute[myattr]
\dosetattribute{myattr}{1}

   And how do I then access them from Lua? Should it look like
has_attribute(mynode, attributes.myattr)
   or
has_attribute(mynode, attributes.x(myattr))
   or something else?


attributes.names[...]
attributes.numbers[...]

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

Re: [NTG-context] passing arguments to \processMPbuffer

2014-04-22 Thread Jeong Dal
Dear Wolfgang,

Thank you for your solution.
Sometimes I need to use \processMPbuffer for the animated graphics.
BTW, what is the differences between ‘MPrawvar’ and ‘MPvar’.
MPvar didn’t work in your example.

Best regards,

Dalyoung
___
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] MKIV caption separator, revisited

2014-04-22 Thread Rik Kabel

On 2014-04-22 02:25, Wolfgang Schuster wrote:


Am 22.04.2014 um 02:57 schrieb Rik Kabel cont...@rik.users.panix.com 
mailto:cont...@rik.users.panix.com:


Has any progress been made in the past few years implementing 
modifiable separators for captions under MKIV? This was raised as an 
issue by (at least) Mojca Miklavec in December 2010 
(http://www.mail-archive.com/ntg-context%40ntg.nl/msg51542.html) and 
by Andy Thomas 18 months later 
(http://www.mail-archive.com/ntg-context%40ntg.nl/msg63937.html 
http://www.mail-archive.com/ntg-context@ntg.nl/msg63937.html). 
(Their issues with stopper have been resolved. In MKIV it is 
numberstopper.)


Here is an MWE demonstrating the problem. It compiles cleanly, but 
the separator remains the default period. With MKII, it generates a 
figure with a hyphen and not a period.


\setupcaptions[separator=-]


\setupcaptions[prefixconnector=-]

Wolfgang



As always, thank you.

I have updated the wiki page for setupcaptions. The updated includes a 
reworded description of the suffix key and new descriptions for the 
stopper/numberstopper and separator/prefixconnector keys.


(There are many other keys that are not documented, and a few at least 
that differ between MKII and MKIV, but I do not have the time at the 
moment to test all of them.)


--
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] Attributes

2014-04-22 Thread Stéphane Goujet

On Tue, 22 Apr 2014, Hans Hagen wrote:


On 4/20/2014 3:14 PM, Stéphane Goujet wrote:

I would like to know what is the recommended way to use attributes in
 Context.
 What is the Context way to declare and set attributes? Is it something
 like this?
 \defineattribute[myattr]
 \dosetattribute{myattr}{1}

And how do I then access them from Lua? Should it look like
 has_attribute(mynode, attributes.myattr)
or
 has_attribute(mynode, attributes.x(myattr))
or something else?


attributes.names[...]
attributes.numbers[...]


  Please have a look at my example (it is a bit long because it shows 
various possibilities) and its result.

   When I have not yet done a \defineattribute[myattr], node.has_attribute
returns 0 when I thought it should return nil.
  When I do \defineattribute[...], every attribute seems to get the same 
number (1024), but now node.has_attribute returns nil ...


=
Example
=
\starttext

\startluacode
mycallback=function(head)
if attributes.names==nil then
print No attribute names at all
end
if attributes.numbers==nil then
print No attribute numbers at all
end
for mynode in node.traverse_id(node.id(glyph), head) do
			if string.match(0ABCDEabcdefg, 
unicode.utf8.char(mynode.char)) then
print (Glyph = 
..unicode.utf8.char(mynode.char))

if attributes.numbers[myattr]==nil then
	print No attribute number for 
myattr

else
	print (myattr : number = 
..(attributes.numbers[myattr]))

end
if attributes.numbers[myattrb]==nil then
	print No attribute number for 
myattrb

else
	print (myattrb : number = 
..(attributes.numbers[myattrb]))

end
if node.has_attribute(mynode, 
attributes.numbers[myattr]) then
	print (Attribute myattr = 
..(node.has_attribute(mynode, attributes.numbers[myattr])))

else
print No attribute myattr
end
if node.has_attribute(mynode, 
attributes.numbers[myattrb]) then
	print (Attribute myattrb = 
..(node.has_attribute(mynode, attributes.numbers[myattrb])))

else
print No attribute myattrb
end
if node.has_attribute(mynode, 111) then
	print (Attribute 111 = 
..(node.has_attribute(mynode, 111)))

else
print No attribute 111
end
end
end
return head
end

nodes.tasks.appendaction(processors, before, mycallback)
\stopluacode

0

\attribute111=-1
A

\attribute111=200
B

\attribute111=202
C

\attribute111=-1
D

\attribute111=-7FFF
E

\defineattribute[myattr]
\defineattribute[myattrb]
a

\doresetattribute{myattr}
b

\dosetattribute{myattr}{500}
c

\dosetattribute{myattr}{502}
d

\doresetattribute{myattr}
e


\stoptext
==


==
Result :
==
Glyph = 0
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
No attribute 111
Glyph = A
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
Attribute 111 = -1
Glyph = B
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
Attribute 111 = 200
Glyph = C
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
Attribute 111 = 202
Glyph = D
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
Attribute 111 = -1
Glyph = E
No attribute number for myattr
No attribute number for myattrb
Attribute myattr = 0
Attribute myattrb = 0
No attribute 111
Glyph = a
myattr : number = 1024
myattrb : number = 1024
No attribute myattr
No attribute myattrb
No attribute 111
Glyph = b
myattr : number = 1024
myattrb : number = 1024
No attribute myattr
No attribute myattrb
No attribute 111
Glyph = c
myattr : number = 1024
myattrb : number = 1024
No attribute myattr
No attribute myattrb
No attribute 111
Glyph = d
myattr : number = 1024
myattrb : number = 1024
No attribute myattr
No attribute myattrb
No attribute 111
Glyph = e
myattr : number = 1024
myattrb : number = 1024
No attribute myattr
No attribute myattrb
No attribute 111
==

Goodbye,
  Stéphane.___
If your question is of interest to others as well, please add an entry 

Re: [NTG-context] passing arguments to \processMPbuffer

2014-04-22 Thread Wolfgang Schuster

Am 22.04.2014 um 14:42 schrieb Jeong Dal hak...@me.com:

 Dear Wolfgang,
 
 Thank you for your solution.
 Sometimes I need to use \processMPbuffer for the animated graphics.
 BTW, what is the differences between ‘MPrawvar’ and ‘MPvar’.
 MPvar didn’t work in your example.

The \Mprawvar command takes two argument, the first takes the same name
which you have used for the \setupMPvariables command and the second
argument is the names of the key.

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

[NTG-context] A couple of setupcaptions questions revisited

2014-04-22 Thread Rik Kabel
On 2011-08-05, Wolfgang wrote with regard to section numbering not 
appearing in float captions when numbering is off for the section but 
called for by the chapter 
(http://www.mail-archive.com/ntg-context%40ntg.nl/msg57811.html):


   For the moment replace number=no with incrementnumber=no.


and later that day 
(http://www.mail-archive.com/ntg-context%40ntg.nl/msg57814.html):


   There is a bug but it takes time to find it, unless it is found and
   fixed use incrementnumber.

   BTW: A *minimal* example your problem is **this**:

   \setupformulas[way=bysection,prefixsegments=chapter]
   %\setuphead[subsection][number=no]
   \setuphead[subsection][incrementnumber=no] \starttext
   \chapter{Chapter 1} \chapter{Chapter 2} \section{Section}
   \subsection{Subsection} \placeformula \startformula a^2+b^2=c^2
   \stopformula \stoptext

This bug appears to still be with us. Has a solution since been 
proffered? If not, is a resolution in sight?


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