4

I just can't make the command plot in TikZ work. For example, even such basic code as

\documentclass{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[domain=0:4] 
    \draw[very thin,color=gray] (-0.1,-1.1) grid (3.9,3.9);
    \draw[->] (-0.2,0) -- (4.2,0) node[right] {$x$}; 
    \draw[->] (0,-1.2) -- (0,4.2) node[above] {$y$};
    \draw[color=red]   plot (\x,{\x})   node[right] {$f(x)=x$}; 
  \end{tikzpicture}

\end{document}

produces this error, with no PDF output:

ERROR: Package tikz Error: Cannot parse this plotting data.

If it can be of any help, in the .log file I found this message:

Missing character: There is no , in font nullfont!
! Undefined control sequence.
l.11     \draw[color=red]   plot (\x,{\x
                                        })   node[right] {$f(x) =x$};

If I comment out the line containing the plot command, things compile nicely.

Interestingly, if I include \usepackage{pgfplots} in the preamble, then I get a different error message in ltluatex.tex:

ERROR: Undefined control sequence.

--- TeX said ---
l.55 \ifnum\luatexversion
                         <60 %

Btw, I am running TeX Live 2017 on a MacBook Pro. Any help would be greatly appreciated.

UPDATE: Following @Torbjørn T.'s suggestion, I have removed the old version of TikZ from my local tree. While plot is still not working, at least the error message has changed. Now it's:

ERROR: Undefined control sequence.

--- TeX said ---
l.533 \pgfset
             {

The error refers me to the file pgfmoduleshapes.code.tex (2008/02/13 (rcs-revision 1.4)). Thanks in advance.

  • 3
    You should to add in your question about problem compilation only with lualatex. With pdflatex there is no problem. – sergiokapone Feb 10 '18 at 18:48
  • 1
    luatex probably still needs \RequirePackage{luatex85} but beside this your code compiles fine and doesn't give your error message. Can you show the log-file? – Ulrike Fischer Feb 10 '18 at 18:56
  • It is possible, the conflict between lualatex with standalone – sergiokapone Feb 10 '18 at 19:02
  • @Slobodan Simić Do you get the error if you add\usepackage{luatex85} after \documentclass? – sergiokapone Feb 10 '18 at 19:12
  • Thanks for such quick replies. I actually used XeTeX engine, but I run into similar problems with the other ones (Omega, LuaTeX, and Default). Ulrike: where would I include \RequirePackage{luatex85}? The log-file is very long, so here's a Dropbox link: https://www.dropbox.com/s/tfc83zg0djjy9li/plot.log?dl=0 . I wonder if something is broken in my TeX configuration. – Slobodan Simić Feb 10 '18 at 19:14
  • @sergiokapone: unfortunately, I do. – Slobodan Simić Feb 10 '18 at 19:15
  • https://tex.stackexchange.com/questions/315025/lualatex-texlive-2016-standalone-undefined-control-sequence – sergiokapone Feb 10 '18 at 19:16
  • 2
    \RequirePackage{luatex85} goes before \documentclass. Your code works fine here as well, with either lualatex, xelatex or pdflatex. – Torbjørn T. Feb 10 '18 at 19:23
  • Thanks! I included that line but it still doesn't work. I am really puzzled. – Slobodan Simić Feb 10 '18 at 20:08
  • Looking now at your .log file, you have a quite old version of TikZ in your local tree (/Users/sns/Library/texmf/tex/latex/misc/pgf-1.01/latex/pgf/), that is being used instead of the one in /usr/local/texlive/2017/. Could be that if you remove the one in your local tree, it would work. – Torbjørn T. Feb 11 '18 at 22:12
  • Thank you so much for taking the time to look at the .log file. I removed the old version of TikZ, but this this I get an error message like this: \pgfset{ inner xsep/.initial =.3333em, inner ysep/.initial =.3333em, inner sep/.style ={/pgf/inner xsep=#1,/pgf/inner ysep=#1}, outer xsep/.initial =.5\pgflinewidth, outer ysep/.initial =.5\pgflinewidth, outer sep/.code =\pgf@handle@outer@sep{#1}, minimum width/.initial =1pt, minimum height/.initial =1pt, minimum size/.style ={/pgf/minimum width=#1,/pgf/minimum height=#1}, } – Slobodan Simić Feb 11 '18 at 23:15
  • your document example works fine (recent miktex, tikz). it seems that you have serious problem with your latex installation. maybe the best solution is reinstall your latex (from scratch) and then search if upgrade is necessary. this should help. – Zarko Feb 12 '18 at 22:09
  • Thanks! The strange thing is that I just updated MacTeX from 2011 to 2017. I'll give it another try. – Slobodan Simić Feb 12 '18 at 22:12
  • Reinstalling MacTex and removing the old version of TikZ finally fixed the problem . Thanks to all of you for help! – Slobodan Simić Feb 14 '18 at 13:35
  • 4
    I'm voting to close this question as off-topic because the OP solved the problem himself and posted the solution in a comment. –  Mar 03 '19 at 08:46

0 Answers0