Search code examples
latexgnuplot

How to generate subsrcipt in formula with text format in gnuplot, with esplatex terminal?


I have tried with the following code:

set term epslatex size 1.3, 1.3 standalone color colortext 9
set output "./test.tex"
set size square 1.3, 1.3

set xtics 1
set style line 1 lt 2 lc rgb "#470024" lw 3

#plot
set yrange [0: 1]
set xrange [0: 5]
set ytics 0.2
set border 1+2+4+8
set ylabel '$y_{\rm wait}$' offset 0.8,0,0
set xlabel '$t$' offset 0,0.5,0
plot exp(-(x)**0.3)  w l ls 1 lw 3 notitle

set output

The current output. enter image description here

The expected ylabel: the subscript is a normal text, instead of an italic form.

(the following part is added 2 days later)

Thanks to your help, I updated the code:

set term epslatex size 1.3, 1.3 standalone color colortext 8
set output "./text.tex"
set size square 1.5, 1.3

set xtics 1
set style line 1 lt 2 lc rgb "#470024" lw 3

#plot
set yrange [0: 1]
set xrange [0: 5]
set ytics 1
set border 1+2+4+8
set ylabel '$y_\textrm{wait}$' offset 0.8,0,0
set xlabel '$t$' offset 0,0.5,0
plot exp(-(x)**0.3)  w l ls 1 lw 3 title "$N_\textrm{wait}$"

set output

enter image description here

Now the ylabel is exactly what I want, but I can not obtain the correct subscript for the legend.


Solution

  • This is not an issue with gnuplot, it is an issue with using the deprecated \rm with a modern LaTeX. Use instead \textup or \textrm. For a more complete discussion, see https://tex.stackexchange.com/questions/151897/always-textrm-never-rm-a-counterexample

    gnuplot command:

    set ylabel '$y_{\textup {wait}}$' offset 0.8,0,0
    

    Edit

    If the example below does not work for you then we'll need more information - gnuplot version, latex version, etc

    set term epslatex standalone
    set out 'font.tex'
    set yrange [0: 1]
    set xrange [0: 5]
    set ytics 0.2
    set border 1+2+4+8
    set ylabel '$y_{\textrm {wait}}$' offset 0.8,0,0
    set xlabel '$t$' offset 0,0.5,0
    plot exp(-(x)**0.3)  w l ls 1 lw 3 title '$Math_{\textup {Roman}}$'
    

    enter image description here