# A problem with tikz accuracy, even with fpu

I am attempting to draw a Villard diagram (see, for example, http://retinart.net/graphic-design/secret-law-of-page-harmony/), a classic way of formatting a printed page. So far I have this:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{fp}
\usetikzlibrary{calc,fpu}

%\pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}

\newlength\textwd
\newlength\textht
\newlength\innerM
\newlength\botM

\newcommand{\villard}[5]{% {page width}{page height}{text block % of page area}{Verso text (not used)} {Recto text}
\begin{tikzpicture}
%\tikzset{fixed point arithmetic}%
\coordinate (c1) at (0,0);
\coordinate (c2) at (#1,0);
\coordinate (c3) at (#1,#2);
\coordinate (c4) at (0,#2);
\coordinate (c5) at ($(c1)!0.5!(c4)$);
\draw (c1) -- (c2) -- (c3) -- (c4) -- cycle;
\draw (c2) -- (c4);
\draw (c5) -- (c3);
\pgfmathsetmacro{\areapcsqr}{sqrt(#3)}%
\pgfmathsetlength{\textwd}{#1*\areapcsqr}%
\pgfmathsetlength{\textht}{#2*\areapcsqr}%
\pgfmathsetlength{\innerM}{(#1-\textwd)*.333333333333}%
\pgfmathsetlength{\botM}{2.0*(#2-\textht)*.333333333333}%
\coordinate (C) at (\innerM+\textwd*0.5,\botM+\textht*0.5);
\node[draw,text width=\textwd, minimum height=\textht,align=center] at (C) {#5};
\draw[red] ($(c4)!0.11!(c2)$) circle (18pt);
\draw[red] ($(c4)!0.78!(c2)$) circle (18pt);
\draw[red] ($(c3)!0.225!(c5)$) circle (18pt);
\end{tikzpicture}
}

\begin{document}

\villard{4.25in}{8.5in}{.45}{}{Right hand text.}

\end{document}


Which produces this:

Close, but not close enough for me. I've tried various things as you can see, but nothing seems to help. I'm using MacTeX2015, recently updated.

What am I missing?

• I haven't looked too deeply at this, but if you get rid of the inner sep in the node with inner sep=0pt, the corners will fall on the diagonals. They do not, however, correspond to the centers of the red circles (hence a comment and not an answer).
– Guho
Mar 11 '16 at 23:07
• Doh. Never for a moment thought of inner sep -- setting that to 0pt worked perfecty. The red circles were guesstimates. Make your comment into an answer an I'll gladly accept it. Thanks. Mar 11 '16 at 23:11

You need to remove the inner sep from the node:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{calc}

\newlength\textwd
\newlength\textht
\newlength\innerM
\newlength\botM

\newcommand{\villard}[5]{%
\begin{tikzpicture}
%\tikzset{fixed point arithmetic}%
\coordinate (c1) at (0,0);
\coordinate (c2) at (#1,0);
\coordinate (c3) at (#1,#2);
\coordinate (c4) at (0,#2);
\coordinate (c5) at ($(c1)!0.5!(c4)$);
\draw (c1) -- (c2) -- (c3) -- (c4) -- cycle;
\draw (c2) -- (c4);
\draw (c5) -- (c3);
\pgfmathsetmacro{\areapcsqr}{sqrt(#3)}%
\pgfmathsetlength{\textwd}{#1*\areapcsqr}%
\pgfmathsetlength{\textht}{#2*\areapcsqr}%
\pgfmathsetlength{\innerM}{(#1-\textwd)*.333333333333}%
\pgfmathsetlength{\botM}{2.0*(#2-\textht)*.333333333333}%
\coordinate (C) at (\innerM+\textwd*0.5,\botM+\textht*0.5);
\node[draw,text width=\textwd, minimum height=\textht,align=center,inner sep=0pt] at (C) {#5};
\draw[red] ($(c4)!0.11!(c2)$) circle (18pt);
\draw[red] ($(c4)!0.78!(c2)$) circle (18pt);
\draw[red] ($(c3)!0.225!(c5)$) circle (18pt);
\end{tikzpicture}
}

\begin{document}

\villard{4.25in}{8.5in}{.35}{}{Right hand text.}

\end{document}


Note that I removed the fp and fpu references, as they were not being used. See the comments to the question for clarification on the red circles.