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?

  • 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
  • 1
    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
  • @Qrrbrbirlbel My only concern with assuming that is MikTeX's auto-package-downloading thing it has going on. I believe this is still the default behaviour, so MikTeX should have downloaded it automagically for OP. It would be extremely beneficial if OP would come back and post the actual code... – Sean Allred Jun 29 '13 at 22:36
  • @SeanAllred The tikz-cd.sty file is found in the folder E:\latex files\article template`. Doesn’t look like MiKTeX’s texmf` structure to me. This is why I assume that neither MiKTeX’s package manager nor its auto-package-downloading thing (which can be turned off) have been used correctly. But I agree, a screenshot of a log and half of TeX.sx is not the best material to judge what’s wrong. – Qrrbrbirlbel Jun 29 '13 at 22:46

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.