|
From: Leo B. <Leo...@um...> - 2025-11-27 20:45:08
|
As an aside, while I was reading your patch, it occurred to me that we
are hard-coding terminal options in the format strings, when we should
do this in some kind of alist or hashtable. That way, we could extend
the current semantics of
terminal=...
to include something like:
terminal=[cairolatex,[pdf,text=black,crop]]
This would extend the existing syntax for wxt & related terminals:
terminal=[wxt,4]
This would require some significant re-factoring/re-organizing of
gnuplot.lisp, but it would not be terribly complicated, imo.
Best regards,
Leo
On Fri, Nov 28 2025, Atri Bhattacharya <bad...@op...> wrote:
> On Thu, 2025-11-27 at 18:34 +0000, Leo Butler wrote:
>> Thank you for the patch. I have applied it as is. We should add some
>> tests to exercise the new options.
>>
>
> Many thanks, Leo, for pushing my patches through.
>
>> As you found from the mailing list, I had stashed an identical patch
>> in
>> my git repo and then failed to push it. I started using the tikz
>> terminal after many years of using cairlatex pdf and I just forgot
>> about
>> the stashed patch. Thanks for resurrecting it.
>>
>>
>
> No problem; I am glad that this will be in maxima with a future
> release.
>
> Best wishes,
> --
> Atri
>
>> On Thu, Nov 27 2025, Atri Bhattacharya <bad...@op...>
>> wrote:
>>
>> > Only support cairolatex_pdf for now.
>> > ---
>> > share/draw/gnuplot.lisp | 14 ++++++++++++--
>> > share/draw/grcommon.lisp | 3 ++-
>> > 2 files changed, 14 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/share/draw/gnuplot.lisp b/share/draw/gnuplot.lisp
>> > index de004eb6e..cbb172485 100644
>> > --- a/share/draw/gnuplot.lisp
>> > +++ b/share/draw/gnuplot.lisp
>> > @@ -2857,7 +2857,7 @@
>> > (setf plotcmd
>> > (concatenate 'string
>> > (unless (or *multiplot-is-active*
>> > - (member (get-option '$terminal) '($eps
>> > $epslatex $epslatex_standalone)))
>> > + (member (get-option '$terminal) '($eps
>> > $epslatex $epslatex_standalone $cairolatex_pdf)))
>> > (format nil "set obj 1 fc rgb '~a' fs solid 1.0
>> > noborder ~%"
>> > (get-option '$background_color)) )
>> > (if (equal (get-option '$proportional_axes) '$none)
>> > @@ -3339,6 +3339,11 @@
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > (/ (second (get-option '$dimensions))
>> > 100.0)
>> > (get-option '$file_name)))
>> > + ($cairolatex_pdf (format cmdstorage "set terminal
>> > cairolatex pdf ~a color size ~acm, ~acm~%set out '~a.tex'"
>> > + (write-font-type)
>> > + (/ (first (get-option '$dimensions))
>> > 100.0)
>> > + (/ (second (get-option '$dimensions))
>> > 100.0)
>> > + (get-option '$file_name)))
>> > (($pdf $multipage_pdf) (format cmdstorage "set terminal
>> > pdf dashed enhanced ~a color size ~acm, ~acm~%set out '~a.pdf'"
>> > (write-font-type)
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > @@ -3483,7 +3488,7 @@
>> > (format cmdstorage "~%set size ~a, ~a~%" size1
>> > size2)
>> > (format cmdstorage "set origin ~a, ~a~%" origin1
>> > origin2)
>> > (unless (or *multiplot-is-active*
>> > - (member (get-option '$terminal)
>> > '($epslatex $epslatex_standalone)))
>> > + (member (get-option '$terminal)
>> > '($epslatex $epslatex_standalone $cairolatex_pdf)))
>> > (format cmdstorage "set obj 1 rectangle behind
>> > from screen ~a,~a to screen ~a,~a~%"
>> > origin1 origin2 (+ origin1
>> > size1 ) (+ origin2 size2))) ))
>> > (setf is1stobj t
>> > @@ -3681,6 +3686,11 @@
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > (/ (second (get-option '$dimensions))
>> > 100.0)
>> > (get-option '$file_name))))
>> > + ($cairolatex_pdf (format str "set terminal cairolatex pdf ~a
>> > color colortext size ~acm, ~acm~%set out '~a.tex'"
>> > + (write-font-type)
>> > + (/ (first (get-option '$dimensions))
>> > 100.0)
>> > + (/ (second (get-option '$dimensions))
>> > 100.0)
>> > + (get-option '$file_name)))
>> > ($pdf (setf str (format nil "set terminal pdf dashed
>> > enhanced ~a color size ~acm, ~acm~%set out '~a.pdf'"
>> > (write-font-type)
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > diff --git a/share/draw/grcommon.lisp b/share/draw/grcommon.lisp
>> > index 513a06074..85f6f7d43 100644
>> > --- a/share/draw/grcommon.lisp
>> > +++ b/share/draw/grcommon.lisp
>> > @@ -983,7 +983,8 @@
>> > $epslatex $epslatex_standalone $svg $tikz
>> > $tikz_standalone $x11 $qt
>> > $dumb $dumb_file $pdf $pdfcairo $wxt
>> > $animated_gif $windows
>> > $multipage_pdfcairo $multipage_pdf $multipage_eps
>> > - $multipage_eps_color $aquaterm $tiff $vrml $obj
>> > $stl $pnm $ply)))
>> > + $multipage_eps_color $aquaterm $tiff $vrml $obj
>> > $stl $pnm $ply
>> > + $cairolatex_pdf)))
>> > (cond
>> > ((member val terms)
>> > (when (and (eq val '$png) $draw_use_pngcairo)
>> > --
>> > 2.52.0
>> >
>> >
>> > From 9f8f512bcdf6119a1af2a2edc03534d8cf438280 Mon Sep 17 00:00:00
>> > 2001
>> > From: Atri Bhattacharya <A.B...@ul...>
>> > Date: Thu, 27 Nov 2025 14:35:03 +0530
>> > Subject: [PATCH 2/3] feat: add cairolatex_pdf_standalone terminal
>> >
>> > ---
>> > share/draw/gnuplot.lisp | 16 +++++++++++++---
>> > share/draw/grcommon.lisp | 2 +-
>> > 2 files changed, 14 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/share/draw/gnuplot.lisp b/share/draw/gnuplot.lisp
>> > index cbb172485..4866dadb8 100644
>> > --- a/share/draw/gnuplot.lisp
>> > +++ b/share/draw/gnuplot.lisp
>> > @@ -2857,7 +2857,7 @@
>> > (setf plotcmd
>> > (concatenate 'string
>> > (unless (or *multiplot-is-active*
>> > - (member (get-option '$terminal) '($eps
>> > $epslatex $epslatex_standalone $cairolatex_pdf)))
>> > + (member (get-option '$terminal) '($eps
>> > $epslatex $epslatex_standalone $cairolatex_pdf
>> > $cairolatex_pdf_standalone)))
>> > (format nil "set obj 1 fc rgb '~a' fs solid 1.0
>> > noborder ~%"
>> > (get-option '$background_color)) )
>> > (if (equal (get-option '$proportional_axes) '$none)
>> > @@ -3344,6 +3344,11 @@
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > (/ (second (get-option '$dimensions))
>> > 100.0)
>> > (get-option '$file_name)))
>> > + ($cairolatex_pdf_standalone (format cmdstorage "set
>> > terminal cairolatex pdf standalone ~a color size ~acm, ~acm~%set
>> > out '~a.tex'"
>> > + (write-font-type)
>> > + (/ (first (get-option '$dimensions))
>> > 100.0)
>> > + (/ (second (get-option '$dimensions))
>> > 100.0)
>> > + (get-option '$file_name)))
>> > (($pdf $multipage_pdf) (format cmdstorage "set terminal
>> > pdf dashed enhanced ~a color size ~acm, ~acm~%set out '~a.pdf'"
>> > (write-font-type)
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > @@ -3488,7 +3493,7 @@
>> > (format cmdstorage "~%set size ~a, ~a~%" size1
>> > size2)
>> > (format cmdstorage "set origin ~a, ~a~%" origin1
>> > origin2)
>> > (unless (or *multiplot-is-active*
>> > - (member (get-option '$terminal)
>> > '($epslatex $epslatex_standalone $cairolatex_pdf)))
>> > + (member (get-option '$terminal)
>> > '($epslatex $epslatex_standalone $cairolatex_pdf
>> > $cairolatex_pdf_standalone)))
>> > (format cmdstorage "set obj 1 rectangle behind
>> > from screen ~a,~a to screen ~a,~a~%"
>> > origin1 origin2 (+ origin1
>> > size1 ) (+ origin2 size2))) ))
>> > (setf is1stobj t
>> > @@ -3686,7 +3691,12 @@
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > (/ (second (get-option '$dimensions))
>> > 100.0)
>> > (get-option '$file_name))))
>> > - ($cairolatex_pdf (format str "set terminal cairolatex pdf ~a
>> > color colortext size ~acm, ~acm~%set out '~a.tex'"
>> > + ($cairolatex_pdf (format str "set terminal cairolatex pdf ~a
>> > color size ~acm, ~acm~%set out '~a.tex'"
>> > + (write-font-type)
>> > + (/ (first (get-option '$dimensions))
>> > 100.0)
>> > + (/ (second (get-option '$dimensions))
>> > 100.0)
>> > + (get-option '$file_name)))
>> > + ($cairolatex_pdf_standalone (format str "set terminal
>> > cairolatex pdf standalone ~a color size ~acm, ~acm~%set out
>> > '~a.tex'"
>> > (write-font-type)
>> > (/ (first (get-option '$dimensions))
>> > 100.0)
>> > (/ (second (get-option '$dimensions))
>> > 100.0)
>> > diff --git a/share/draw/grcommon.lisp b/share/draw/grcommon.lisp
>> > index 85f6f7d43..934d4c6d6 100644
>> > --- a/share/draw/grcommon.lisp
>> > +++ b/share/draw/grcommon.lisp
>> > @@ -984,7 +984,7 @@
>> > $dumb $dumb_file $pdf $pdfcairo $wxt
>> > $animated_gif $windows
>> > $multipage_pdfcairo $multipage_pdf $multipage_eps
>> > $multipage_eps_color $aquaterm $tiff $vrml $obj
>> > $stl $pnm $ply
>> > - $cairolatex_pdf)))
>> > + $cairolatex_pdf $cairolatex_pdf_standalone)))
>> > (cond
>> > ((member val terms)
>> > (when (and (eq val '$png) $draw_use_pngcairo)
>> > --
>> > 2.52.0
>> >
>> >
>> > From 06f62b9c3efa186e7ebe27fea4a5b8b4f482261d Mon Sep 17 00:00:00
>> > 2001
>> > From: Atri Bhattacharya <A.B...@ul...>
>> > Date: Thu, 27 Nov 2025 15:36:57 +0530
>> > Subject: [PATCH 3/3] docs: add info for cairolatex_pdf* terminals
>> >
>> > ---
>> > doc/info/draw.texi | 2 ++
>> > 1 file changed, 2 insertions(+)
>> >
>> > diff --git a/doc/info/draw.texi b/doc/info/draw.texi
>> > index bdd888d17..0929c79dd 100644
>> > --- a/doc/info/draw.texi
>> > +++ b/doc/info/draw.texi
>> > @@ -1129,6 +1129,7 @@ points in each direction. If they are not
>> > integers, they are rounded.
>> >
>> > With terminals @code{eps}, @code{epslatex},
>> > @code{epslatex_standalone},
>> > @code{eps_color}, @code{multipage_eps},
>> > @code{multipage_eps_color},
>> > +@code{cairolatex_pdf}, @code{cairolatex_pdf_standalone},
>> > @code{pdf}, @code{multipage_pdf}, @code{pdfcairo},
>> > @code{multipage_pdfcairo}, @code{tikz}, and
>> > @code{tikz_standalone}, both
>> > numbers represent hundredths of cm, which means that, by default,
>> > @@ -2726,6 +2727,7 @@ Default value: @code{screen}
>> >
>> > Selects the terminal to be used by Gnuplot; possible values are:
>> > @code{screen} (default), @code{png}, @code{pngcairo}, @code{jpg},
>> > @code{gif},
>> > +@code{cairolatex_pdf}, @code{cairolatex_pdf_standalone},
>> > @code{eps}, @code{eps_color}, @code{epslatex},
>> > @code{epslatex_standalone},
>> > @code{svg}, @code{canvas}, @code{dumb}, @code{dumb_file},
>> > @code{pdf}, @code{pdfcairo},
>> > @code{wxt}, @code{animated_gif}, @code{multipage_pdfcairo},
>> > @code{multipage_pdf},
>> > --
>> > 2.52.0
>> >
>> >
>> > Hi,
>> > I have written a (pretty straightforward) patch to support the
>> > `cairolatex_pdf` and `cairolatex_pdf_standalone` gnuplot terminals
>> > for
>> > the draw package and attach it here. The patch has undergone
>> > limited
>> > testing on my own Linux system and it works; but I am not much of a
>> > lisp programmer, so, more testing and any suggestions/corrections
>> > would
>> > be most welcome. Gnuplot has had the `cairolatex` terminal with
>> > outputs
>> > to pdf, png, and eps supported since version 4.6 (circa 2012), so
>> > this
>> > should work with any 'modern' gnuplot installations.
>> >
>> > However, going through archives of this mailing list — arguably, I
>> > should have done that before modifying code myself — I saw there
>> > were
>> > already plans to include something similar here:
>> > https://sourceforge.net/p/maxima/mailman/message/37332366/
>> > and I wonder if I am duplicating any past effort.
>> >
>> > Been a long time user of (wx)maxima and want to thank all the
>> > developers for these amazing applications.
>> >
>> > Best wishes,
>>
>> --
>> ---
>> Best regards,
>> Dr Butler
>> _______________________________________________
>> Maxima-discuss mailing list
>> Max...@li...
>> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
>
> _______________________________________________
> Maxima-discuss mailing list
> Max...@li...
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
--
---
Best regards,
Dr Butler |