# tikzpicture trivial example does not work

I have copied example ASIS here from the page 819 but it gives error:

SOURCE:

====================================

\documentclass{article}
\usepackage{amsmath,amssymb,tikz-cd}
\usetikzlibrary{graphs}

\begin{document}

\begin{tikzcd}
D\arrow[r,tail,harpoon ,dashed] & B
\end{tikzcd}

\begin{tikzpicture}
\draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
\end{tikzpicture}

\tikz \graph { a -> {b, c} -> d };

\begin{tikzpicture}
\node {root}
[clockwise from=30,sibling angle=30]
child {node{$30$}}
child {node{$0$}}
child {node{$-30$}}
child {node{$-60$}};
\end{tikzpicture}

\end{document}


====================================

Command Line: bibtex.exe "ideje5" Startup Folder:

C:\Users\hynek0\Desktop\TH0dipl

> This is BibTeX, Version 0.99d (MiKTeX 2.9 64-bit) The top-level
> auxiliary file: ideje5.aux I found no \citation commands---while
> file ideje5.aux I found no \bibstyle command---while reading file
> ideje5.aux (There were 3 error messages)


Command Line: pdflatex.exe --interaction=errorstopmode --synctex=-1 "C:\Users\hynek0\Desktop\TH0dipl\ideje5.tex" Startup Folder: C:\Users\hynek0\Desktop\TH0dipl

This is pdfTeX, Version 3.14159265-2.6-1.40.15 (MiKTeX 2.9 64-bit)
entering extended mode
(C:/Users/hynek0/Desktop/TH0dipl/ideje5.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 68 languages loaded.
(D:\ProgramFiles\MikTexExe\tex\latex\base\article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:\ProgramFiles\MikTexExe\tex\latex\base\size10.clo))
(D:\ProgramFiles\MikTexExe\tex\latex\amsmath\amsmath.sty
For additional information on amsmath, use the ?' option.
(D:\ProgramFiles\MikTexExe\tex\latex\amsmath\amstext.sty
(D:\ProgramFiles\MikTexExe\tex\latex\amsmath\amsgen.sty))
(D:\ProgramFiles\MikTexExe\tex\latex\amsmath\amsbsy.sty)
(D:\ProgramFiles\MikTexExe\tex\latex\amsmath\amsopn.sty))
(D:\ProgramFiles\MikTexExe\tex\latex\amsfonts\amssymb.sty
(D:\ProgramFiles\MikTexExe\tex\latex\amsfonts\amsfonts.sty))
(D:\ProgramFiles\MikTexExe\tex\latex\tikz-cd\tikz-cd.sty
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\frontendlayer\tikz.sty
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\basiclayer\pgf.sty
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\utilities\pgfrcs.sty
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfutil-common.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfutil-common-lists.tex))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfutil-latex.def
(D:\ProgramFiles\MikTexExe\tex\latex\ms\everyshi.sty))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfrcs.code.tex))
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\basiclayer\pgfcore.sty
(D:\ProgramFiles\MikTexExe\tex\latex\graphics\graphicx.sty
(D:\ProgramFiles\MikTexExe\tex\latex\graphics\keyval.sty)
(D:\ProgramFiles\MikTexExe\tex\latex\graphics\graphics.sty
(D:\ProgramFiles\MikTexExe\tex\latex\graphics\trig.sty)
(D:\ProgramFiles\MikTexExe\tex\latex\00miktex\graphics.cfg)
(D:\ProgramFiles\MikTexExe\tex\latex\pdftex-def\pdftex.def
(D:\ProgramFiles\MikTexExe\tex\generic\oberdiek\infwarerr.sty)
(D:\ProgramFiles\MikTexExe\tex\generic\oberdiek\ltxcmds.sty))))
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\systemlayer\pgfsys.sty
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgfsys.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfkeys.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfkeysfiltered.code.tex))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgf.cfg)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgfsys-pdftex.def
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgfsys-common-pdf.def)))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgfsyssoftpath.code.tex
)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\systemlayer\pgfsysprotocol.code.tex)
) (D:\ProgramFiles\MikTexExe\tex\latex\xcolor\xcolor.sty
(D:\ProgramFiles\MikTexExe\tex\latex\00miktex\color.cfg))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcore.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmath.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathcalc.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathutil.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathparser.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.basic.code.tex
)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.trigonometric.
code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.random.code.te
x)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.comparison.cod
e.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.base.code.tex)

(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.round.code.tex
)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.misc.code.tex)

(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfunctions.integerarithme
tics.code.tex)))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmathfloat.code.tex))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorepoints.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorepathconstruct.code
.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorepathusage.code.tex
) (D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorescopes.code.tex)

(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoregraphicstate.code.
tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoretransformations.co
de.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorequick.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoreobjects.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorepathprocessing.cod
e.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorearrows.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoreimage.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoreexternal.code.tex)
) (D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorelayers.code.tex)

(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcoretransparency.code.
tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\basiclayer\pgfcorepatterns.code.tex)
)) (D:\ProgramFiles\MikTexExe\tex\generic\pgf\modules\pgfmoduleshapes.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\modules\pgfmoduleplot.code.tex)
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\compatibility\pgfcomp-version-0-65.sty
)
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\compatibility\pgfcomp-version-1-18.sty
)) (D:\ProgramFiles\MikTexExe\tex\latex\pgf\utilities\pgffor.sty
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\utilities\pgfkeys.sty
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgfkeys.code.tex))
(D:\ProgramFiles\MikTexExe\tex\latex\pgf\math\pgfmath.sty
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmath.code.tex))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\utilities\pgffor.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\math\pgfmath.code.tex)))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\frontendlayer\tikz\tikz.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\libraries\pgflibraryplothandlers.cod
e.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\modules\pgfmodulematrix.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\frontendlayer\tikz\libraries\tikzlib
rarytopaths.code.tex)))
(D:\ProgramFiles\MikTexExe\tex\generic\tikz-cd\tikzlibrarycd.code.tex
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\frontendlayer\tikz\libraries\tikzlib
rarymatrix.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\frontendlayer\tikz\libraries\tikzlib
raryquotes.code.tex)
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\libraries\pgflibraryarrows.meta.code
.tex)))
(D:\ProgramFiles\MikTexExe\tex\generic\pgf\frontendlayer\tikz\libraries\graphs\
tikzlibrarygraphs.code.tex) (ideje5.aux) ABD: EveryShipout initializing macros
(D:\ProgramFiles\MikTexExe\tex\context\base\supp-pdf.mkii
) (D:\ProgramFiles\MikTexExe\tex\latex\amsfonts\umsa.fd)
(D:\ProgramFiles\MikTexExe\tex\latex\amsfonts\umsb.fd)

! Package pgfkeys Error: I do not know the key '/tikz/clockwise from', to which
you passed '30', and I am going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
...

l.19 [clockwise from=30,sibling angle=30]

?

! Emergency stop.
...

l.19 [clockwise from=30,sibling angle=30]

!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on ideje5.log.

Process has been killed ...

• E.g. \usetikzlibrary{graphs,mindmap} works. The greatest challenge when using examples from the manual is to know which libraries are needed to compile a given example. – marmot Jan 20 at 19:43
• Yes, it does...how could I have it found myself without asking? – user2925716 Jan 20 at 19:53
• In this case: scroll up one page and see that page 819 is in a section that describes the features of the trees library, meaning all the examples there assume that you have \usetikzlibrary{trees}. – Torbjørn T. Jan 20 at 20:13
• @marmot But your answer, though not optimal in this case, has described a way how to search for a solution in general. Could you please give back a relevant part of it? – user2925716 Jan 20 at 20:31
• @user2925716 I undeleted it. Please have a look. At least you gave me a nice idea what to suggest to the chief maintainers of TikZ, I may even volunteer to add the library information to the manual, if they permit it. – marmot Jan 20 at 22:51

In this case, you can see that the example you have copied is from the page where the clockwise from key is described, which is the key causing the error. If you scroll up from page 819 you'll quickly find that clockwise from is in a section of the manual discussing the features of the trees library, so all examples assume \usetikzlibrary{trees} (I would think).

marmot suggested in his deleted answer to search the manual for clockwise from. He first found it on page 707, in a section describing the mindmap library. Because mindmap loads the trees library, \usetikzlibrary{mindmap} would also make clockwise from available.

However, here you could make use of a useful feature of the manual: most key names in examples and text are hyperlinks to the place where that key is described. So when you find clockwise from on page 707, you can click on it in the example code, and you'll find yourself on page 819, where clockwise from is described. A quick scroll up will identify the library.

(Not all such hyperlinks are correct, and I think there are a things that are not hyperlinked, but still a nice thing to keep in mind.)

I view this as a question on how to identify and solve problems of this kind. Undeleted upon request. This answer describes a way that works in many cases. As pointed out in this nice answer by Torjørn T., in this case this method actually loads effectively a bit more libraries as absolutely needed.

# 1. Identifying the problem

! Package pgfkeys Error: I do not know the key '/tikz/clockwise from', to which
you passed '30', and I am going to ignore it. Perhaps you misspelled it.

See the pgfkeys package documentation for explanation.
Type  H <return>  for immediate help.
...

l.19 [clockwise from=30,sibling angle=30]


so you know that there must be some library (or package) that defines clockwise from.

# 2. Identifying the missing library

## a. Search the manual

Most pdf viewers allow you to search for strings separated by spaces by wrapping them in " signs. With preview on Mac OS the first hit is on p. 707. If I then scroll back to the start of the section, I find

 \usetikzlibrary{mindmap}


which is the ingredient that turns your code in a compilable document.

When I do a Google search for

 site:tex.stackexchange.com "clockwise from"


I get dragged to this post. There I find \usetikzlibrary{mindmap,trees}. As Torbjørn points out, this is actually an overkill since trees would have been sufficient. (This, BTW, is one of the reasons why users here often get asked to abandon packages that are not needed. Otherwise it is hard for others to see what's going on. Ironically, I had the last two sentences in my original answer, and precisely fell in the same trap I was trying to avoid.)

In either case, one arrives at the conclusion that the mindmap library is needed to make your code compile.

\documentclass{article}
\usepackage{amsmath,amssymb,tikz-cd}
\usetikzlibrary{graphs,mindmap}

\begin{document}

\begin{tikzcd}
D\arrow[r,tail,harpoon ,dashed] & B
\end{tikzcd}

\begin{tikzpicture}
\draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
\end{tikzpicture}

\tikz \graph { a -> {b, c} -> d };

\begin{tikzpicture}
\node {root}
[clockwise from=30,sibling angle=30]
child {node{$30$}}
child {node{$0$}}
child {node{$-30$}}
child {node{$-60$}};
\end{tikzpicture}

\end{document}


# Remark

Finally, I'd like to mention that there are cases in which the method does not always work. E.g. in the lowest example op p. 560 of the pgfmanual v 3.1 you need to load quotes in addition to angles. Again, you can find out that quotes is needed by making use of Google. Yet it would IMHO opinion not hurt if the manual was self-contained in that regard, i.e. explicitly tell you which other libraries are needed in addition to those mentioned at the beginning of the section. As TikZ is actively being developed, it is conceivable that a future version of the manual will have this feature.

• You don't need mindmap. The clockwise from key is described in the section of the manual concerning the trees library, so that is the library you actually need. (mindmap loads trees`) – Torbjørn T. Jan 20 at 20:12