I'm working w/ Gnuplot 5.0 on Linux, although I am informed this bug also exists with Gnuplot 6.0.2 on Linux.
In summary it appears that tick labels are generated which contain LaTeX math expressions but they are not enclosed in dollar signs.
In detail, I have an example Gnuplot input file latex-bug.gnuplot which I've attached. Executing
$ gnuplot latex-bug.gnuplot
apparently succeeds and creates its specified output mumble.tex, but then
$ latex mumble.tex
! Missing $ inserted.
<inserted text>
$
l.167 \gplbacktext
The error is actually at lines 142--147, which say
\put(1474,1548){\makebox(0,0)[r]{\strut{}1.02\times10^{6}}}%
\put(1474,2498){\makebox(0,0)[r]{\strut{}1.04\times10^{6}}}%
\put(1474,3448){\makebox(0,0)[r]{\strut{}1.06\times10^{6}}}%
\put(1474,4399){\makebox(0,0)[r]{\strut{}1.08\times10^{6}}}%
\put(1474,5349){\makebox(0,0)[r]{\strut{}1.1\times10^{6}}}%
\put(1474,6299){\makebox(0,0)[r]{\strut{}1.12\times10^{6}}}%
which are labels for the y-axis. The \times stuff should be enclosed in dollar signs, and in fact if I do that, then I get what appears to be a valid output from latex.
The problem arises because your test script explicitly sets the tic format to '%h', but this is not correct for latex terminals. Here is the guidance from
help set format:I grant you that this bit of documentation may not be easy to find. A further subtlety is that the default format has a space in it. This is silently replaced internally with the latex default if output is to a latex terminal. Your script omits the space (
%hrather than% h) so the program does not recognize this as the default and thus does not make the replacement.Any of the following commands would work to restore the correct latex output:
If you want a non-default format for latex output you would have to include appropriate latex math markup.
Thanks for the info, I'll go back and fix up the code which generated that Gnuplot script. I've marked this ticket as "not a bug" accordingly.