Hi Qian,

 > (I've included one small change that move "subspace(vp)" of section
 > 10.1 to psXtc.

You should not include this part as I mentioned in my last mail.

Then "vp" is not defined, causing error messages in the book, you can
verify that.

sorry, it took a while until I understood your remark.

What you actually mean is that vp is not defined when the .input file is given to FRICASsys to produce the .spool file. I was wrongly only considering the graphics generation side.

Yes, for that you are right. And that should not happen, so \psXtc would be the right thing to avoid that.

I think all is good for now, but looking at the generated .input file, I am actually not completely happy.

For example, there is a rotate(vp, 0, -90) command in ug10.htex.
Currently, we generate that command as

-- \begin{inputonly}
rotate(vp, 0, -90)
-- \end{inputonly}

so it is executed, but the output is ignored.

Better would have been

-- \begin{inputonly}
)if CreateGraphics
rotate(vp, 0, -90)
)endif
-- \end{inputonly}

as in the other \psXtc commands.

The reason for this mild problem is that I thought that only the \spadgraph commands are graphical stuff that do not need execution in the run to generated the output for the book, i.e., the spool file.
Now I believe that, it is actually any command inside \psXtc that does
not need to be executed in a non-graphical run. So you might
change in htex2input.awk

    if (xtcname=="psXtc") {
        if (posspadgraph>0) {maybeCloseViewport()}
        print "-- \\begin{inputonly}"
        if (posspadgraph>0) {
            spadgraph=1
            print ")if CreateGraphics"
            print "spadgraphViewport:=" $0
            print ")endif"
        } else {
            print $0
        }
        print "-- \\end{inputonly}"
    }

into

    if (xtcname=="psXtc") {
        if (posspadgraph>0) {maybeCloseViewport()}
        print "-- \\begin{inputonly}"
        print ")if CreateGraphics"
        if (posspadgraph>0) {
            spadgraph=1
            print "spadgraphViewport:=" $0
        } else {
            print $0
        }
        print ")endif"
        print "-- \\end{inputonly}"
    }


There are, in fact, only 4 cases where that matters.

find . -type f -name '*.htex' -exec grep --color -nH -e '\\psXtc\|\\spadgraph\|\\spadcommand' \{\} +|grep -A1 '\\psXtc'|grep -v '\\psXtc'|grep -v '\\spadgraph'
./htex/ug10.htex:134:\spadcommand{rotate(vp, 0, -90)\bound{d3}\free{d1}}
--
./htex/ug10.htex:194:\spadcommand{drawStyle(vp,"shade");outlineRender(vp,"on")\bound{d10}\free{d6}}
./htex/ug10.htex:201:\spadcommand{rotate(vp,20,-60); showRegion(vp,"on")\bound{d11}\free{d10}}
--
--
./htex/ug10.htex:488:\spadcommand{rotate(vp,200,-60)\bound{v5}\free{v4}}

So it looks like the above modification should work. (And they do on my machine.) You can include the attached patch to your "generate book with ps image" patch.

Also I checked the generated tmp/vp-ug10.input, since the third argument
to \psXtc is empty, the htex2input.awk will not generate faulty "write"
commands.

Well, it is true that there will be no write command generated, but the reason is not that there is no filename, but rather that inside \psXtc is \spadcommand and not \spadgraph. So all is fine then.

Thanks for your review.  After some final testings, I'll do the commit
later.

Maybe you include the attached patch in your first commit.

Ralf

--
You received this message because you are subscribed to the Google Groups "FriCAS - 
computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/6cadb1f3-acb1-47a8-94c5-9c951d759356%40hemmecke.org.
From 10892dfd364c0147c00d78c35264098a25d3201b Mon Sep 17 00:00:00 2001
From: Ralf Hemmecke <r...@hemmecke.org>
Date: Tue, 25 Jun 2024 14:21:26 +0200
Subject: fix \psXtc command generation

---
 src/doc/htex2input.awk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/doc/htex2input.awk b/src/doc/htex2input.awk
index 4560c63d..8fd8d5f1 100644
--- a/src/doc/htex2input.awk
+++ b/src/doc/htex2input.awk
@@ -90,14 +90,14 @@ xtc==2 && (/^\\spadcommand{/ || /^\\spadgraph{/) {
     if (xtcname=="psXtc") {
         if (posspadgraph>0) {maybeCloseViewport()}
         print "-- \\begin{inputonly}"
+        print ")if CreateGraphics"
         if (posspadgraph>0) {
             spadgraph=1
-            print ")if CreateGraphics"
             print "spadgraphViewport:=" $0
-            print ")endif"
         } else {
             print $0
         }
+        print ")endif"
         print "-- \\end{inputonly}"
     }
     if (xtcname=="noOutputXtc") {
-- 
2.34.1

Reply via email to