Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to simply use the example of a cube provided here

    \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}

(originally from here).

I can't seem to get it to work for whatever reason. It's throwing an error about

l.382 text depth=0.25ex]

For some reason. Anybody have any insight into this? Thanks.

share|improve this question
1  
Are you including \usetikzlibrary{matrix}? Instead of code snippets, it is always best to compose a MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Nov 18 '11 at 17:34
1  
Can you add your packages etc. to the code above? If you make it a minimal working example then we'll have better information to help you. –  qubyte Nov 18 '11 at 17:35
    
Oops. Weird when that happens. –  qubyte Nov 18 '11 at 17:36
add comment

1 Answer

up vote 6 down vote accepted

Simply including \usepackage{tikz} and \usetikzlibrary{matrix} in the preamble, and wrapping your code within the LaTeX wrapper seems to work fine:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
    % The tikz code goes here
\end{document}

enter image description here

\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}
share|improve this answer
    
That \usetikzlibrary{matrix} was the kicker. Thanks Peter. –  Vincent Russo Nov 18 '11 at 17:44
2  
That's why I try to insist that people not post code snippets and include the \documentclass and all the packages they are using as then it would have been more obvious. –  Peter Grill Nov 18 '11 at 17:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.