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 am trying to get TikZ decorations to work, but so far without success. In this minimal example, I am trying to compile an example found in pgfmanual.pdf in section 20.2:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations}

\begin{document}
    \begin{tikzpicture}
        \draw decorate [decoration=zigzag] {(0,0) -- (2,2)};
    \end{tikzpicture}
\end{document}

I always get this error

"! Package pgfkeys Error: I do not know the key '/pgf/decoration/crosses'
and I am going to ignore it. Perhaps you misspelled it."

What is the problem?

share|improve this question
    
The section 20.2 is called Specifying a Uniform Opacity in the current version of PGF (2.10) and has nothing to do with decorations but transparency. I assume you have an older version. Some LaTeX distributions (e.g. Ubuntu TeXLive) don't update the packages often. It would be much better to state the section title instead. –  Martin Scharrer May 17 '11 at 17:09
    
Found it. In v2.10 it is section 21.2, named Decorating a Subpath Using the Decorate Path Command. –  Martin Scharrer May 17 '11 at 17:17
    
@Jake: There was no reason to delete your answer. I wrote my one in my editor to test it and didn't reload the page before posting mine, so I didn't saw yours. It's OK to have similar answers around. Just let the people decide which one to up-vote. I hope I didn't bullied you or something ;-) –  Martin Scharrer May 17 '11 at 17:26
    
General advice on the TikZ/PGF manual section numbering problem, include the name of the subsection and the version of TikZ/PGF that you're using. –  Loop Space May 17 '11 at 18:20
    
I think the wrong error message was quoted. Shouldn't it be /pgf/decoration/zigzag?.Anyway: /pgf/decoration/crosses belongs to \usetikzlibrary{decorations.shapes} just in case someone else comes from google. –  someonr Jan 2 at 15:35

1 Answer 1

up vote 11 down vote accepted

You need to also load the (sub-)library for the particular decoration (decorations.pathmorphing for zigzag). See also section 30 Decoration Library for more information (using PGF 2.10, the section number can be different for other versions).

On issue with the otherwise great pgfmanual is, that it is hard to know which libraries are required for the examples.

\documentclass{article}

\usepackage{tikz}
%\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
    \begin{tikzpicture}
        \draw decorate [decoration={zigzag}] {(0,0) -- (2,2)};
    \end{tikzpicture}
\end{document}
share|improve this answer
    
Thank you! I agree with you upon required libraries being not very well documented. I will keep the changing section numbers in mind. –  Turion May 17 '11 at 17:20

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.