Menu

#2786 set terminal tikz does not remember previous options

None
pending-accepted
nobody
None
2025-04-14
2025-04-13
Anonymous
No

This is gnuplot 6.0 patchlevel 1 on a fedora linux machine.

Terminal tikz does not remember previous options. If I do

set term tikz standalone
set term tikz

Then option standalone is unset by the second invocation.

However, the doc (from help set term) states that

The options used by a previous invocation set term <term> <options> of a
given <term> are remembered, thus subsequent set term <term> does
not reset them.

The way I understand the doc, the standalone option should have been kept.

Discussion

  • Ethan Merritt

    Ethan Merritt - 2025-04-13

    The documentation is incorrect, or at least very poorly worded. I think the intent was to illustrate the sequence of commands

    set term FOO opt1 opt2
    plot something
    set term push      # save term FOO and all its settings
    set term BAZ opt3 opt4
    replot
    set term pop      # restore term FOO and all its previous settings
    

    The various terminal drivers were written over a period of 30+ years by many different people. They have accumulated points of inconsistency with each other despite several rounds of attempted consolidation. The issue of whether an option is or is not reset to its default when the terminal is selected by "set term" is one of those points, sometimes due to requirements of the terminal hardware, or library interface, sometimes just because that's the way it was originally written.

    Thank you for pointing out the problem with the documentation. That sentence should be removed.

     
  • Ethan Merritt

    Ethan Merritt - 2025-04-13
    • status: open --> pending-accepted
    • Group: -->
    • Priority: -->
     
  • Éric Brunet

    Éric Brunet - 2025-04-14

    I think the document describes the correct behaviour, and that the tikz driver should be fixed. Right now, with the cairolatex driver, one can do things such as

    set term cairolatex png mono
    set term cairolatex size 5,3
    

    and the second invocation kept the png and mono options, as expected from reading the documentation. This works with several other drivers that I just tested, only tikz is different.
    I really believe, that an homogeneous behaviour is desirable as much as possible, and that tikz should be modified to follow the documentation.

    The use case for the behaviour the documentation describes is this: a script and/or a master file sets some default options, for instance

    set term tikz standalone butt clip size 5in,3.5in\
                header '\\usepackage{amsmath,amsfonts}'\
                font ",12pt" 
    

    and then load another file. In the other file, it is nice to be able to change one parameter, for instance

    set term tikz size 5in,5in
    

    without resetting all the other options. Again, this works with many drivers but not tikz.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.