Menu

#4682 draw with terminal=epslatex_standalone generate faulty latex file

None
closed
nobody
5
2 days ago
2026-03-11
b606
No

The last instruction below never returns because the latex compilation contains an error which reads : "! Missing $ inserted."
(latex wants a user input to run uninterrupted)

  • Choosing yscale:1000000 instead, everything works fine. The call to latex does not complain.
  • gnuplot with esplatex standalone works fine, see test file and run with gnuplot test-axis.gnuplot

system: Debian Trixie
maxima: 5.47.0-7
wxmaxima: 24.02.1-1+b2
gnuplot-qt: 6.0.2+dfsg1-1

wxbug_report()
wxMaxima version: 24.02.1_GTK3
using wxWidgets version: wxWidgets 3.2.4
Maxima version: 5.47.0
Maxima build date: 2025-04-26 23:41:25
Host type: x86_64-pc-linux-gnu
System type: NIL NIL NIL
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.7.1 git tag Version_2_7_2ore2

Test code:

f(q):=1000000+125000/q+10*q$
filename:"test"$
yscale:1$ /* y = 1 : no y scaling */
scene:gr2d(
    explicit(f(Q)/yscale,Q,1,200),
    xlabel="$q$",ylabel="$f(q)$"
)$
draw(scene)$
draw(terminal=epslatex_standalone,
    dimensions=[1600,1200],
    file_name=filename, scene);
 /*
   Instead, choose above yscale:1000000$ and everything works fine
*/
system(concat("latex ",filename), " > /dev/null ");
2 Attachments

Discussion

  • Robert Dodier

    Robert Dodier - 7 days ago
    • labels: --> plotting, share packages, draw, gnuplot, latex
     
  • Robert Dodier

    Robert Dodier - 7 days ago

    Looking at the LaTeX output, I see lines which look like

    \put(1474,1548){\makebox(0,0)[r]{\strut{}1.02\times10^{6}}}%
    

    and the stuff after \strut{} needs to be enclosed in dollar signs. Indeed, if I put dollar signs around the \times stuff, then latex runs without error and creates what appears to be a valid output.

    I think this is a bug in the LaTeX output for Gnuplot. I have version 5.0 installed on my system. Hmm, I see you have Gnuplot 6.0.2, so it appears the putative bug is still there; the most recent version is 6.0.4, just a little later. I have opened a bug report for Gnuplot: https://sourceforge.net/p/gnuplot/bugs/2861/

    As this appears to be a bug in Gnuplot, I'll close this bug report.

     
  • Robert Dodier

    Robert Dodier - 7 days ago
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 7 days ago

    Looking at the LaTeX output, I see lines which look like

    \put(1474,1548){\makebox(0,0)[r]{\strut{}1.02\times10^{6}}}%
    

    and the stuff after \strut{} needs to be enclosed in dollar signs. Indeed, if I put dollar signs around the \times stuff, then latex runs without error and creates what appears to be a valid output.

    I think this is a bug in the LaTeX output for Gnuplot. I have version 5.0 installed on my system. Hmm, I see you have Gnuplot 6.0.2, so it appears the putative bug is still there; the most recent version is 6.0.4, just a little later. I have opened a bug report for Gnuplot: https://sourceforge.net/p/gnuplot/bugs/2861/

    As this appears to be a bug in Gnuplot, I'll close this bug report.

     
  • Robert Dodier

    Robert Dodier - 6 days ago
    • status: closed --> open
     
  • Robert Dodier

    Robert Dodier - 6 days ago

    I've reopened this ticket, it turns out the problem is in the code which generates the Gnuplot script -- it has to do with the non-default tic label. I'll try to fix the bug in the draw package, but in the meantime, you can patch your copy of Maxima by cutting out set format '%h' in share/draw/gnuplot.lisp.

     
  • Robert Dodier

    Robert Dodier - 6 days ago
    • status: open --> closed
     
  • Robert Dodier

    Robert Dodier - 6 days ago

    Fixed by commit [ ce4e05a ]. I just removed set format '%h' so that the default tick format is applied by Gnuplot, which is $%h$ for LaTeX terminals and % h for all others.

    % h and %h are almost the same; the only difference is that % h puts a space before positive numbers. I don't think that matters. It's not clear why %h was put into the draw code; maybe the default was something else at the time.

     
  • b606

    b606 - 2 days ago

    Thank you very much :-)

     

Log in to post a comment.

MongoDB Logo MongoDB