我已经生成了一个tikz
.tex
文件gnuplot
,并试图将其简单地\include{mytikzfile}
放在我的主.tex
文件中,该文件使用了revtex4-1
文档类。在编译时,我得到了一些与颜色相关的错误,包括
! Package xcolor Error: Undefined color `color=gp lt color border'.
! Package xcolor Error: Undefined color `color=gp lt color 0'.
还有一些其他图片都是 xcolor 错误。图片显示出来但全是黑色。我可以让其他tikz
图片有颜色,而且制作得很好。上面的图片是我想要看到的(我用gnuplot
的选项生成了它)。下面的图片是我通过包含使用该选项时生成的文件set term epslatex standalone color
得到的。.tex
gnuplot
set term tikz
这是一个更简单的.tex
文件,gnuplot
它也应该包含颜色,但实际上却没有(同样的xcolor
错误)。
\begin{tikzpicture}[gnuplot]
%% generated with GNUPLOT 4.6p3 (Lua 5.2; terminal rev. 99, script rev. 100)
%% Sat Jul 20 19:15:08 2013
\path (0.000,0.000) rectangle (12.500,8.750);
\gpcolor{color=gp lt color border}
\gpsetlinetype{gp lt border}
\gpsetlinewidth{1.00}
\draw[gp path] (1.012,0.616)--(1.192,0.616);
\draw[gp path] (11.947,0.616)--(11.767,0.616);
\node[gp node right] at (0.828,0.616) { 0};
\draw[gp path] (1.012,2.169)--(1.192,2.169);
\draw[gp path] (11.947,2.169)--(11.767,2.169);
\node[gp node right] at (0.828,2.169) { 5};
\draw[gp path] (1.012,3.722)--(1.192,3.722);
\draw[gp path] (11.947,3.722)--(11.767,3.722);
\node[gp node right] at (0.828,3.722) { 10};
\draw[gp path] (1.012,5.275)--(1.192,5.275);
\draw[gp path] (11.947,5.275)--(11.767,5.275);
\node[gp node right] at (0.828,5.275) { 15};
\draw[gp path] (1.012,6.828)--(1.192,6.828);
\draw[gp path] (11.947,6.828)--(11.767,6.828);
\node[gp node right] at (0.828,6.828) { 20};
\draw[gp path] (1.012,8.381)--(1.192,8.381);
\draw[gp path] (11.947,8.381)--(11.767,8.381);
\node[gp node right] at (0.828,8.381) { 25};
\draw[gp path] (1.012,0.616)--(1.012,0.796);
\draw[gp path] (1.012,8.381)--(1.012,8.201);
\node[gp node center] at (1.012,0.308) { 0};
\draw[gp path] (3.199,0.616)--(3.199,0.796);
\draw[gp path] (3.199,8.381)--(3.199,8.201);
\node[gp node center] at (3.199,0.308) { 1};
\draw[gp path] (5.386,0.616)--(5.386,0.796);
\draw[gp path] (5.386,8.381)--(5.386,8.201);
\node[gp node center] at (5.386,0.308) { 2};
\draw[gp path] (7.573,0.616)--(7.573,0.796);
\draw[gp path] (7.573,8.381)--(7.573,8.201);
\node[gp node center] at (7.573,0.308) { 3};
\draw[gp path] (9.760,0.616)--(9.760,0.796);
\draw[gp path] (9.760,8.381)--(9.760,8.201);
\node[gp node center] at (9.760,0.308) { 4};
\draw[gp path] (11.947,0.616)--(11.947,0.796);
\draw[gp path] (11.947,8.381)--(11.947,8.201);
\node[gp node center] at (11.947,0.308) { 5};
\draw[gp path] (1.012,8.381)--(1.012,0.616)--(11.947,0.616)--(11.947,8.381)--cycle;
\node[gp node right] at (2.300,8.047) {Points};
\gpcolor{color=gp lt color 0}
\gpsetpointsize{4.00}
\gppoint{gp mark 1}{(1.012,0.616)}
\gppoint{gp mark 1}{(3.199,0.927)}
\gppoint{gp mark 1}{(5.386,1.858)}
\gppoint{gp mark 1}{(7.573,3.411)}
\gppoint{gp mark 1}{(9.760,5.586)}
\gppoint{gp mark 1}{(11.947,8.381)}
\gppoint{gp mark 1}{(2.942,8.047)}
\gpcolor{color=gp lt color border}
\draw[gp path] (1.012,8.381)--(1.012,0.616)--(11.947,0.616)--(11.947,8.381)--cycle;
%% coordinates of the plot area
\gpdefrectangularnode{gp plot 1}{\pgfpoint{1.012cm}{0.616cm}}{\pgfpoint{11.947cm}{8.381cm}}
\end{tikzpicture}
%% gnuplot variables
以及它产生的结果(点应该是红色的):
答案1
我知道这个问题已经得到解答了。但我不同意,因为我认为答案应该是通用的,而不需要从用户很可能无法直接访问的其他操作系统复制文件。
如果机器上安装了带有 lua 即 tikz 终端的 gnuplot:
要生成各种 TeX 风格的样式文件和包装器,请输入
lua gnuplot-tikz.lua style
在命令行上。生成的文件应该是
t-gnuplot-lua-tikz.tex (Context wrapper)
gnuplot-lua-tikz.tex (plain TeX wrapper)
gnuplot-lua-tikz.sty (LaTeX wrapper)
gnuplot-lua-tikz-common.tex (common definitions)
并可复制到适当的地方。
答案2
Linux 解决方案(texlive-full
通过 Synaptic 包管理器安装):
错误源于使用过时的样式文件:gnuplot-lua-tikz.sty
TeXlive 自带的默认样式文件没有问题,使用在线找到的样式文件会破坏编译
Mac解决方案(安装了MacTeX 2013):
MacTeX 似乎没有以任何形式安装。我从安装了上述文件的 Linux 机器上gnuplot-lua-tikz.sty
复制了文件,并将这些文件放在我的主文件的目录中。这解决了 Mac 上的问题。/usr/share/texlive/.../gnuplot
texlive
.tex