[Tex/LaTex] “\usetikzlibrary”? Shouldn’t usepackage tikz just give me everything I need


I'm new to LaTeX and this may have been answered somewhere already. But I don't understand why I have to use the command \usetikzlibrary{...}. Why doesn't \usepackage{tikz} give me all the libraries? Are there other packages beside tikz that do a similar thing?

My guess at why it does this is because tikz might be a big library so it doesn't want to load all of it at once? Basically what is the difference between the two?

Best Answer

When you load TikZ it loads many many macros but this is not slowing down anything per se at this time of history. It is actually not that important to load all the macros. But at the same time every library implements many TeX ifs, dimens and lengths etc. that might run out if other packages are using lots of registers. This is usually solved (or hoped to be solved) by also loading the etex package which boosts the number of registers.

Also some of the libraries change the behavior of options such as positioning switches the below of= to below= of, backgrounds switches layering which might interfere with some patterns etc.

So as a very good design decision, you turn on the rockets whenever you need them.

A nice answer by Heiko is good to keep in mind Is it possible to load a TikZ library locally?

Related Question