[OS X TeX] TeXShop 5.02: issue with TeX4ht and Sage code

Murray Eisenberg murrayeisenberg at gmail.com
Fri Sep 2 03:12:36 CEST 2022


This concerns the TeXShop 5.02 TeX4ht engine rendering of the file Fourier.tex that is in

	~/Library/TeXShop/New/Demo/Fourier-for-TeXShop

folder. Namely, when its first line is changed to... 

% !TEX TS-program = TeX4ht

…and the source Fourier.tex is typeset (consequently, by the new TeX4ht engine, which calls tex4ht), something weird happens to one piece of Sage code in Section 9 “Interactive Experiments,” namely, in the example “A Sage Calculation”:

<h4>A Sage Computation</h4>
Type your own Sage computation below and click “Evaluate”.
    <div class="compute"><script type="text/x-sage">
u, v = var('u,v')
sage: fx = (3+sin(v)+cos(u))*cos(2*v)
sage: fy = (3+sin(v)+cos(u))*sin(2*v)
sage: fz = sin(u)+2*cos(v)
sage: parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi),
....:   frame=False, color="red")
</script></div>

Although that’s valid Sage code, when I typeset it with the TeX4ht engine, the html output for the SAge code appears as the following:

u, v = var('u,v')
                                                                                  
                                                                                  
sage: fx = (3+sin(v)+cos(u))*cos(2*v)
sage: fy = (3+sin(v)+cos(u))*sin(2*v)
sage: fz = sin(u)+2*cos(v)
sage: parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), (v, 0, 2*pi),
....:   frame=False, color="red”)

And then, when I click the Evaluate buttion under that Sage cell, I get an error:

  File "/tmp/ipykernel_1809651/351844888.py", line 8
    Ellipsis.:   frame=False, color="red")
             ^
SyntaxError: invalid syntax

Merely editing that Sage cell in-place directly in the displayed html page so as to delete the two blank lines allows the code to be properly evaluated by SageCell and produce the expected 3D graphical output.

Is this some quirk of TeX4ht?

—
Murray Eisenberg		murrayeisenberg at gmail.com
Mobile (413)-427-5334
503 King Farm Blvd #101		
Rockville, MD 20850-6667	



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20220901/a326a755/attachment.html>
-------------- next part --------------
----------- Please Consult the Following Before Posting -----------
TeX FAQ: https://www.tug.org/mactex/faq/index.html
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: https://www.tug.org/mactex/index.html
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex


More information about the macostex-archives mailing list.