tikz input/includestandalone 使用轴大多产生缺失/额外的{}

tikz input/includestandalone 使用轴大多产生缺失/额外的{}

\includestandalone我尝试使用(或如果需要)包含几个图形\input。我自己的简单tikzpictureasstandalone无法axis编译,我创建的那些图形也无法编译,例如使用 matlab2tikz。简单standalone tikzpictureascircuittikz工作得很好。\input非独立版的简单版tikzpicture也行不通,但我想使用独立版。我使用的是 KOMA 脚本的衍生版(tudscr在 CTAN),但问题类似。

随着tudscrbook误差的产生Missing }...Extra {...左右\end{axis}。随着scrartcl它说Undefiend control sequence. \end{axis}

但真正奇怪的是,simpliertikzpictures编译得很好,我还没搞清楚它们之间有什么区别。第一个代码是主文件,后面是一个standalone不起作用的示例,还有一个 simplier 起作用(都是用 matlab2tikz 创建的)。使用scrartcl第一个会产生Undefined control sequence. \end{axis}


\documentclass{scrartcl}
\usepackage{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
    \pgfplotsset{compat=newest}
\begin{document}

%\input{data.tex}
\includestandalone{data1}

\end{document}
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
%  http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{grffile}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{amsmath}

\begin{document}
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
\definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}%
%
\begin{tikzpicture}

\begin{axis}[%
width=20.667in,
height=1.756in,
at={(3.467in,11.31in)},
scale only axis,
unbounded coords=jump,
xmin=738356.606597222,
xmax=738356.609375,
xtick={738356.606597222,738356.606944444,738356.607291667,738356.607638889,738356.607986111,738356.608333333,738356.608680556,738356.609027778,738356.609375},
xticklabels={{14:33:30.000},{14:34:00.000},{14:34:30.000},{14:35:00.000},{14:35:30.000},{14:36:00.000},{14:36:30.000},{14:37:00.000},{14:37:30.000}},
scaled x ticks=false,
ymin=0,
ymax=8,
ylabel style={font=\color{white!15!black}},
ylabel={$\text{Strom I}_\text{A}\text{C in A}$},
axis background/.style={fill=white},
xmajorgrids,
ymajorgrids,
legend style={legend cell align=left, align=left, draw=white!15!black}
]
\addplot [color=mycolor1, line width=2.0pt]
  table[row sep=crcr]{%
738356.606942882    0.8\\
738356.606954734    0.8\\
738356.606966053    0.8\\
738356.606977604    0.8\\
738356.606989225    0.8\\
738356.607000729    0.8\\
738356.607290313    6.4\\
738356.607301667    6.4\\
738356.60731338 6.4\\
738356.607326157    6.4\\
738356.607336389    6.4\\
738356.607347963    6.4\\
738356.609095648    6.5\\
738356.609107222    6.5\\
738356.609118796    6.5\\
738356.60913037 6.5\\
738356.609142083    6.5\\
738356.609153542    6.5\\
738356.609165185    6.5\\
738356.60917669 6.5\\
738356.609188252    6.5\\
738356.609201227    6.5\\
738356.609211412    6.5\\
738356.609222975    6.5\\
738356.60923456 1.1\\
738356.609246123    1.1\\
738356.609257674    1.1\\
738356.609269398    1.1\\
};
%\addlegendentry{A}
\end{axis}
\end{tikzpicture}%
\end{document}
% This file was created by matlab2tikz.
%
%The latest updates can be retrieved from
%  http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz
%where you can also make suggestions and rate matlab2tikz.
%
\documentclass[tikz]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usepackage{grffile}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{amsmath}

\begin{document}
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
%
\begin{tikzpicture}

\begin{axis}[%
width=4.521in,
height=3.566in,
at={(0.758in,0.481in)},
scale only axis,
xmin=1,
xmax=4,
ymin=0,
ymax=100,
axis background/.style={fill=white}
]
\addplot [color=mycolor1, forget plot]
  table[row sep=crcr]{%
1   10\\
2   100\\
3   1\\
4   50\\
};
\end{axis}
\end{tikzpicture}%
\end{document}

答案1

此问题是由于_图例 ode 标签内的问题。在给出的示例中,由于 mathmode,这应该很明显。但是,即使在标签或图例中没有 mathmode 的情况下使用,也会出现此问题。可能是由于axistex 文件中的 -environment ,在下划线前应始终使用反斜杠\_

相关内容