Closed pablgonz closed 3 years ago
) [1./luapstricks.lua:1336: linewidth has to be set before it is queried
@hvoss49 The issue here is that luapstricks can't easily query the current linewidth if it has been set by other code (e.g. the fonthandline, TikZ, ...), so currently it doesn't allow the currentlinewidth
command until it can determine the current linewidth (meaning until setlinewidth
has been called for the current graphic state. (Similarly for some other graphic state parameters.)
I was hoping that this turns out not to be an issue since pstricks always sets it's current linewidth anyway, but it seems that I was mistaken. What is the behavior which would be the most helpful from pstricks's point of view? The options I see are
setlinewidth
to ensure that going forward, this value is correct.) [1./luapstricks.lua:1336: linewidth has to be set before it is queried
- The current behavior of breaking and complaining to the user.
- Guessing some default value and just reporting it without regard to what might be the actual value.
- Like 2., but automatically running a corresponding
setlinewidth
to ensure that going forward, this value is correct.
I suppose that it doesn't hurt if I did a global setlinewidth at the beginning of any PS code. A first test was ok. Try it with
bash-3.2$ diff -u /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex pstricks.tex
--- /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex 2021-08-28 00:38:46.000000000 +0200
+++ pstricks.tex 2021-08-28 20:27:19.148764328 +0200
@@ -4399,6 +4399,7 @@
\ifshowgrid\ifnum\showgridp@s=0\psgrid[style=gridstyle]\fi\fi
% ----------- 1.10/12 end hv -------------------
\ignorespaces% % 2008-12-07
+ \pstVerb{\number\pslinewidth\space setlinewidth}%
\ifPst@pgffunctions\pstVerb{ pgffunctions }\fi% hv 2013-04-17
}
\def\pic@coor{(0,0)(0,0)(10,10)}
I suppose that it doesn't hurt if I did a global setlinewidth at the beginning of any PS code. A first test was ok. Try it with
bash-3.2$ diff -u /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex pstricks.tex --- /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex 2021-08-28 00:38:46.000000000 +0200 +++ pstricks.tex 2021-08-28 20:27:19.148764328 +0200 @@ -4399,6 +4399,7 @@ \ifshowgrid\ifnum\showgridp@s=0\psgrid[style=gridstyle]\fi\fi % ----------- 1.10/12 end hv ------------------- \ignorespaces% % 2008-12-07 + \pstVerb{\number\pslinewidth\space setlinewidth}% \ifPst@pgffunctions\pstVerb{ pgffunctions }\fi% hv 2013-04-17 } \def\pic@coor{(0,0)(0,0)(10,10)}
My tests looked good after that change too. (FYI I'll temporarily add patched versions of pstricks.tex and pstricks.pro (for #15) to this repo to simplify testing)
@zauguin @hvoss49 Can attach the modified versions of pstricks.tex
and pstricks.pro
?
Can attach the modified versions of
pstricks.tex
andpstricks.pro
?
I forgot to push earlier, but now you should see the modified files in the repo.
Work with patch version
bash-3.2$ diff -u /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex pstricks.tex --- /usr/local/texlive/texmf-dist/tex/generic/pstricks/pstricks.tex 2021-08-28 00:38:46.000000000 +0200 +++ pstricks.tex 2021-08-28 20:27:19.148764328 +0200 @@ -4399,6 +4399,7 @@ \ifshowgrid\ifnum\showgridp@s=0\psgrid[style=gridstyle]\fi\fi % ----------- 1.10/12 end hv ------------------- \ignorespaces% % 2008-12-07
- \pstVerb{\number\pslinewidth\space setlinewidth}% \ifPst@pgffunctions\pstVerb{ pgffunctions }\fi% hv 2013-04-17 } \def\pic@coor{(0,0)(0,0)(10,10)}
@hvoss49 I just noticed that this sets the linewidth to very high values. (\pslinewidth
is a dimension, so \number\pslinewidth
provides the value in scaled points and not normal points. So for \pslinewidth
set to 0.8pt (which are 52429sp) this sets the linewidth to more than 18 meter). I don't have any examples where this actually has an influence since mostly the linewidth gets overwritten anyway, but I think it should be fixed nonetheless.
- \pstVerb{\number\pslinewidth\space setlinewidth}%
@hvoss49 I just noticed that this sets the linewidth to very high values. (
\pslinewidth
is a dimension, so\number\pslinewidth
provides the value in scaled points and not normal points. So for\pslinewidth
set to 0.8pt (which are 52429sp) this sets the linewidth to more than 18 meter). I don't have any examples where this actually has an influence since mostly the linewidth gets overwritten anyway, but I think it should be fixed nonetheless.
fixed, should be \pst@number
and also added 0 setgray
to have a currentcolor
I was trying to check compatibility with
pst-node
and I have encountered the following problem:The rest of what I have tested works. Complete test file: