我只是想使用这里提供的立方体示例
\begin{tikzpicture}[
back line/.style={densely dotted},
cross line/.style={preaction={draw=white, -,
line width=6pt}}]
\matrix (m) [matrix of math nodes,
row sep=3em, column sep=3em,
text height=1.5ex,
text depth=0.25ex]{
& f^\ast E_V & & E_V \\
f^\ast E & & E \\
& U & & V \\
M & & N \\
};
\path[->]
(m-1-2) edge (m-1-4)
edge (m-2-1)
edge [back line] (m-3-2)
(m-1-4) edge (m-3-4)
edge (m-2-3)
(m-2-1) edge [cross line] (m-2-3)
edge (m-4-1)
(m-3-2) edge [back line] (m-3-4)
edge [back line] (m-4-1)
(m-4-1) edge (m-4-3)
(m-3-4) edge (m-4-3)
(m-2-3) edge [cross line] (m-4-3);
\end{tikzpicture}
(最初是从这里)。
不管出于什么原因,我似乎无法让它工作。它抛出一个错误
l.382 text depth=0.25ex]
出于某种原因。有人对此有任何见解吗?谢谢。
答案1
只需在序言中包含\usepackage{tikz}
和,并将代码包装在 LaTeX 包装器中就可以了:\usetikzlibrary{matrix}
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
% The tikz code goes here
\end{document}
\documentclass{article}
\usepackage{tikz}% Added to code
\usetikzlibrary{matrix}% Added to code
\begin{document}
\begin{tikzpicture}[
back line/.style={densely dotted},
cross line/.style={preaction={draw=white, -,
line width=6pt}}]
\matrix (m) [matrix of math nodes,
row sep=3em, column sep=3em,
text height=1.5ex,
text depth=0.25ex]{
& f^\ast E_V & & E_V \\
f^\ast E & & E \\
& U & & V \\
M & & N \\
};
\path[->]
(m-1-2) edge (m-1-4)
edge (m-2-1)
edge [back line] (m-3-2)
(m-1-4) edge (m-3-4)
edge (m-2-3)
(m-2-1) edge [cross line] (m-2-3)
edge (m-4-1)
(m-3-2) edge [back line] (m-3-4)
edge [back line] (m-4-1)
(m-4-1) edge (m-4-3)
(m-3-4) edge (m-4-3)
(m-2-3) edge [cross line] (m-4-3);
\end{tikzpicture}
\end{document}