TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In pgfplots I've used the text width option in the definition of xticklabel style and I wonder how to center the labels text?

share|improve this question
up vote 4 down vote accepted

You can use the key align=center in addition to text width.

share|improve this answer
Hi Martin! I'd tried that before but got the following error: Package pgfkeys Error: I do not know the key '/tikz/align' and I am going to ignore it. Perhaps you misspelled it. – MaKa TaBo May 17 '11 at 18:09
@Matthias: That means you're using an old version of TikZ. If you're using the version of TeXLive shipped with Ubuntu, you should switch to the direct installation from the TeXLive website, as the Ubuntu version is hopelessly outdated. If you're using a different install, try updating the PGF/TikZ package. – Jake May 17 '11 at 18:20
Thanks for that remark! I didnt realize that there was a new version of tikZ. Now align=center works – MaKa TaBo May 17 '11 at 20:38

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.