[Tex/LaTex] TikZ in LyX: Package tikz error

lyxtikz-pgf

I am trying to compile a document that uses the tikzpicture and pgf packages, but I am getting this error

enter image description here

UPDATE

Code:

    \begin{tikzpicture} 
    \begin{semilogyaxis}[
         width=0.75\columnwidth,
         xtick={10,20,...,40},
         xlabel=Tamaño del arreglo (miles),
         ylabel=Tiempo (ms),
         legend pos=outer north east,
         title=\textbf{Comparación}]
    \addplot coordinates{(10,100) (20,300) (30,400) (40,600)};
    \addplot coordinates{(10,400) (20,600) (30,200) (40,400)};
    \addplot coordinates{(10,600) (20,500) (30,100) (40,200)};
    \addplot coordinates{(10,600) (20,100) (30,500) (40,100)};
    \addplot coordinates{(10,300) (20,100) (30,200) (40,500)};
    \addplot coordinates{(10,600) (20,200) (30,400) (40,500)};
    \legend{Selección,Inserción,Mezcla,Montículos,Rápido,Residuos}
    \end{semilogyaxis}
\end{tikzpicture}

Latex preamble:

\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{fancyheadings}
\usepackage{chngcntr}
\counterwithout{figure}{section}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepgfplotslibrary{units}
\date{}

Best Answer

The error message is quite descriptive; you are using some code that requires the calc library, so need to load it; add

\usetikzlibrary{calc}

after

\usepackage{tikz}

Try processing this sample document exactly as it is:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

    \begin{tikzpicture} 
    \begin{semilogyaxis}[
         width=0.75\columnwidth,
         xtick={10,20,...,40},
         xlabel=Tamaño del arreglo (miles),
         ylabel=Tiempo (ms),
         legend pos=outer north east,
         title=\textbf{Comparación}]
    \addplot coordinates{(10,100) (20,300) (30,400) (40,600)};
    \addplot coordinates{(10,400) (20,600) (30,200) (40,400)};
    \addplot coordinates{(10,600) (20,500) (30,100) (40,200)};
    \addplot coordinates{(10,600) (20,100) (30,500) (40,100)};
    \addplot coordinates{(10,300) (20,100) (30,200) (40,500)};
    \addplot coordinates{(10,600) (20,200) (30,400) (40,500)};
    \legend{Selección,Inserción,Mezcla,Montículos,Rápido,Residuos}
    \end{semilogyaxis}
\end{tikzpicture}

\end{document}

From the comments (and a discussion in chat) it was clear that the problem was an outdated LaTeX system.

Related Question