去年我在 Mac 上使用过 matlab2tikz,效果非常好。现在我在 Ubuntu 上使用它,遇到了一些问题。仅供参考,我安装了 texlive-full,其中包含 pgf 2.1,在我的序言中我添加了 \usepackage{tikz} 和 \usepackage{pgfplots}。当我在 KILE 中编译我的 latex 文档(beamer 类)时,我收到以下错误消息:
`(./TIKZTest.tikz
! Missing \endcsname inserted.
<to be read again>
\def
l.25 };
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.25 };
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.25 };
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.25 };
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.25 };
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.25 };
! Undefined control sequence.
<recently read> \pgfplotstable@loc@TMPa
l.25 };
! Package pgfplots Error: The requested list entry with index 0 of \pgfplots@ta
ble is too large; this list has not enough elements..
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
...
l.25 };
! Package pgfplots Error: Sorry, could not retrieve column '' from table '\\pgf
plots@table@@table@name '. Please check spelling (or introduce name aliases)..
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
...
l.25 };
! Package pgfplots Error: The requested list entry with index 1 of \pgfplots@ta
ble is too large; this list has not enough elements..
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
...
l.25 };
! Package pgfplots Error: Sorry, could not retrieve column '' from table '\\pgf
plots@table@@table@name '. Please check spelling (or introduce name aliases)..
See the pgfplots package documentation for explanation.
Type H <return> for immediate help.
...
l.25 };
! Package pgfplots Warning: the current plot has no coordinates (left?)
! Package pgfkeys Error: I do not know the key '/tikz/legend cell align' and I
am going to ignore it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H <return> for immediate help.
...
l.28 \end{axis}
) <use Queenslscapelogocmyk-eps-converted-to.pdf>
<use Aqua-spot-rgb-clear10025.jpg> <use TUHHLogo-eps-converted-to.pdf> [10]
(./GroupSemPres.aux)
LaTeX Font Warning: Size substitutions with differences
(Font) up to 1.0pt have occurred.
LaTeX Font Warning: Some font shapes were not available, defaults substituted.
)`
它确实显示了坐标系和图例,但没有绘制任何数据。我刚刚发现,当我将数据作为坐标而不是表格提供时,它确实会绘制一些东西。Linux 上的 tikz 中的表格可能存在一般问题,或者我遗漏了什么。否则,我必须将 matlab2tikz 给我的整个 tikz 文件转换为坐标列表。
这是我从 matlab2tikz 获得的 tikz 文件(我删除了一些数据以使其更短):
% This file was created by matlab2tikz v0.4.7 running on MATLAB 8.1.
% Copyright (c) 2008--2014, Nico Schlömer <[email protected]>
% All rights reserved.
% Minimal pgfplots version: 1.3
%
% The latest updates can be retrieved from
% http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz
% where you can also make suggestions and rate matlab2tikz.
%
\begin{tikzpicture}
\begin{axis}[%
width=5cm,
height=4cm,
scale only axis,
xmin=0,
xmax=0.018,
ymin=0.00015,
ymax=0.0005,
legend style={draw=black,fill=white,legend cell align=left}
]
\addplot [color=blue,solid]
table[row sep=crcr]{0 0.000311697265625003\\
0.001953125 0.000321697265625003\\
};
\addlegendentry{wp1Exp};
\end{axis}
\end{tikzpicture}%