I'm getting an "Overfull \hbox" error when setting width=\textwidth in axis when using pgfplots.
Here is a MWE. The exact error shown is Overfull \hbox (6.19328pt too wide) in paragraph at lines 22--23.
\documentclass[11pt]{book} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \centering % interestingly. removing this increase the error to `23.19328pt too wide` \begin{tikzpicture} \begin{axis}[ ylabel={Y label}, xmin=0, xmax=10, xtick={0,1,2,3,4,5,6,7,8,9,10}, width={\textwidth}, ] \addplot[] coordinates { (0,21.70)(1,21.71)(8,20.93)(9,20.47)(10,20.40) % Something. Doesn't really matter }; \addlegendentry{Precision} \end{axis} \end{tikzpicture} \end{document} I read a lot of answers here and around the web, but nothing seems to work. And being relatively new, I'm not able to debug further.
Any ideas?



\centeringthe picture is starting a justified paragraph so is indented by\parindentwhich is why the box is overfull by an increased amount.width=\textwidthuses\textwidth- 45pt for the plot and 45pt for the material outside of the plotting area. The 45pt are a fixed length. But 45pt are not enough horizontal space for theylabeland the xtick10in the lower right corner.