# Why doesn't a 17cm x 25cm picture fit on a 17cm x 25cm page?

Why doesn't this tikz picture fit on the first page of the document?

\documentclass{report}

\usepackage{tikz}
\usepackage[showframe, centering, text={17cm, 25cm}]{geometry}

\begin{document}

\noindent
\begin{tikzpicture}
\draw (0cm,0cm) grid (17cm,25cm);
\end{tikzpicture}

\end{document}


When I compile the picture is pushed to the second page and the first is blank. If I increase the height of the page slightly (say to 25.01cm) it fits. How is LaTeX handling this situation? Is there anyway to get an exact fit?

-

Your rectangle has a width and a height of 17cm+\pgflinewidth respectively 25cm+\pgflinewidth. That means you have to modify your example es follows:

\documentclass{report}

\usepackage{tikz}
\usepackage[showframe, centering, text={17cm, 25cm}]{geometry}
\usetikzlibrary{calc}
\begin{document}

\noindent
\begin{tikzpicture}
\draw (0cm,0cm) grid ($(17cm,25cm)-(\pgflinewidth,\pgflinewidth)$);
\end{tikzpicture}


Explanation

The two mandatory points of a rectangle drawn by TikZ are located in the middle of the line. The following example demonstrate it:

\documentclass{report}

\usepackage{tikz}
\usepackage[centering, text={17cm, 25cm}]{geometry}
\usetikzlibrary{calc}
\begin{document}

\noindent
\begin{tikzpicture}
\draw[line width=10pt,red] (0cm,0cm) rectangle (5,5);
\fill (0cm,0cm) circle (2pt);
\fill (5cm,5cm) circle (2pt);
\end{tikzpicture}


-