[Tex/LaTex] Tikz error with ! Dimension too large

errorstikz-pgf

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\usepackage[utf8]{inputenc}

\usepackage{tikz,bm,color}
\usetikzlibrary{fit,arrows.meta}

\begin{document}

% with errors
\begin{tikzpicture}[scale=0.075]
\draw[-{Stealth[length=2.5mm]},thin] (-2,0)--(198,0);
\node [below] at (195,0) {\scriptsize{$Q$}};
\draw[-{Stealth[length=2.5mm]},thin] (0,-2)--(0,158);
\node [left] at (0,155) {\scriptsize{$p$}};
\draw [very thick] (0,100) -- (95,100) to [out=0,in=180] (100,100) to [out=0,in=135] (175,85);
\draw [dashed] (0,65) -- (150,65);
\draw [dash dot] (0,141) to [out=0,in=150] (100,100) to [out=330,in=135 (150,65) to [out=315,in=135] (160,55);
\end{tikzpicture}
%! Dimension too large.

% no errors
\begin{tikzpicture}[scale=0.075]
\draw[-{Stealth[length=2.5mm]},thin] (-2,0)--(198,0);
\node [below] at (195,0) {\scriptsize{$Q$}};
\draw[-{Stealth[length=2.5mm]},thin] (0,-2)--(0,158);
\node [left] at (0,155) {\scriptsize{$p$}};
\draw [very thick] (0,100) -- (95,100) -- (100,100) -- (175,85);
\draw [dashed] (0,65) -- (150,65);
\draw [very thick] (0,141) -- (100,100) -- (150,65) -- (160,55);
\end{tikzpicture}
% no errors

\end{document}

I can't figure why this is happening?

Best Answer

A minimal example still exhibiting the error is

\documentclass[tikz]{standalone}
\begin{document}
\tikz\draw (100,100) to [out=0,in=135] (175,85);
\end{document}

My guess is that computing the arc causes some overflow; in fact, your picture has a size in the range of one or more square meters.

Since you scale your picture by a factor of 0.075 anyway, I suggest to use a scale factor of 0.75 and reduce the numbers by a factor of 10. The command

\tikz\draw (10.0,10.0) to [out=0,in=135] (17.5,8.5);

gives no error.

Here is your modified document and the corresponding output. Seems to work.

\documentclass[convert={outext=.jpg}]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\usepackage[utf8]{inputenc}
\usepackage{tikz,bm,color}
\usetikzlibrary{fit,arrows.meta}
\begin{document}
\begin{tikzpicture}[scale=0.75]
  \draw[-{Stealth[length=2.5mm]},thin] (-0.2,0)--(19.8,0);
  \node [below] at (19.5,0) {\scriptsize{$Q$}};
  \draw[-{Stealth[length=2.5mm]},thin] (0,-0.2)--(0,15.8);
  \node [left] at (0,15.5) {\scriptsize{$p$}};
  \draw [very thick] (0,10.0) -- (9.5,10.0) to [out=0,in=180]
    (10.0,10.0) to [out=0,in=135] (17.5,8.5);
  \draw [dashed] (0,6.5) -- (15.0,6.5);
  \draw [dash dot] (0,14.1) to [out=0,in=150]
    (10.0,10.0) to [out=330,in=135] (15.0,6.5)
    to [out=315,in=135] (16.0,5.5);
\end{tikzpicture}
\end{document}

enter image description here