如何“设置格式 x”以使格式对 gnuplot+cairolatex 有效

如何“设置格式 x”以使格式对 gnuplot+cairolatex 有效

我的gnuplot.plt设置如下

set term cairolatex pdf
set output "data.tex"
set nokey
plot 'data.csv' using 1:2 with lines,

我在 latex 中使用 gnuplot 的输出,如下所示

\begin{figure}
  \input{data.tex}
\end{figure} 

使用 lualatex 编译时,它可以正常工作,但如果我添加

set format x "%.0s 10^%S"

编译时生成data.tex此错误

! Missing $ inserted.
<inserted text>
$
l.129     \gplbacktext

我确实尝试过改变\( \)\gplbacktext格式字符串,但什么也没改变。

我的问题是我不明白如何在没有乳胶编译的情况下格式化我的轴,而这只会给我缺失的错误$

如果能给标签添加一些其他漂亮的乳胶魔法\frac{x}{y}就好了。\mu

gnuplot 的完整错误data.tex文件如下所示:

% GNUPLOT: LaTeX picture with Postscript
\begingroup
  \makeatletter
  \providecommand\color[2][]{%
    \GenericError{(gnuplot) \space\space\space\@spaces}{%
      Package color not loaded in conjunction with
      terminal option `colourtext'%
    }{See the gnuplot documentation for explanation.%
    }{Either use 'blacktext' in gnuplot or load the package
      color.sty in LaTeX.}%
    \renewcommand\color[2][]{}%
  }%
  \providecommand\includegraphics[2][]{%
    \GenericError{(gnuplot) \space\space\space\@spaces}{%
      Package graphicx or graphics not loaded%
    }{See the gnuplot documentation for explanation.%
    }{The gnuplot epslatex terminal needs graphicx.sty or graphics.sty.}%
    \renewcommand\includegraphics[2][]{}%
  }%
  \providecommand\rotatebox[2]{#2}%
  \@ifundefined{ifGPcolor}{%
    \newif\ifGPcolor
    \GPcolortrue
  }{}%
  \@ifundefined{ifGPblacktext}{%
    \newif\ifGPblacktext
    \GPblacktexttrue
  }{}%
  % define a \g@addto@macro without @ in the name:
  \let\gplgaddtomacro\g@addto@macro
  % define empty templates for all commands taking text:
  \gdef\gplbacktext{}%
  \gdef\gplfronttext{}%
  \makeatother
  \ifGPblacktext
    % no textcolor at all
    \def\colorrgb#1{}%
    \def\colorgray#1{}%
  \else
    % gray or color?
    \ifGPcolor
      \def\colorrgb#1{\color[rgb]{#1}}%
      \def\colorgray#1{\color[gray]{#1}}%
      \expandafter\def\csname LTw\endcsname{\color{white}}%
      \expandafter\def\csname LTb\endcsname{\color{black}}%
      \expandafter\def\csname LTa\endcsname{\color{black}}%
      \expandafter\def\csname LT0\endcsname{\color[rgb]{1,0,0}}%
      \expandafter\def\csname LT1\endcsname{\color[rgb]{0,1,0}}%
      \expandafter\def\csname LT2\endcsname{\color[rgb]{0,0,1}}%
      \expandafter\def\csname LT3\endcsname{\color[rgb]{1,0,1}}%
      \expandafter\def\csname LT4\endcsname{\color[rgb]{0,1,1}}%
      \expandafter\def\csname LT5\endcsname{\color[rgb]{1,1,0}}%
      \expandafter\def\csname LT6\endcsname{\color[rgb]{0,0,0}}%
      \expandafter\def\csname LT7\endcsname{\color[rgb]{1,0.3,0}}%
      \expandafter\def\csname LT8\endcsname{\color[rgb]{0.5,0.5,0.5}}%
    \else
      % gray
      \def\colorrgb#1{\color{black}}%
      \def\colorgray#1{\color[gray]{#1}}%
      \expandafter\def\csname LTw\endcsname{\color{white}}%
      \expandafter\def\csname LTb\endcsname{\color{black}}%
      \expandafter\def\csname LTa\endcsname{\color{black}}%
      \expandafter\def\csname LT0\endcsname{\color{black}}%
      \expandafter\def\csname LT1\endcsname{\color{black}}%
      \expandafter\def\csname LT2\endcsname{\color{black}}%
      \expandafter\def\csname LT3\endcsname{\color{black}}%
      \expandafter\def\csname LT4\endcsname{\color{black}}%
      \expandafter\def\csname LT5\endcsname{\color{black}}%
      \expandafter\def\csname LT6\endcsname{\color{black}}%
      \expandafter\def\csname LT7\endcsname{\color{black}}%
      \expandafter\def\csname LT8\endcsname{\color{black}}%
    \fi
  \fi
    \setlength{\unitlength}{0.0500bp}%
    \ifx\gptboxheight\undefined%
      \newlength{\gptboxheight}%
      \newlength{\gptboxwidth}%
      \newsavebox{\gptboxtext}%
    \fi%
    \setlength{\fboxrule}{0.5pt}%
    \setlength{\fboxsep}{1pt}%
\begin{picture}(7200.00,4320.00)%
    \gplgaddtomacro\gplbacktext{%
      \csname LTb\endcsname%
      \put(1155,595){\makebox(0,0)[r]{\strut{}$-0.00016$}}%
      \csname LTb\endcsname%
      \put(1155,1035){\makebox(0,0)[r]{\strut{}$-0.00014$}}%
      \csname LTb\endcsname%
      \put(1155,1475){\makebox(0,0)[r]{\strut{}$-0.00012$}}%
      \csname LTb\endcsname%
      \put(1155,1915){\makebox(0,0)[r]{\strut{}$-0.0001$}}%
      \csname LTb\endcsname%
      \put(1155,2355){\makebox(0,0)[r]{\strut{}$-8\times10^{-5}$}}%
      \csname LTb\endcsname%
      \put(1155,2795){\makebox(0,0)[r]{\strut{}$-6\times10^{-5}$}}%
      \csname LTb\endcsname%
      \put(1155,3235){\makebox(0,0)[r]{\strut{}$-4\times10^{-5}$}}%
      \csname LTb\endcsname%
      \put(1155,3675){\makebox(0,0)[r]{\strut{}$-2\times10^{-5}$}}%
      \csname LTb\endcsname%
      \put(1155,4115){\makebox(0,0)[r]{\strut{}$0$}}%
      \csname LTb\endcsname%
      \put(1257,409){\makebox(0,0){\strut{}1 10^-6}}%
      \csname LTb\endcsname%
      \put(1826,409){\makebox(0,0){\strut{}11 10^-6}}%
      \csname LTb\endcsname%
      \put(2396,409){\makebox(0,0){\strut{}21 10^-6}}%
      \csname LTb\endcsname%
      \put(2965,409){\makebox(0,0){\strut{}31 10^-6}}%
      \csname LTb\endcsname%
      \put(3534,409){\makebox(0,0){\strut{}41 10^-6}}%
      \csname LTb\endcsname%
      \put(4103,409){\makebox(0,0){\strut{}51 10^-6}}%
      \csname LTb\endcsname%
      \put(4673,409){\makebox(0,0){\strut{}61 10^-6}}%
      \csname LTb\endcsname%
      \put(5242,409){\makebox(0,0){\strut{}71 10^-6}}%
      \csname LTb\endcsname%
      \put(5811,409){\makebox(0,0){\strut{}81 10^-6}}%
      \csname LTb\endcsname%
      \put(6381,409){\makebox(0,0){\strut{}91 10^-6}}%
    }%
    \gplgaddtomacro\gplfronttext{%
      \csname LTb\endcsname%
      \put(144,2355){\rotatebox{-270}{\makebox(0,0){\strut{}Bias Currents [A]}}}%
      \csname LTb\endcsname%
      \put(4075,130){\makebox(0,0){\strut{}M1 width [um]}}%
    }%
    \gplbacktext
    \put(0,0){\includegraphics{thresholdReferenceCurrentSource_W1vsW2_10samples}}%
    \gplfronttext
  \end{picture}%
\endgroup

我的系统是

This is LuaTeX, Version 1.0.4 (TeX Live 2017/Debian)
gnuplot 5.0 patchlevel 7

相关内容