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 was trying to install the tikz-cd package into my miktex in order to draw commutative diagram. However, I encountered the following error and I don't know how to solve it.

The situation:

enter image description here

In the bottom, it says

"! Undefined control sequence.
l.19 \usetikzlibrary
? "

Could anyone please help?

share|improve this question
Welcome to TeX.SX! –  Papiro Jun 29 '13 at 11:52
What is your preamble, exactly ? Is tikz-cd really installed ? –  Bernard Jun 29 '13 at 12:18
hi bernard, what is meant by a preamble...? I actually am not sure whether I have installed the tikz-cd... Do you mind telling me how to install it? –  user32982 Jun 29 '13 at 12:49
Hello, and welcome to TeX.SX! Could you cut and paste your LaTeX code and put it into your question? (Older eyes have a hard time seeing the text in the picture, mine included.) If you can, also try trimming the unnecessary bits of your document to come to hat we call a minimal working example (MWE). This will make it easier for us, and very likely yourself, to come to a solution. –  Sean Allred Jun 29 '13 at 13:24
You do not have (correctly) TikZ installed. The error messages says File `tikz.sty` not found. You cannot substitute this with tikz-cd.sty (which is actually found) because it relies on TikZ. \usetikzlibrary is a TikZ macro is of course not defined then. The tikz package can be found in MiKTeX Package Manager under the name pgf. That said, it also looks like you isntalled tikz-cd in you local folder. Why don’t you use MiKTeX’s package manager for these default packages? –  Qrrbrbirlbel Jun 29 '13 at 14:32

1 Answer 1

Fleshing out what @Qrrbrbirlbel noticed from your screenshot (which, generally speaking, isn't enough to solve a problem here on TeX.SX), it looks like you don't actually have a full installation of LaTeX. You should download a standard TeX distribution:

MikTeX is a popular choice for Windows, with a very idiomatic installation procedure, and will get the job done. TeX Live has other advantages, which are laid out elsewhere.

Both of these provide mature package managers to let you install LaTeX packages with a click of a button (they'll even present you with a searchable, comprehensive list of all files from CTAN). Search for PGF and TikZ, and download all related packages.

share|improve this answer
And, as I commented, search also for pgf because that’s the name of the PGF/TikZ “package” (in MiKTeX at least). –  Qrrbrbirlbel Jun 29 '13 at 23:07
@Qrrbrbirlbel you're absolutely right, my mistake –  Sean Allred Jun 29 '13 at 23:11

Your Answer


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.