![Tkiz编译错误无法解决](https://linux22.com/image/394128/Tkiz%E7%BC%96%E8%AF%91%E9%94%99%E8%AF%AF%E6%97%A0%E6%B3%95%E8%A7%A3%E5%86%B3.png)
我正在尝试在 Tkiz 中制作一个图形,但是现在它给了我这个模糊的编译超时错误,并且没有指示是什么原因导致的,这是图形。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds, positioning,arrows,automata,shadows,fit,shapes,intersections,calc,arrows,decorations.pathmorphing,intersections}
\begin{document}
\tracingall
\begin{tikzpicture}[
>=stealth,
donor/.style={shade, ball color=red},
acceptor/.style={shade, ball color=blue},
electron/.style={shade, ball color=black},
vacancy/.style={shade, ball},
background/.style={ball color=blue!20, opacity=0.4},]
%Draw the donor atoms
\foreach \x in {1,1.5,2,3,3.5}
\draw [donor] (\x,1,-0.5) circle (0.25cm);
%Draw the acceptor atoms
\foreach \x in {6,6.5,7,7.5,8,8.5}
\draw [acceptor] (\x,0.55,-0.2) circle (0.25cm);
%Draw the electrons molecules
\draw [electron] (1.5,3.8) circle (0.15cm);
%Draw excitation arrows showing the electrons going to the excited state
\draw (2.5,1) -- (2.5,4.4) [->,thick];
\draw (7,3.4) -- (7,1) [->,thick];
\draw (3.5,4.5) -- (6.3,3.5) [->,thick, color=red];
%draw vacancy
\shadedraw [vacancy] (2.5,1) circle (0.25cm)
node [above=3pt,right=2pt] {\small{2-}};
%Draw orbital levels
\draw (1.5,4.5) -- (3.5,4.5) [--,very thick];
\draw (1.5,1.5) -- (3.5,1.5) [--,very thick];
\draw (6.3,3.5) -- (8.3,3.5) [--,very thick];
\draw (6.3,1) -- (8.3,1) [--,very thick];
%Draw the background
%\begin{scope}
% \clip (1,1) rectangle (8.5,5);
% \draw[background] (4.5,1,-0.5) circle (3.5cm);
%\end{scope}
\end{tikzpicture}
\end{document}
答案1
我更改了vacancy
样式:ball
->,ball color=white
并将--
轨道级别中的替换为,以-
使其编译。您加载的所有库都不需要。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,backgrounds, positioning,arrows,automata,shadows,fit,shapes,intersections,calc,arrows,decorations.pathmorphing,intersections}
\begin{document}
%\tracingall
\begin{tikzpicture}[
>=stealth,
donor/.style={shade, ball color=red},
acceptor/.style={shade, ball color=blue},
electron/.style={shade, ball color=black},
vacancy/.style={shade, ball color=white},
background/.style={ball color=blue!20, opacity=0.4},]
%Draw the donor atoms
\foreach \x in {1,1.5,2,3,3.5}
\draw [donor] (\x,1,-0.5) circle (0.25cm);
%Draw the acceptor atoms
\foreach \x in {6,6.5,7,7.5,8,8.5}
\draw [acceptor] (\x,0.55,-0.2) circle (0.25cm);
%Draw the electrons molecules
\draw [electron] (1.5,3.8) circle (0.15cm);
%Draw excitation arrows showing the electrons going to the excited state
\draw (2.5,1) -- (2.5,4.4) [->,thick];
\draw (7,3.4) -- (7,1) [->,thick];
\draw (3.5,4.5) -- (6.3,3.5) [->,thick, color=red];
%draw vacancy
\shadedraw [vacancy] (2.5,1) circle (0.25cm)
node [above=3pt,right=2pt] {\small{2-}};
%Draw orbital levels
\draw (1.5,4.5) -- (3.5,4.5) [-,very thick];
\draw (1.5,1.5) -- (3.5,1.5) [-,very thick];
\draw (6.3,3.5) -- (8.3,3.5) [-,very thick];
\draw (6.3,1) -- (8.3,1) [-,very thick];
%Draw the background
%\begin{scope}
% \clip (1,1) rectangle (8.5,5);
% \draw[background] (4.5,1,-0.5) circle (3.5cm);
%\end{scope}
\end{tikzpicture}
\end{document}
我也不明白你为什么要在 3d 和 2d 坐标之间来回切换。这是一种尝试在某种程度上统一坐标。
\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary{shapes,backgrounds, positioning,arrows,automata,shadows,fit,shapes,intersections,calc,arrows,decorations.pathmorphing,intersections}
\begin{document}
%\tracingall
\begin{tikzpicture}[
>=stealth,
donor/.style={shade, ball color=red},
acceptor/.style={shade, ball color=blue},
electron/.style={shade, ball color=black},
vacancy/.style={shade, ball color=white, opacity=0.4},
background/.style={ball color=blue!20, opacity=0.4},]
%Draw the donor atoms
\foreach \x in {1,1.5,2,3,3.5}
\draw [donor] (\x,1,-0.5) circle (0.25cm);
%Draw the acceptor atoms
\foreach \x in {6,6.5,7,7.5,8,8.5}
\draw [acceptor] (\x,0.55,-0.2) circle (0.25cm);
%Draw the electrons molecules
\draw [electron] (2.5,4.55,-0.5) circle (0.15cm);
%Draw excitation arrows showing the electrons going to the excited state
\draw (2.5,1,-0.5) -- (2.5,4.4,-0.5) [->,thick];
\draw (7,3.4) -- (7,1) [->,thick];
\draw (3.5,4.5) -- (6.3,3.5) [->,thick, color=red];
%draw vacancy
\shade[vacancy] (2.5,1,-0.5) circle (0.25cm)
node [above=3pt,right=2pt,font=\small] {2-};
%Draw orbital levels
\draw (1.5,4.5) -- (3.5,4.5) [-,very thick];
\draw (1.5,1.5) -- (3.5,1.5) [-,very thick];
\draw (6.3,3.5) -- (8.3,3.5) [-,very thick];
\draw (6.3,1) -- (8.3,1) [-,very thick];
%Draw the background
%\begin{scope}
% \clip (1,1) rectangle (8.5,5);
% \draw[background] (4.5,1,-0.5) circle (3.5cm);
%\end{scope}
\end{tikzpicture}
\end{document}