2

I have problem with following example code:

%& --shell-escape --enable-write-18
\documentclass[a4paper,10pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{units}

\begin{document} 
    \begin{tikzpicture}
        \begin{axis}[
            use units,
            x unit=m,x unit prefix=k,
            y unit=N,y unit prefix=m,
            xlabel=Distance,ylabel=Force]

            \addplot coordinates {
                (1,2.3)
                (2,2.7)
                (3,2.1)
                (4,1.8)
                (5,1.5)
                (6,1.1)
            };
        \end{axis}
    \end{tikzpicture}
\end{document}

A cannot use units in axis labels. A similar code was included in this documentation: http://www.iro.umontreal.ca/~simardr/pgfplots.pdf on page 227.

Errors:

Missing \begin{document}. \usepgfplotslibrary{u (followed by: nits})
Package pgfkeys Error: I do not know the key '/pgfplots/use units' and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/pgfplots/x unit' and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/pgfplots/x unit prefix' and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/pgfplots/y unit' and I am going to ignore it. Perhaps you misspelled it.
Package pgfkeys Error: I do not know the key '/pgfplots/y unit prefix' and I am going to ignore it. Perhaps you misspelled it.
Undefined control sequence:  \usepgfplotslibrary (followed by: {units})

What's more, the command \usepgfplotslibrary completely does not work with any other pgfplots library. I don't know what is wrong, but i have to get this working :/ Thank you in advance for your help.

I'm running Debian Sid. Texlive (2009-11), pgf (2.10-1)

Caramdir
  • 89,023
  • 26
  • 255
  • 291
Naer
  • 23

1 Answers1

5

When I try your code with the Debian/Ubuntu packages, I get

! Undefined control sequence.
<recently read> \usepgfplotslibrary 

l.7 \usepgfplotslibrary
                       {units}

(and if I ignore that error, then your errors follow).

I'd guess that the version of pgfplots in the Debian packages (i.e. in TL 2009) doesn't have any additional libraries and you are looking at the wrong manual. Ubuntu 11.04 (which uses the Debian packages, so I guess Debian Sid is the same) comes with pgfplots 1.2.2, while the current version is 1.4.1.

As always I recommend to install TeX Live directly from TUG instead of using the Debian packages. That way you can always get current package versions by running sudo tlmgr update --all. Alternatively, you can try installing pgfplots directly from CTAN.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
  • Something goes wrong or i don't know something... I removed texlive from Debian repo and installed it from TUG site using "installer" from here: http://tug.org/texlive/acquire-netinstall.html But this completely don't work. There is no latex, pdflatex, pslatex or any other variations in /usr/bin/ directory after instalation. Command 'tlmgr update --all' doesn't work too... Installing it from TUG site is really best way? :/ – Naer May 04 '11 at 19:35
  • Did you set $PATH correctly? (I don't know where to set it in Debian. It is in /etc/environment in Ubuntu) – Caramdir May 04 '11 at 20:01
  • @Naer: Or you can symlink the binaries form .../texlive/2010/bin/.../ to e.g. /usr/bin – Caramdir May 04 '11 at 20:36
  • You were right, I forgot to set $PATH. Now everything works fine. Thank you very much for your help :) – Naer May 04 '11 at 21:26