我正在尝试设置中的/tikz/x
和属性,以便执行局部转换。看起来 到 的更改运行正常,但 到 的更改似乎没有任何作用。/tikz/y
{scope}
x
y
这里发生了什么?
\documentclass[border=1in]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,fit,calc}
\begin{document}
\tikzstyle{dimetric2}=[x={(0.935cm,-0.118cm)},z={(0cm,0.943cm)},y={(0.354cm,0.312cm)}]
\begin{tikzpicture}[dimetric2]
\draw[black,-latex] (-3,0,0) -- (3,0,0) node[right] {$e_x$};
\draw[black,-latex] (0,-3,0) -- (0,3,0) node[above right] {$e_y$};
\draw[black] (0,0,-1) -- (0,0,1);
% y= argument seems to do nothing
\begin{scoped}[x={(0.8, 0.6, 0)}, y={(-0.6, 0.8, 0)}]
\draw[thick,green] (0, 0, 0) -- (2, 0, 0);
\draw[thick,red] (0, 0, 0) -- (0, 2, 0);
\end{scoped}
% drawn without y=: fails identically
\begin{scoped}[x={(0.8, 0.6, 0)}]
\draw[thick,green] (0, 0, 1) -- (2, 0, 1);
\draw[thick,red] (0, 0, 1) -- (0, 2, 1);
\end{scoped}
\draw[black,-latex] (0,0,1) -- (0,0,3) node[above] {$n_o$};
\end{tikzpicture}
\end{document}
这里,两条绿线似乎都渲染正确,但是两条红线都渲染正确:
答案1
那是因为你写了“范围”代替“范围”。环境被调用scope
但命令被调用\scoped
。
我标记了更改%<--
\documentclass[border=1in]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,fit,calc}
\begin{document}
\tikzstyle{dimetric2}=[x={(0.935cm,-0.118cm)},z={(0cm,0.943cm)},y={(0.354cm,0.312cm)}]
\begin{tikzpicture}[dimetric2]
\draw[black,-latex] (-3,0,0) -- (3,0,0) node[right] {$e_x$};
\draw[black,-latex] (0,-3,0) -- (0,7,0) node[above right] {$e_y$};
\draw[black] (0,0,-1) -- (0,0,1);
% y= argument seems to do nothing
\begin{scope}[x={(0.8, 0.6)}, y={(-0.6, 0.8, 0)}]%<-- scope
\draw[thick,green] (0, 0, 0) -- (2, 0, 0);
\draw[thick,red] (0, 0, 0) -- (0, 2, 0);
\end{scope}%<-- scope (and not scoped !)
% drawn without y=: fails identically
\begin{scope}[x={(0.8, 0.6, 0)}]%<-- scope
\draw[thick,green] (0, 0, 1) -- (2, 0, 1);
\draw[thick,red] (0, 0, 1) -- (0, 2, 1);
\end{scope}%<-- scope
\draw[black,-latex] (0,0,1) -- (0,0,3) node[above] {$n_o$};
\end{tikzpicture}
\end{document}