# Package pgfkeys Error: The key '/tikz/opacity' requires a value

I'm drawing a diagram for a physical phenomenon, "motion in one dimension". I have this figure with a tikzpicture:

\documentclass{article}
\usepackage{tikz}

\definecolor{particle}{rgb}{1.0,0.7,0.3}

\begin{document}

\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw[help lines] (0,0) grid (8,2);
\draw[thick] (0,0) -- (8,0);
\node [right] at (8.25,0) {x (m)};
\node [below] at (0,0) {-40};
\node [below] at (1,0) {-30};
\node [below] at (2,0) {-20};
\node [below] at (3,0) {-10};
\node [below] at (4,0) {0};
\node [below] at (5,0) {10};
\node [below] at (6,0) {20};
\node [below] at (7,0) {30};
\node [below] at (8,0) {40};
\draw [draw=black, fill=particle, opacity=0.5]
(1,0) rectangle (2,1);
\draw [draw=black, fill=particle]
(6,0) rectangle (7,1);
\end{tikzpicture}
\caption{Motion in one dimension} \label{fig:tbh1}
\end{figure}

\end{document}


Compiling with pdflatex, I get this error:

! Package pgfkeys Error: The key '/tikz/opacity' requires a value. I am going to ignore this key.


... on this line:

l.73 ...w [draw=black, fill=particle, opacity=0.5]


Didn't I specify a value for the opacity already? Why am I getting this error?

EDIT: Edited the code to be compilable.

-
Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Jubobs Aug 10 '14 at 18:32
I don't get an error with your code! It works as it should – clemens Aug 10 '14 at 18:40
@Jubobs: Thanks for the warm welcoming! I've edited the code to be compilable. – Berk Özbalcı Aug 10 '14 at 18:40
Hi welcome indeed. There shouldn't be a problem with the given code. Do you have another setting that is named particle somewhere? – percusse Aug 10 '14 at 18:41
Not relevant to the issue, but your x-axis labels should be in math mode, particularly as you've otherwise got - appearing as a hyphen not a minus sign. – Joseph Wright Aug 10 '14 at 18:55

Further investigation of the error led to the fact that when the line

\usepackage[turkish]{babel}


was omitted from the preamble, the code compiled just fine. (I didn't put this line into the code in the question, because, I thought it was irrelevant. Another lesson learned.)

To fix the issue, I added the line

\usetikzlibrary{babel}


to the preamble. It didn't work at first, but when I upgraded PGF/TikZ from 2.10 to 3.00, it did.

-