zauguin / luapstricks

8 stars 0 forks source link

pst-func and \psVolume #51

Closed hvoss49 closed 3 years ago

hvoss49 commented 3 years ago

What does the error message mean?? Documentation of pst-func

Overfull \hbox (10.95pt too wide) in paragraph at lines 2500--2519
[][] 
[75...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:330: typecheck
stack traceback:
    [C]: in function 'error'
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:330: in upvalue 'p
op_num'
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:2002: in function 
<...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:1991>
    (...tail calls...)
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3052: in function 
<...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3050>
    (...tail calls...)
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3052: in upvalue '
execute_ps'
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3113: in function 
<...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3110>
    [C]: in function 'vf.node'
    ...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3103: in function 
<...ive/texmf-local/tex/generic/pstricks-lua/luapstricks.lua:3094>.
<argument> ...not:N \tex_shipout:D \box_use:N \l_shipout_box 
                                                  \__shipout_drop_firstpage_...

l.2553 \p
       sVolume[fillstyle=solid,fillcolor=cyan!40](0,4){32}{x sqrt}
? X
zauguin commented 3 years ago

typecheck

Wrong type was passed, more specifically

luapstricks.lua:2002

translate has been called but the top of the stack is neither a matrix nor a number.

I'm looking into why it triggers here.

zauguin commented 3 years ago

The real cause in this case is that pst-func.tex redefining type in /psFourier@i. After /psFourier@i is executed, type no longer has it's original meaning but instead jut pushes the string "sin". Therefore /Ellipse's code to detect if the optional boolean argument has been passed no longer works correctly and the boolean stays on the stack, until translate is called and can't handle the boolean.

The document compiles if pst-func.tex is changed to use a name with no other meaning, e.g. with

--- /CTAN/graphics/pstricks/contrib/pst-func/tex/pst-func.tex   2021-04-06 07:02:57.000000000 +0200
+++ pst-func.tex    2021-09-04 03:32:58.101670306 +0200
@@ -58,20 +58,20 @@
   \pst@killglue
   \psset{#1}
   \psplot[algebraic=false]{#2}{#3}{%
-      /type (cos) def
+      /Type (cos) def
       /Fourier {
         aload length /n exch def
         n -1 roll 2 div n 1 roll % a0/2
         n 1 sub -1 0 {
           /i exch def
           i x mul 180 mul 3.141592 div
-          type (sin) eq {sin}{cos} ifelse
+          Type (sin) eq {sin}{cos} ifelse
           mul n 1 roll
         } for
         n 1 sub -1 1 { pop add } for
       } def
       [\psk@cosCoeff] Fourier
-      /type (sin) def
+      /Type (sin) def
       [0 \psk@sinCoeff] Fourier add
     }%
 }\ignorespaces}

Another way to avoid this would be to make the test independent from such redefinitions by adding bind to the definition of /isbool in pstricks.pro. This still leaves another issue though: All commas in plots get replaced by 52 (e.g. 4,8 comes out as 4528). Beside my extreme disappointment that it isn't 42 I don't have any idea whats causing this, I'm guessing that it's a font issue.

hvoss49 commented 3 years ago

fixed with renaming ... thanks

documentation uploaded