I've constated that I can use tikzpicture
even if I comment \usepackage{tikz}
out, as long as I keep \usepackage{pgfplots}
. Isn't tikzpicture
provided by package tikz
? In which situation should I load both pgfplots
and tikz
?
1 Answer
You can in a nutshell imagine that when you write \usepackage{pgfplots}
some code in the pgfplots
uses the equivalent of \usepackage{tikz}
for you. TikZ also has other packages that it depends on (graphicx,xcolor,atbegshi
and more) and it requires for you too. So you don't need to add those again.
If you load even only pgfplotstable
it loads pgfplots
, TikZ and hence xcolor
, graphicx
and so on many packages. LaTeX has an internal consistency check whether some package is already loaded or not. Hence requesting it twice wouldn't cause any harm (as long as there are no option clashes)
I usually add pgfplotstable
to load all the relevant gang with minimal code.
pgfplots
is written by one of the TikZ developers, Christian Feuersanger. However pgfplots
development is independent from TikZ with certain libraries being synced such as fpu
.
-
6Although you have the TikZ manual burned into your brain, I find it helpful explicitly load the packages I use even if other packages load them as well. It's the best reminder of which documentation to look at when something goes wrong. Jan 4, 2016 at 16:17
pgfplots
is based ontikz
package. When you load it, it also loadtikz
. Actually it (simplified said) different axis environments totikzpicture
and simple and rich possibilities to draw graphs.