Regarding 2: No, it is not possible to use LaTeX or MathJax for the labels in the wxt terminal. But thats only for the interactive part.
In this case, you can use utf8
and enhanced
to get at least the correct symbols:
set encoding utf8
set termoption enhanced
set xlabel '[00ζ]'
set label at graph 0.5,0.5 'Σ_1(0)'
plot x
For a print-quality image, you can use set terminal cairolatex pdf
to use LaTeX for the labels:
set terminal cairolatex pdf standalone
set output 'test.tex'
set bmargin 3
set xlabel '$[00\zeta]$'
set label at graph 0.5,0.5 '$\Sigma_1(0)$'
plot x
set output
system('pdflatex test.tex')
Here, you must pay attention to use single quotes '
, otherwise you must escape some characters.
Regarding 3: There is no 'automatic' way to switch between the two variants, but you can of course define all labels as string, and choose between the two:
latex = 1
if (latex) {
xlabel = '$[00\zeta]$'
label1 = '$\Sigma_1(0)$'
} else {
xlabel = '[00ζ]'
label1 = 'Σ_1(0)'
}
set xlabel xlabel
set label 1 at graph 0.5,0.5 label1
In general that works, but since gnuplot doesn't know about the exact width and height of a LaTeX label, some fine-tuning of the label position might be required (e.g. with offset
for the xlabel
, or with different positions. In that case you can define the whole commands and call them later:
latex = 1
if (latex) {
set_xlabel = 'set xlabel ''$[00\zeta]$'' offset 0,-1'
set_label1 = 'set label 1 ''$\Sigma_1(0)$'' at graph 0.5,0.5'
} else {
set_xlabel = 'set xlabel ''[00ζ]'' '
set_label1 = 'set label 1 ''Σ_1(0)'' at graph 0.5,0.5'
}
set macros
@set_xlabel
@set_label1
Instead of using macros
, you could also use eval(set_xlabel)
, which would allow you to define a function like:
set_label1(x,y) = sprintf('set label 1 ''$\Sigma_1(0)$'' at graph %f,%f', x, y)
eval(set_label1(0.5,0.5))