我使用以下代码来生成图表
\documentclass{article}
\usepackage{xcolor} % colorize your documents
\usepackage{graphicx} % and use graphics
\usepackage{tikz,pgfplots} % cool tikz-package for drawing
% improve the default settings for coordinate system drawing
\pgfplotsset{%
default/.style={grid=major,
axis lines=middle,
inner axis line style={=>},
legend style={at={( 1.1,1)}, anchor=north west}}
}
\begin{document}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[default,
xlabel=$x$,
ylabel=$\vert x\vert$
]
% invoke external gnuplot as
\addplot[thick,cyan,domain=-5.5:5.5] gnuplot[id=abs]{abs(x)};
\addlegendentry{$\vert x\vert$};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
我用pdflatex在 Ubuntu 13.10 和 Debian Squeeze 上。我得到了不同的结果:
Debian:
Ubuntu:
也许不同的软件包版本有不同的颜色定义。调查原因的最佳方法是什么?
编辑:“\listfiles”给我(在 debian 上):
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2010/03/12 v0.04p Graphics/color for pdfTeX
dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
在 Ubuntu 上
*File List*
article.cls 2007/10/19 v1.4h Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
dvipsnam.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)