Re: [NTG-context] embeddedxtable

2015-05-25 Thread Meer, H. van der

On 24 May 2015, at 22:53, Wolfgang Schuster 
schuster.wolfg...@gmail.commailto:schuster.wolfg...@gmail.com wrote:


The spaces in the output are produced by the spaces between the tags (\xmlstrip 
doesn’t seem to work)
and you have to use a combination of \removeunwantedspaces and \ignorespaces to 
remove them.


It is a pity if \xmlstrip does not work. It is of course fairly essential that 
the whitespace between the tags can be ignored. I sincerely hope this will be 
looked into. Or could this be a special effect related to either the use of a 
buffer as source or to the embeddedxtable structure?

However, it doesn't seem the whole story. I removed all whitespace between the 
tags and the \unskip's from the code. In the result below you can see that 
removing the whitespace between the tags removes most of the spurious spaces, 
but not all of them. Another picture has the = embedded before the \xmlflush in 
\startrow and shows that still spurious space is injected. To me it looks if 
every row gets an extra space: three of them before the table and the last one 
after the table (but here I am guessing).

Hans van der Meer

[cid:23AE90F4-C415-4635-B1CD-E8E10E65B791]

[cid:EBC94BBA-8505-47C8-B5D3-20329BC1E06E]

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

2015-05-25 Thread Meer, H. van der

 On 24 May 2015, at 22:53, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:


 Am 24.05.2015 um 21:33 schrieb Meer, H. van der h.vanderm...@uva.nl:

 In this case you have to provide a working minimal example.

 Wolfgang

 Here an example as minimal as I could construct.

 The spaces in the output are produced by the spaces between the tags 
 (\xmlstrip doesn’t seem to work)
 and you have to use a combination of \removeunwantedspaces and \ignorespaces 
 to remove them.

 To center your table this isn’t necessary when you replace \midaligned with a 
 framedtext
 environment in combination with “location=middle” or use a float command like 
 \placefigure.


 \startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{table|tr|td}{xmlcommon:*}
 \stopxmlsetups

 \xmlregistersetup{xmlcommon}

 \startxmlsetups xmlcommon:table
 % \removeunwantedspaces
\startembeddedxtable
\xmlflush{#1}
\stopembeddedxtable
 % \ignorespaces
 \stopxmlsetups

 \startxmlsetups xmlcommon:tr
 % \removeunwantedspaces
\startxrow
\xmlflush{#1}
\stopxrow
 % \ignorespaces
 \stopxmlsetups

 \startxmlsetups xmlcommon:td
 % \removeunwantedspaces
\startxcell
\xmlflush{#1}
\stopxcell
 % \ignorespaces
 \stopxmlsetups


Input from file or from buffer doesn't make a difference.
I inserted the \removeunwantedspaces and \ignorespaces, as you suggested. The 
xmlstrip macros do not make any difference, either active or commented out. 
Then there still remains extra space at the end. See below.









xtablespace.pdf
Description: xtablespace.pdf
___
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] embeddedxtable

2015-05-25 Thread Meer, H. van der


On 24 May 2015, at 22:53, Wolfgang Schuster 
schuster.wolfg...@gmail.commailto:schuster.wolfg...@gmail.com wrote:


The spaces in the output are produced by the spaces between the tags (\xmlstrip 
doesn’t seem to work)
and you have to use a combination of \removeunwantedspaces and \ignorespaces to 
remove them.



There is something I do not understand and I hope you can explain this. The 
table is typeset by the \xmlflush{#1} in the table macro:

\startxmlsetups xmlcommon:table
Z\bgroup
\setupxtable[% Setup defaults
leftmargindistance=0pt,rightmargindistance=0pt,
offset=2pt,height=fit,width=fit,
align={center,lohi},columndistance=0pt]
\setupxtableparameters{#1}
\startlocationbox{#1}
\removeunwantedspaces
\startembeddedxtable X\xmlflush{#1}Y\stopembeddedxtable
\ignorespaces
\stoplocationbox
\egroup
\stopxmlsetups

The X and Y  have been placed around the \xmlflush to see what happens. Why 
do I see them 3 times? It looks as if  the embeddedxtable-line is called 3 
times (or maybe 4 times once for each row with the last call vanishing). 
However, the table macro itself is called only once, the Z at the beginning 
proves that. I cannot explain this.

Another observation: inserting a newline after the ?xml-tag also does insert 
a space just before the Z.

Hans van der Meer





xtablespace.pdf
Description: xtablespace.pdf
___
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] embeddedxtable

2015-05-25 Thread Wolfgang Schuster

 Am 25.05.2015 um 11:26 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 
 
 On 24 May 2015, at 22:53, Wolfgang Schuster schuster.wolfg...@gmail.com 
 mailto:schuster.wolfg...@gmail.com wrote:
 
 
 The spaces in the output are produced by the spaces between the tags 
 (\xmlstrip doesn’t seem to work)
 and you have to use a combination of \removeunwantedspaces and \ignorespaces 
 to remove them.
 
 
 
 There is something I do not understand and I hope you can explain this. The 
 table is typeset by the \xmlflush{#1} in the table macro:
 
 \startxmlsetups xmlcommon:table
 Z\bgroup
 \setupxtable[% Setup defaults
 leftmargindistance=0pt,rightmargindistance=0pt,
 offset=2pt,height=fit,width=fit,
 align={center,lohi},columndistance=0pt]
 \setupxtableparameters{#1}
 \startlocationbox{#1}
 \removeunwantedspaces
 \startembeddedxtable X\xmlflush{#1}Y\stopembeddedxtable
 \ignorespaces
 \stoplocationbox
 \egroup
 \stopxmlsetups
 
 The X and Y  have been placed around the \xmlflush to see what happens. 
 Why do I see them 3 times? It looks as if  the embeddedxtable-line is called 
 3 times (or maybe 4 times once for each row with the last call vanishing). 
 However, the table macro itself is called only once, the Z at the beginning 
 proves that. I cannot explain this. 

This is normal and needed for the calculation of the cell widths and heights.

This mechanism is called trial typesetting and used by a few mechanism (e.g. 
float captions) to get the dimensions of the content.

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

2015-05-25 Thread Wolfgang Schuster

 Am 25.05.2015 um 12:08 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 
 On 24 May 2015, at 22:53, Wolfgang Schuster schuster.wolfg...@gmail.com 
 mailto:schuster.wolfg...@gmail.com wrote:
 
 
 Am 24.05.2015 um 21:33 schrieb Meer, H. van der h.vanderm...@uva.nl 
 mailto:h.vanderm...@uva.nl:
 
 Here an example as minimal as I could construct.
 
 The spaces in the output are produced by the spaces between the tags 
 (\xmlstrip doesn’t seem to work)
 and you have to use a combination of \removeunwantedspaces and \ignorespaces 
 to remove them.
 
 To center your table this isn’t necessary when you replace \midaligned with 
 a framedtext
 environment in combination with “location=middle” or use a float command 
 like \placefigure.
 
 
 I think I can reduce the number of places where spaces have to be suppressed. 
 With just 2 \removeunwantedspaces and 1 \ignorespaces I get rid of most of 
 them. The \framed[offset=0pt] shows where spurious space is still inserted.
 
 Only 1 space remains inside the framed: in the vertical dimension below the 
 table. Any idea where this comes from? Some parameter to change in the 
 \framerd perhaps?

It’s impossible to tell what’s wrong with our code snippets, you have to create 
working minimal examples.

The following example shows where you have to take care of extra space and you 
don’t need them when you put the whole table in a \vbox (you can test by 
commenting all \ignorespaces and \removeunwantedspaces commands and replacing 
\ruledhbox with \ruledvbox).

\startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{table|tbody|tr|td}{xmlcommon:*}
\stopxmlsetups

\xmlregistersetup{xmlcommon}

\startxmlsetups xmlcommon:table
%   \removeunwantedspaces
\startembeddedxtable
\xmlflush{#1}
\stopembeddedxtable
\ignorespaces
\stopxmlsetups

\startxmlsetups xmlcommon:tbody
%   \removeunwantedspaces
\startxtablebody
\xmlflush{#1}
\stopxtablebody
\ignorespaces
\stopxmlsetups

\startxmlsetups xmlcommon:tr
%   \removeunwantedspaces
\startxrow
\xmlflush{#1}
\stopxrow
\ignorespaces
\stopxmlsetups

\startxmlsetups xmlcommon:td
\removeunwantedspaces
\startxcell
\xmlflush{#1}
\stopxcell
\ignorespaces
\stopxmlsetups

\starttext

\startbuffer[table]
?xml version=1.0 encoding=UTF-8?
root
table
tbody
tr
tdA/td
tdB/td
/tr
tr
tdC/td
tdD/td
/tr
/tbody
/table
/root
\stopbuffer

\ruledhbox{\xmlprocessbuffer{root}{table}{}}

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

Re: [NTG-context] embeddedxtable

2015-05-25 Thread Wolfgang Schuster

 Am 25.05.2015 um 10:35 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 
 On 24 May 2015, at 22:53, Wolfgang Schuster schuster.wolfg...@gmail.com 
 mailto:schuster.wolfg...@gmail.com wrote:
 
 
 The spaces in the output are produced by the spaces between the tags 
 (\xmlstrip doesn’t seem to work)
 and you have to use a combination of \removeunwantedspaces and \ignorespaces 
 to remove them.
 
 
 It is a pity if \xmlstrip does not work. It is of course fairly essential 
 that the whitespace between the tags can be ignored. I sincerely hope this 
 will be looked into. Or could this be a special effect related to either the 
 use of a buffer as source or to the embeddedxtable structure?
 
 However, it doesn't seem the whole story. I removed all whitespace between 
 the tags and the \unskip's from the code. In the result below you can see 
 that removing the whitespace between the tags removes most of the spurious 
 spaces, but not all of them. Another picture has the = embedded before the 
 \xmlflush in \startrow and shows that still spurious space is injected. To me 
 it looks if every row gets an extra space: three of them before the table and 
 the last one after the table (but here I am guessing).

I removed the “tbody” tag from my example which adds another space.

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

2015-05-25 Thread Meer, H. van der

On 24 May 2015, at 22:53, Wolfgang Schuster 
schuster.wolfg...@gmail.commailto:schuster.wolfg...@gmail.com wrote:


Am 24.05.2015 um 21:33 schrieb Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl:

Here an example as minimal as I could construct.

The spaces in the output are produced by the spaces between the tags (\xmlstrip 
doesn’t seem to work)
and you have to use a combination of \removeunwantedspaces and \ignorespaces to 
remove them.

To center your table this isn’t necessary when you replace \midaligned with a 
framedtext
environment in combination with “location=middle” or use a float command like 
\placefigure.


I think I can reduce the number of places where spaces have to be suppressed. 
With just 2 \removeunwantedspaces and 1 \ignorespaces I get rid of most of 
them. The \framed[offset=0pt] shows where spurious space is still inserted.

Only 1 space remains inside the framed: in the vertical dimension below the 
table. Any idea where this comes from? Some parameter to change in the \framerd 
perhaps?

Of course I would be happier if none of these space-suppressing is necessary in 
my code, because ConTeXt takes care of them.

Hans van der Meer

\startxmlsetups xmlcommon:table
\bgroup
\setupxtable[% Setup defaults
leftmargindistance=0pt,rightmargindistance=0pt,
offset=2pt,height=fit,width=fit,
align={center,lohi},columndistance=0pt]
\setupxtableparameters{#1}
\startlocationbox{#1}
\startembeddedxtable
\xmlflush{#1}
\removeunwantedspaces
\stopembeddedxtable
\stoplocationbox
\egroup
\ignorespaces
\stopxmlsetups
\startxmlsetups xmlcommon:tr
\bgroup
\setupxtableparameters{#1}
\removeunwantedspaces
\startxrow
\xmlflush{#1}
\stopxrow
\egroup
\stopxmlsetups






xtablespace.pdf
Description: xtablespace.pdf
___
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] embeddedxtable

2015-05-25 Thread Meer, H. van der

 On 25 May 2015, at 13:05, Wolfgang Schuster schuster.wolfg...@gmail.com 
 wrote:
 
 The following example shows where you have to take care of extra space and 
 you don’t need them when you put the whole table in a \vbox (you can test by 
 commenting all \ignorespaces and \removeunwantedspaces commands and replacing 
 \ruledhbox with \ruledvbox).
 

Thanks for the suggestion of the \ruledvbox. This shows that the remaining 
whitespace originates in the \framed and not in the table code.

Hans van der Meer

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

2015-05-24 Thread Meer, H. van der
When typesetting inside a \midaligned a version with markers around:

  A\startembeddedxtable\xmlflush{#1}\stopembeddedxtable B

then the A and B show up centered and have the width of the table material 
between them.
The embeddedxtable stuff is placed outside that range starting at the location 
of the B.
A sketch of what happens:

A   space of tablewidth   Btable starts here extending to the right

Definitely something with embeddedxtable placement, I might guess. Some 
unwanted spaces in the code perhaps?


Hans van der Meer


On 24 May 2015, at 12:18, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

With the construct
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
placed inside a
\midaligned
I used to get a neatly centered content. But now the material is shifted to the 
right, even sticking out of the page.

Has something changed in the embeddedxtable alignment handling since the end of 
2013?


(The embeddedxtable macro was needed because the typeset material exists inside 
\startbuffer..\stopbuffer.)

Hans van der Meer




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

maillist : ntg-context@ntg.nlmailto: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
___

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

2015-05-24 Thread Meer, H. van der
Further experimenting with different ConTeXt versions:

Trying earlier and latest beta, placing the embeddedxtable inside \midaligned:

version 2014.11.26 puts the embbedxtable to the right over distance 
width-of-table.

version 2015.03.25 and version 2015.05.23 put the left side of the 
embeddedxtable in the middle of the page.
Something changed between these two versions. But clearly not enough.

Hans van der Meer




On 24 May 2015, at 12:36, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

When typesetting inside a \midaligned a version with markers around:

  A\startembeddedxtable\xmlflush{#1}\stopembeddedxtable B

then the A and B show up centered and have the width of the table material 
between them.
The embeddedxtable stuff is placed outside that range starting at the location 
of the B.
A sketch of what happens:

A   space of tablewidth   Btable starts here extending to the right

Definitely something with embeddedxtable placement, I might guess. Some 
unwanted spaces in the code perhaps?


Hans van der Meer


On 24 May 2015, at 12:18, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

With the construct
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
placed inside a
\midaligned
I used to get a neatly centered content. But now the material is shifted to the 
right, even sticking out of the page.

Has something changed in the embeddedxtable alignment handling since the end of 
2013?


(The embeddedxtable macro was needed because the typeset material exists inside 
\startbuffer..\stopbuffer.)

Hans van der Meer




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

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

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

maillist : ntg-context@ntg.nlmailto: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
___

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

2015-05-24 Thread Meer, H. van der
Here can be seen how every row adds space before the table. I.e. spaces are 
added and after that the table is put behind. This behaviour was not present 
when I had the material typeset earlier. The xmlsetup's used were not changed 
since then.

\startxmlsetups xmlcommon:tr
\xmlstripanywhere{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxrow
X\xmlflush{#1}
\stopxrow
\egroup
\stopxmlsetups

Hans van der Meer

[cid:723DA497-86EF-4142-A951-D70FD92D5104]


On 24 May 2015, at 13:49, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

Further experimenting with different ConTeXt versions:

Trying earlier and latest beta, placing the embeddedxtable inside \midaligned:

version 2014.11.26 puts the embbedxtable to the right over distance 
width-of-table.

version 2015.03.25 and version 2015.05.23 put the left side of the 
embeddedxtable in the middle of the page.
Something changed between these two versions. But clearly not enough.

Hans van der Meer




On 24 May 2015, at 12:36, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

When typesetting inside a \midaligned a version with markers around:

  A\startembeddedxtable\xmlflush{#1}\stopembeddedxtable B

then the A and B show up centered and have the width of the table material 
between them.
The embeddedxtable stuff is placed outside that range starting at the location 
of the B.
A sketch of what happens:

A   space of tablewidth   Btable starts here extending to the right

Definitely something with embeddedxtable placement, I might guess. Some 
unwanted spaces in the code perhaps?


Hans van der Meer


On 24 May 2015, at 12:18, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

With the construct
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
placed inside a
\midaligned
I used to get a neatly centered content. But now the material is shifted to the 
right, even sticking out of the page.

Has something changed in the embeddedxtable alignment handling since the end of 
2013?


(The embeddedxtable macro was needed because the typeset material exists inside 
\startbuffer..\stopbuffer.)

Hans van der Meer




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

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

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

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

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

maillist : ntg-context@ntg.nlmailto: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
___

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

2015-05-24 Thread Meer, H. van der
I can get rid of the unwanted spaces before the table by inserting a whole 
bunch of \unskip's in my code. All the \unskip's in the following code are 
necessary. I guess this observation will be enough to repair the ConText code. 
Or do I have to change something in my code?

\startxmlsetups xmlcommon:tr
\unskip
\xmlstripanywhere{#1}{.}
\unskip
\bgroup
\unskip
\setupxtableparameters{#1}
\unskip
\startxrow
\unskip\xmlflush{#1}
\stopxrow
\egroup
\unskip
\stopxmlsetups

\startxmlsetups xmlcommon:td
\unskip
\xmlstrip{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
\xmlflush{#1}
\stopxcell
\egroup
\stopxmlsetups

Hans van der Meer




On 24 May 2015, at 15:06, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

Here can be seen how every row adds space before the table. I.e. spaces are 
added and after that the table is put behind. This behaviour was not present 
when I had the material typeset earlier. The xmlsetup's used were not changed 
since then.

\startxmlsetups xmlcommon:tr
\xmlstripanywhere{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxrow
X\xmlflush{#1}
\stopxrow
\egroup
\stopxmlsetups

Hans van der Meer




On 24 May 2015, at 13:49, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

Further experimenting with different ConTeXt versions:

Trying earlier and latest beta, placing the embeddedxtable inside \midaligned:

version 2014.11.26 puts the embbedxtable to the right over distance 
width-of-table.

version 2015.03.25 and version 2015.05.23 put the left side of the 
embeddedxtable in the middle of the page.
Something changed between these two versions. But clearly not enough.

Hans van der Meer




On 24 May 2015, at 12:36, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

When typesetting inside a \midaligned a version with markers around:

  A\startembeddedxtable\xmlflush{#1}\stopembeddedxtable B

then the A and B show up centered and have the width of the table material 
between them.
The embeddedxtable stuff is placed outside that range starting at the location 
of the B.
A sketch of what happens:

A   space of tablewidth   Btable starts here extending to the right

Definitely something with embeddedxtable placement, I might guess. Some 
unwanted spaces in the code perhaps?


Hans van der Meer


On 24 May 2015, at 12:18, Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl wrote:

With the construct
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
placed inside a
\midaligned
I used to get a neatly centered content. But now the material is shifted to the 
right, even sticking out of the page.

Has something changed in the embeddedxtable alignment handling since the end of 
2013?


(The embeddedxtable macro was needed because the typeset material exists inside 
\startbuffer..\stopbuffer.)

Hans van der Meer




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

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

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

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

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

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

row-adds-space.tiff___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nlmailto:ntg-context@ntg.nl / 
http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : 

Re: [NTG-context] embeddedxtable

2015-05-24 Thread Wolfgang Schuster

 Am 24.05.2015 um 18:01 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 Defined as follows:
 
 \def\setupxtableparameters#1{% #1 is the node
 \setupframeparameters{#1}{\setupxtable}%
 \setupToAttribute{#1}{\setupxtable}{foregroundstyle}{style}{style}{\tf}%
 \setupToAttribute{#1}{\setupxtable}{offset}{cellpadding}{}{0pt}%
 \setupToAttribute{#1}{\setupxtable}{columndistance}{cellspacing}{}{0pt}%
 \setupToAttribute{#1}{\setupxtable}{spaceinbetween}{rowspacing}{}{0pt}%
 \setupToAttribute{#1}{\setupxtable}{option}{option}{}{}%
 }
 \def\setupframeparameters#1#2{%
 % color
 % Always set background to color if backgroundcolor is set.
 \doifnot{\xmlatt{#1}{bgcolor}}{\empty}{#2[background=color]}%
 % But it can be overridden.
 \doifnot{\xmlatt{#1}{background}}{\empty}{#2[background=\xmlatt{#1}{background}]}%
 \setupToAttribute{#1}{#2}{foregroundcolor}{color}{}{darkblue}%
 \setupToAttribute{#1}{#2}{backgroundcolor}{bgcolor}{}{green}%
 % frame
 \doifnot{\xmlatt{#1}{frame}}{\empty}%
 {#2[frame=off]\setframeparts{\xmlatt{#1}{frame}}{#2}}%
 \setupToAttribute{#1}{#2}{framecolor}{framecolor}{}{black}%
 \setupToAttribute{#1}{#2}{corner}{corner}{}{rectangular}%
 \setupToAttribute{#1}{#2}{radius}{radius}{}{0.5ex}%
 \setupToAttribute{#1}{#2}{backgroundcorner}{bgcorner}{}{rectangular}%
 \setupToAttribute{#1}{#2}{backgroundradius}{bgradius}{}{0.5ex}%
 % dimensions
 \setupToAttribute{#1}{#2}{rulethickness}{rulethickness}{}{3pt}%
 \doifnot{\xmlatt{#1}{height}}{\empty}%
 {#2[height=\NumberCollect{\xmlattdef{#1}{height}{fit},\the\makeupheight}]}%
 \doifnot{\xmlatt{#1}{width}}{\empty}%
 {#2[width=\NumberCollect{\xmlattdef{#1}{width}{fit},\the\textwidth}]}%
 % alignment
 \setupToAttribute{#1}{#2}{strut}{strut}{}{on}%
 \setupToAttribute{#1}{#2}{align}{align}{html}{normal}%
 \setupToAttribute{#1}{#2}{align}{valign}{html}{lohi}%
 }
 % Setup parameter to attribute.
 % #1 = node, #2 = setup, #3 = param, #4 = attrib, #5 = category, #6 = default.
 \def\setupToAttribute#1#2#3#4#5#6{%
 % Only executed if attribute is present.
 \doifexistattribute{#1}{#4}%
 % Attribute is present but category can be empty.
 {\doifelse{#5}{\empty}%
 {\doifelse{\xmlatt{#1}{#4}}{\empty}%
 {#2[#3=#6]}% attribute present but empty then take default
 {#2[#3=\xmlatt{#1}{#4}]}% attribute has content
 }%
 {#2[#3=\xlat{#1}{#5}{#4}{#6}]}% translate from category
 }%
 }

In this case you have to provide a working minimal example.

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

2015-05-24 Thread Meer, H. van der
In this case you have to provide a working minimal example.

Wolfgang

Here an example as minimal as I could construct.
Hans van der Meer

The following example outputs show what happens with and without the \unskip's 
in the code.
[cid:E7DC008D-E8CB-4F0A-BC45-9E8E4969C8DB]
[cid:8A14737A-52AE-4B90-A03B-FA36FFF321E0]

Also I am adding two other examples made by the same code, one in 2012 and one 
just now. Note the extensions to the right of each row. They are absent in the 
older version.

[cid:1110D708-ADD3-46B8-A49B-143200704DA7][cid:539F8473-CC40-4CDB-AFC6-48AF306DD3F5]
The example code follows here:

% Switching on attribute being present (even if empty) or absent.
\def\doifexistattribute#1#2{\doifnot{\xmlattdef{#1}{#2}{__NOT__}}{__NOT__}}%{#3}
% Translate attribute: #1 = node, #2 = category #3 = attribute #4 = default 
value.
\def\xlat#1#2#3#4{\xmlvalue{#2}{\xmlatt{#1}{#3}}{#4}}
% Setup parameter to attribute.
% #1 = node, #2 = setup, #3 = param, #4 = attrib, #5 = category, #6 = default.
\def\setupToAttribute#1#2#3#4#5#6{%
% Only executed if attribute is present.
\doifexistattribute{#1}{#4}%
% Attribute is present but category can be empty.
{\doifelse{#5}{\empty}%
{\doifelse{\xmlatt{#1}{#4}}{\empty}%
{#2[#3=#6]}% attribute present but empty then take default
{#2[#3=\xmlatt{#1}{#4}]}% attribute has content
}%
{#2[#3=\xlat{#1}{#5}{#4}{#6}]}% translate from category
}%
}
% Setup flag (an TeX-if) from attribute values on,off,no,yes,true,false.
% #1=node #2=flag: execute \attributetrue or \attributefalse
\def\setFlagToAttribute#1#2{%
\doifexistattribute{#1}{#2}%
{%
\doifinset{\xmlatt{#1}{#2}}{on,yes,true}{\csname#2true\endcsname}%
\doifinset{\xmlatt{#1}{#2}}{off,no,false}{\csname#2false\endcsname}%
}%
}
\startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{error|store|restore|include
|table|tr|td|tbody
}{xmlcommon:*}
\stopxmlsetups
\xmlregistersetup{xmlcommon}
% Place at top/middle(default)/bottom location.
\def\startlocationbox#1{%
\let\templocation\relax
\doif{\xmlatt{#1}{location}}{top}{\def\templocation{\vtop}}%
\doif{\xmlatt{#1}{location}}{middle}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{center}{\def\templocation{\vcenter}}%
\doif{\xmlatt{#1}{location}}{bottom}{\def\templocation{\vbox}}%
\templocation\bgroup\ifx\templocation\relax\else\vss\fi
}
\let\stoplocationbox\egroup
\def\setupframeparameters#1#2{%
% color
% Always set background to color if backgroundcolor is set.
\doifnot{\xmlatt{#1}{bgcolor}}{\empty}{#2[background=color]}%
% But it can be overridden.
\doifnot{\xmlatt{#1}{background}}{\empty}{#2[background=\xmlatt{#1}{background}]}%
\setupToAttribute{#1}{#2}{foregroundcolor}{color}{}{darkblue}%
\setupToAttribute{#1}{#2}{backgroundcolor}{bgcolor}{}{green}%
% frame
\doifnot{\xmlatt{#1}{frame}}{\empty}%
{#2[frame=off]\setframeparts{\xmlatt{#1}{frame}}{#2}}%
\setupToAttribute{#1}{#2}{framecolor}{framecolor}{}{black}%
\setupToAttribute{#1}{#2}{corner}{corner}{}{rectangular}%
\setupToAttribute{#1}{#2}{radius}{radius}{}{0.5ex}%
\setupToAttribute{#1}{#2}{backgroundcorner}{bgcorner}{}{rectangular}%
\setupToAttribute{#1}{#2}{backgroundradius}{bgradius}{}{0.5ex}%
% dimensions
\setupToAttribute{#1}{#2}{rulethickness}{rulethickness}{}{3pt}%
\doifnot{\xmlatt{#1}{height}}{\empty}%
{#2[height=\NumberCollect{\xmlattdef{#1}{height}{fit},\the\makeupheight}]}%
\doifnot{\xmlatt{#1}{width}}{\empty}%
{#2[width=\NumberCollect{\xmlattdef{#1}{width}{fit},\the\textwidth}]}%
% alignment
\setupToAttribute{#1}{#2}{strut}{strut}{}{on}%
\setupToAttribute{#1}{#2}{align}{align}{html}{normal}%
\setupToAttribute{#1}{#2}{align}{valign}{html}{lohi}%
}
% Setups for tables with xtable.
\def\setupxtableparameters#1{%
\setupframeparameters{#1}{\setupxtable}%
\setupToAttribute{#1}{\setupxtable}{foregroundstyle}{style}{style}{\tf}%
\setupToAttribute{#1}{\setupxtable}{offset}{cellpadding}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{columndistance}{cellspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{spaceinbetween}{rowspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{option}{option}{}{}%
}
\startxmlsetups xmlcommon:table
\bgroup
\xmlstripanywhere{#1}{.}
\setupxtable[% Setup defaults
leftmargindistance=0pt,rightmargindistance=0pt,
offset=2pt,height=fit,width=fit,
align={center,lohi},columndistance=0pt]
\setupxtableparameters{#1}
\startlocationbox{#1}
\startembeddedxtable\xmlflush{#1}\stopembeddedxtable
\stoplocationbox
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tbody
\xmlstripanywhere{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxtablebody
\xmlflush{#1}
\stopxtablebody
\egroup
\stopxmlsetups
\startxmlsetups xmlcommon:tr
\unskip
\xmlstripanywhere{#1}{.}
\unskip
\bgroup
\unskip
\setupxtableparameters{#1}
\unskip
\startxrow
\unskip
=\xmlflush{#1}
\stopxrow
\egroup
\unskip
\stopxmlsetups

\startxmlsetups xmlcommon:td
\unskip
\xmlstrip{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
\xmlflush{#1}
\stopxcell
\egroup
\stopxmlsetups

\starttext

Re: [NTG-context] embeddedxtable

2015-05-24 Thread Meer, H. van der
Defined as follows:

\def\setupxtableparameters#1{% #1 is the node
\setupframeparameters{#1}{\setupxtable}%
\setupToAttribute{#1}{\setupxtable}{foregroundstyle}{style}{style}{\tf}%
\setupToAttribute{#1}{\setupxtable}{offset}{cellpadding}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{columndistance}{cellspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{spaceinbetween}{rowspacing}{}{0pt}%
\setupToAttribute{#1}{\setupxtable}{option}{option}{}{}%
}
\def\setupframeparameters#1#2{%
% color
% Always set background to color if backgroundcolor is set.
\doifnot{\xmlatt{#1}{bgcolor}}{\empty}{#2[background=color]}%
% But it can be overridden.
\doifnot{\xmlatt{#1}{background}}{\empty}{#2[background=\xmlatt{#1}{background}]}%
\setupToAttribute{#1}{#2}{foregroundcolor}{color}{}{darkblue}%
\setupToAttribute{#1}{#2}{backgroundcolor}{bgcolor}{}{green}%
% frame
\doifnot{\xmlatt{#1}{frame}}{\empty}%
{#2[frame=off]\setframeparts{\xmlatt{#1}{frame}}{#2}}%
\setupToAttribute{#1}{#2}{framecolor}{framecolor}{}{black}%
\setupToAttribute{#1}{#2}{corner}{corner}{}{rectangular}%
\setupToAttribute{#1}{#2}{radius}{radius}{}{0.5ex}%
\setupToAttribute{#1}{#2}{backgroundcorner}{bgcorner}{}{rectangular}%
\setupToAttribute{#1}{#2}{backgroundradius}{bgradius}{}{0.5ex}%
% dimensions
\setupToAttribute{#1}{#2}{rulethickness}{rulethickness}{}{3pt}%
\doifnot{\xmlatt{#1}{height}}{\empty}%
{#2[height=\NumberCollect{\xmlattdef{#1}{height}{fit},\the\makeupheight}]}%
\doifnot{\xmlatt{#1}{width}}{\empty}%
{#2[width=\NumberCollect{\xmlattdef{#1}{width}{fit},\the\textwidth}]}%
% alignment
\setupToAttribute{#1}{#2}{strut}{strut}{}{on}%
\setupToAttribute{#1}{#2}{align}{align}{html}{normal}%
\setupToAttribute{#1}{#2}{align}{valign}{html}{lohi}%
}
% Setup parameter to attribute.
% #1 = node, #2 = setup, #3 = param, #4 = attrib, #5 = category, #6 = default.
\def\setupToAttribute#1#2#3#4#5#6{%
% Only executed if attribute is present.
\doifexistattribute{#1}{#4}%
% Attribute is present but category can be empty.
{\doifelse{#5}{\empty}%
{\doifelse{\xmlatt{#1}{#4}}{\empty}%
{#2[#3=#6]}% attribute present but empty then take default
{#2[#3=\xmlatt{#1}{#4}]}% attribute has content
}%
{#2[#3=\xlat{#1}{#5}{#4}{#6}]}% translate from category
}%
}

Hans van der Meer




On 24 May 2015, at 17:31, Wolfgang Schuster 
schuster.wolfg...@gmail.commailto:schuster.wolfg...@gmail.com wrote:


Am 24.05.2015 um 15:32 schrieb Meer, H. van der 
h.vanderm...@uva.nlmailto:h.vanderm...@uva.nl:

I can get rid of the unwanted spaces before the table by inserting a whole 
bunch of \unskip's in my code. All the \unskip's in the following code are 
necessary. I guess this observation will be enough to repair the ConText code. 
Or do I have to change something in my code?

\startxmlsetups xmlcommon:tr
\unskip
\xmlstripanywhere{#1}{.}
\unskip
\bgroup
\unskip
\setupxtableparameters{#1}
\unskip
\startxrow
\unskip\xmlflush{#1}
\stopxrow
\egroup
\unskip
\stopxmlsetups

\startxmlsetups xmlcommon:td
\unskip
\xmlstrip{#1}{.}
\bgroup
\setupxtableparameters{#1}
\startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
\xmlflush{#1}
\stopxcell
\egroup
\stopxmlsetups


How did you define the \setupxtableparameters command in your example?

Wolfgang

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

maillist : ntg-context@ntg.nlmailto: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
___

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

2015-05-24 Thread Wolfgang Schuster

 Am 24.05.2015 um 15:32 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 I can get rid of the unwanted spaces before the table by inserting a whole 
 bunch of \unskip's in my code. All the \unskip's in the following code are 
 necessary. I guess this observation will be enough to repair the ConText 
 code. Or do I have to change something in my code?
 
 \startxmlsetups xmlcommon:tr
 \unskip
 \xmlstripanywhere{#1}{.}
 \unskip
 \bgroup
 \unskip
 \setupxtableparameters{#1}
 \unskip
 \startxrow
 \unskip\xmlflush{#1}
 \stopxrow
 \egroup
 \unskip
 \stopxmlsetups
 
 \startxmlsetups xmlcommon:td
 \unskip
 \xmlstrip{#1}{.}
 \bgroup
 \setupxtableparameters{#1}
 \startxcell[nc=\xmlattdef{#1}{colspan}{1},nr=\xmlattdef{#1}{rowspan}{1}]
 \xmlflush{#1}
 \stopxcell
 \egroup
 \stopxmlsetups


How did you define the \setupxtableparameters command in your example?

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

2015-05-24 Thread Wolfgang Schuster

 Am 24.05.2015 um 21:33 schrieb Meer, H. van der h.vanderm...@uva.nl:
 
 In this case you have to provide a working minimal example.
 
 Wolfgang
 
 Here an example as minimal as I could construct.

The spaces in the output are produced by the spaces between the tags (\xmlstrip 
doesn’t seem to work)
and you have to use a combination of \removeunwantedspaces and \ignorespaces to 
remove them.

To center your table this isn’t necessary when you replace \midaligned with a 
framedtext
environment in combination with “location=middle” or use a float command like 
\placefigure.


\startxmlsetups xmlcommon
\xmlsetsetup{\xmldocument}{table|tr|td}{xmlcommon:*}
\stopxmlsetups

\xmlregistersetup{xmlcommon}

\startxmlsetups xmlcommon:table
%   \removeunwantedspaces
\startembeddedxtable
\xmlflush{#1}
\stopembeddedxtable
%   \ignorespaces
\stopxmlsetups

\startxmlsetups xmlcommon:tr
%   \removeunwantedspaces
\startxrow
\xmlflush{#1}
\stopxrow
%   \ignorespaces
\stopxmlsetups

\startxmlsetups xmlcommon:td
%   \removeunwantedspaces
\startxcell
\xmlflush{#1}
\stopxcell
%   \ignorespaces
\stopxmlsetups

\starttext

\startbuffer[a]
?xml version=1.0 encoding=UTF-8?
root
table
tr
tdA/td
/tr
/table
/root
\stopbuffer

\startbuffer[b]
?xml version=1.0 encoding=UTF-8?
root
tabletrtdA/td/tr/table
/root
\stopbuffer

\ruledhbox{\xmlprocessbuffer{root}{a}{}}
\ruledhbox{\xmlprocessbuffer{root}{b}{}}

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