usepackage{tikz-cd} vs usetikzlibrary{cd}
No (practical) difference. The code (excluding copyright comment lines) in tikz-cd.sty
is:
\ProvidesPackage{tikz-cd}[2014/10/30 v0.9e Commutative diagrams with tikz]
\RequirePackage{tikz}[2013/12/13] % pgf version 3.0.0 required
\usetikzlibrary{cd}
\endinput
so it just loads TikZ and then does \usetikzlibrary{cd}
.
This is just a pedantic comment: there can be differences.
This is an admittedly nasty example.
This code works1:
\documentclass{article}
\usepackage{tikz-cd}
\pgfmathdeclarefunction*{axis_height}{0}{\edef\pgfmathresult{1}}
\begin{document}
Hello
\end{document}
This code does not work:
\documentclass{article}
\usepackage{tikz}
\pgfmathdeclarefunction*{axis_height}{0}{\edef\pgfmathresult{1}}
\usetikzlibrary{cd}
\begin{document}
Hello
\end{document}
However, this works1 again:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{cd}
\pgfmathdeclarefunction*{axis_height}{0}{\edef\pgfmathresult{1}}
\begin{document}
Hello
\end{document}
It is absolutely true that this is not a very useful code, and I have just designed the second code to crash. It does, however, show that there is a technical difference between loading tikz
and then the cd
library among other libraries (which could in principle do something along the lines of \pgfmathdeclarefunction*{axis_height}{0}{\edef\pgfmathresult{1}}
), or later, and loading tikz-cd
, which forces a certain ordering of loading of the libraries.
Of course, the cd
library is, even though it is not part of pgf, a standard library and the authors of other libraries will most likely look at the cd
code to make sure that they do not do harm to it, though it is not inconceivable that someone else may want to define function with the name axis_height
. Nevertheless, if one is very strict, one has to say that it can, at least in principle, make a difference whether one load the tikz-cd
package or the cd
library. As I said, this is just an extended comment, but it does show that one cannot be absolutely sure that there is no difference.
1 "Works" means you do not get an error when you compile the snippet. You should definitely not overwrite the function axis_height
if you actually want to use the cd
library.
Additionally, in ConTeXt the tikz-cd module is not available, you need to do:
\usemodule[tikz]
\usetikzlibrary[cd]