Hi, for dealing with color inside self-built nodelists, I create a whatsit (pdfliteral, 8) node for "q <colordef>", prepend it to my nodelist and at the end of the nodelist I put a whatsit (8,8) "Q" to end the color definition. This interferes somehow with placement of text (I tried mode=1 and mode=0) so now I am thinking of using pdfTeX's colorstacks. 1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists? more important: 2) Is there something like \pdfcolorstackinit in lua? Patrick
On 15-10-2010 11:55, Patrick Gundlach wrote:
for dealing with color inside self-built nodelists, I create a whatsit (pdfliteral, 8) node for "q<colordef>", prepend it to my nodelist and at the end of the nodelist I put a whatsit (8,8) "Q" to end the color definition. This interferes somehow with placement of text (I tried mode=1 and mode=0) so now I am thinking of using pdfTeX's colorstacks.
indeed q Q can interfere with other mechanism .. in that respect pdf is not that clean (ps has better grouping model)
1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists?
It should make no difference if you do it at the tex end of lua end, apart maybe from assumptions with respect to the whatsit ending up before end-of-par glue or after begin-of-par indentation and dir boxes
more important:
2) Is there something like \pdfcolorstackinit in lua?
I never used color stacks but I assume that tex.pdfcolorstackinit works ok then ----------------------------------------------------------------- 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 -----------------------------------------------------------------
1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists?
It should make no difference if you do it at the tex end of lua end, apart maybe from assumptions with respect to the whatsit ending up before end-of-par glue or after begin-of-par indentation and dir boxes
Good point, thanks.
more important:
2) Is there something like \pdfcolorstackinit in lua?
I never used color stacks but I assume that tex.pdfcolorstackinit works ok then
Couldn't find that one. Not-yet-implemented-error? I've got it working now with TeX/Lua glue code but if it isn't there, I'll create a tracker item. Patrick
On 15-10-2010 12:16, Patrick Gundlach wrote:
Couldn't find that one. Not-yet-implemented-error?
it's probably a whatsit too (at least that's what i can imagine) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
Patrick Gundlach wrote:
1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists? It should make no difference if you do it at the tex end of lua end, apart maybe from assumptions with respect to the whatsit ending up before end-of-par glue or after begin-of-par indentation and dir boxes
Good point, thanks.
more important:
2) Is there something like \pdfcolorstackinit in lua? I never used color stacks but I assume that tex.pdfcolorstackinit works ok then
Couldn't find that one. Not-yet-implemented-error?
IMO pdfcolorstack is weak and I think it makes sense to follow this way, at least not in luatex. In pdftex one can take an advantage of passing graphic state from page to page. But in luatex, when you're operating on lists already, it's not better then user whatsit, is it? -- Pawe/l Jackowski P.Jackowski@gust.org.pl
Hi Paweł,
Patrick Gundlach wrote:
1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists? It should make no difference if you do it at the tex end of lua end, apart maybe from assumptions with respect to the whatsit ending up before end-of-par glue or after begin-of-par indentation and dir boxes Good point, thanks. more important:
2) Is there something like \pdfcolorstackinit in lua? I never used color stacks but I assume that tex.pdfcolorstackinit works ok then Couldn't find that one. Not-yet-implemented-error?
IMO pdfcolorstack is weak and I think it makes sense to follow this way, at least not in luatex. In pdftex one can take an advantage of passing graphic state from page to page. But in luatex, when you're operating on lists already, it's not better then user whatsit, is it?
I am thinking about adding a colorstack whatsit at both sides of my nodelist. You would rather user pdfliteral whatsits and set the color by hand? I read from your answer that I can run into problems with page breaks, true? Patrick
Patrick Gundlach wrote:
I am thinking about adding a colorstack whatsit at both sides of my nodelist. You would rather user pdfliteral whatsits and set the color by hand?
You can use also pdfliteral node, or (if you make some list processing anyway) a user whatsit node (8, 44), or (which I personally prefer) latelua node. I use latelua nodes for all graphic-related purposes, because it allows me to represent graphic properties by lua-objects (rather then fixed strings) and operate on them by lua-programs. I read from your answer that I can run into problems with
page breaks, true?
For the page breaking mechanism all those whatsits are the same. The advangage of pdfcolorstack mechanism is that it inserts the whatsits automatically on page breaks which results in passing a graphic state from one page to another, which otherwise is not strightforward in pure (pdf)tex. But if i understood correctly you work with the page node list already, so you can insert nearly anything anywhere ;) So here i see no advantage of using pdfcolorstack nodes over pdfliteral nodes (or latelua nodes). -- Pawe/l Jackowski P.Jackowski@gust.org.pl
On 10/15/2010 08:56 PM, Paweł Jackowski wrote:
Patrick Gundlach wrote:
1) Do you have a feeling if pdfcolorstacks makes sense with do-it-yourself nodelists? It should make no difference if you do it at the tex end of lua end, apart maybe from assumptions with respect to the whatsit ending up before end-of-par glue or after begin-of-par indentation and dir boxes
Good point, thanks.
more important:
2) Is there something like \pdfcolorstackinit in lua? I never used color stacks but I assume that tex.pdfcolorstackinit works ok then
Couldn't find that one. Not-yet-implemented-error?
Yes, NYI. Scanning the arguments of \pdfcolorstackinit is non-trivial, and besides, it would make more sense for lua to access the actual stack instead of faking the primitive syntax.
IMO pdfcolorstack is weak and I think it makes sense to follow this way, at least not in luatex.
I am not sure, there is some advantage to the simple interface offered by pdfcolorstack. Well, maybe not in Patrick's case, as he does complex node processing anyway, but for the general user I assume a lua interface to the color stacks will be easier to handle than mucking about with node lists. Best wishes, Taco
On Fri, Oct 15, 2010 at 08:56:21PM +0200, Pawe?? Jackowski wrote:
IMO pdfcolorstack is weak
AFAIK, it's the strongest and most powerful color support of all TeX engines. Only node attributes with node list manipulation at shipout time are able to beat it.
and I think it makes sense to follow this way, at least not in luatex. In pdftex one can take an advantage of passing graphic state from page to page. But in luatex, when you're operating on lists already, it's not better then user whatsit, is it?
Package luacolor uses LuaTeX's attributes to implement color. (However I don't know if it needs some updating to the current development). The attributes are set during node creation. If current definitions and node creation are out of sync, then the nodes out of sync might have the wrong color. Some time ago meantioned that this might happen in math mode under some conditions, but I haven't investigated further. Does someone know more details, or even have an example at hand? Yours sincerely Heiko Oberdiek
The attributes are set during node creation. If current definitions and node creation are out of sync, then the nodes out of sync might have the wrong color. Some time ago meantioned that this might happen in math mode under some conditions, but I haven't investigated further.
This should now be fixed in the latest luatex releases, but I don't have a complete test file to try it out (and am too lazy to write one, to be honest). IMO, the colorstack is a perfectly valid way of handling color even though that also has potential weak points, especially when lua node reshuffling happens. Best wishes, Taco
participants (5)
-
Hans Hagen
-
Heiko Oberdiek
-
Patrick Gundlach
-
Paweł Jackowski
-
Taco Hoekwater