[Tex/LaTex] How to avoid a ‘Dimension too large’ error in an a0 size TikZ figure

beamerposterdebianposterstikz-pgf

I'm using Debian/Squeeze with its texlive-full package installed.

After some success with TikZ for normal article-size figures, I got interested in using it for an a0 size poster.

As a (fairly) minimal standalone example of the problem I'm running into, the code below fails with a 'Dimension too large.' error if any of the indicated lines are uncommented (so basically when it tries to create an arc of half the page width or more, or thereabouts). I'm processing it with pdflatex.

\documentclass[onlymath]{beamer}
\usefonttheme{serif}

\usepackage[orientation=portrait,size=a0,scale=1.0]{beamerposter}

\usepackage{eulervm}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,matrix}

\begin{document}
\begin{frame}[t,fragile]{}

  \begin{block}{Big TikZ Test}
  \begin{center}

    \begin{tikzpicture}

      \tikzstyle{blk} = [rectangle,draw,text width=2in,text centered];
      \tikzstyle{edge} = [draw,line width=3pt,black!50];

      \matrix[row sep=1cm,column sep=1cm] {
        \node[blk] (a) {A};
        &
        \node[blk] (b) {B};
        &
        \node[blk] (c) {C};
        &
        \node[blk] (d) {D};
        &
        \node[blk] (e) {E};
        &
        \node[blk] (f) {F};
        &
        \node[blk] (g) {G};
        &
        \node[blk] (h) {H};
        &
        \node[blk] (i) {I};
        &
        \node[blk] (j) {J};
        \\
      };

      \path[edge] (j) edge [->,bend left=30] (i);
      \path[edge] (j) edge [->,bend left=30] (h);
      \path[edge] (j) edge [->,bend left=30] (g);
      \path[edge] (j) edge [->,bend left=30] (f);
      \path[edge] (j) edge [->,bend left=30] (e);

% Uncommenting any of these fails with 'Dimension too large.' error
       \path[edge] (j) edge [->,bend left=30] (d);
%      \path[edge] (j) edge [->,bend left=30] (c);
%      \path[edge] (j) edge [->,bend left=30] (b);
%      \path[edge] (j) edge [->,bend left=30] (a);

    \end{tikzpicture}

  \end{center}
  \end{block}

\end{frame}
\end{document}

From other similar questions here, I understand there is some limited-range datatype involved, but none of the suggested code-fragment fixes (typically involving some inclusion of a pgf package and messing with some fp / fpu thing) seems to work for me (they generate their own errors).

Is this fixable through some modification of the above code and/or adopting a different version of these tools (e.g Debian/Wheezy – as yet untried – has PGF 2.10 while Squeeze is on 2.00), or is it just a fundamental limitation and I'm trying to push these tools too far ?

Best Answer

Update

The problem appears only with the edges. A possibility is to scale only the edges. Firstly we get the coordinates, then we divide them by 10 and finally we scale the coordinates by 10. I changed some styles from the original code.

\documentclass[onlymath]{beamer}
\usefonttheme{serif}
\usepackage[orientation=portrait,size=a0,scale=1.0]{beamerposter}
\usepackage{eulervm}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,matrix}

\begin{document}
\begin{frame}[t,fragile]{}

  \begin{block}{Big TikZ Test}
  \begin{center}

    \begin{tikzpicture}[blk/.style= {rectangle,draw,text width=2in,text centered},
                       edge/.style = {draw =black!50 ,line width=3pt,->}]

      \matrix[row sep=1cm,column sep=1cm] {%
        \node[blk] (a) {A};
        &
        \node[blk] (b) {B};
        &
        \node[blk] (c) {C};
        &
        \node[blk] (d) {D};
        &
        \node[blk] (e) {E};
        &
        \node[blk] (f) {F};
        &
        \node[blk] (g) {G};
        &
        \node[blk] (h) {H};
        &
        \node[blk] (i) {I};
        &
        \node[blk] (j) {J};
        \\
      };

      \path[edge] (j) edge [bend left=30] (i)
                      edge [bend left=30] (h)
                      edge [bend left=30] (g)
                      edge [bend left=30] (f)
                      edge [bend left=30] (e);

\path (a.south);
\pgfgetlastxy{\ax}{\ay} 
\path (b.south);
\pgfgetlastxy{\bx}{\by}   
\path (c.south);
\pgfgetlastxy{\cx}{\cy}   
\path (d.south);
\pgfgetlastxy{\dx}{\dy}   
       \begin{scope} [scale=10]
        \path[edge] (j) edge [bend left=30] (0.1*\dx,0.1*\dy)
                        edge [bend left=30] (0.1*\cx,0.1*\cy)
                        edge [bend left=30] (0.1*\bx,0.1*\by)
                        edge [bend left=30] (0.1*\ax,0.1*\ay);    
       \end{scope}     
    \end{tikzpicture}
  \end{center}
  \end{block}
\end{frame}
\end{document} 

There is another problem, when we crate the edges, in the log I see

Missing character: There is no ï in font nullfont!
Missing character: There is no ¿ in font nullfont!
Missing character: There is no ¼ in font nullfont!
Missing character: There is no ï in font nullfont!
Missing character: There is no ¿ in font nullfont!
Missing character: There is no ¼ in font nullfont!
Missing character: There is no ï in font nullfont!
Missing character: There is no ¿ in font nullfont!
Missing character: There is no ¼ in font nullfont! 

One warning for one edge

update 2

Perhaps it's a bug in 'to'. I try with controls and the code compiles without errors. I used some control points but without calculations.

\begin{tikzpicture}[blk/.style= {rectangle,draw,text width=2in,text centered},
                   edge/.style = {draw =black!50 ,line width=3pt,->}]

  \matrix[row sep=1cm,column sep=1cm] {%
    \node[blk] (a) {A};
    &
    \node[blk] (b) {B};
    &
    \node[blk] (c) {C};
    &
    \node[blk] (d) {D};
    &
    \node[blk] (e) {E};
    &
    \node[blk] (f) {F};
    &
    \node[blk] (g) {G};
    &
    \node[blk] (h) {H};
    &
    \node[blk] (i) {I};
    &
    \node[blk] (j) {J};
    \\
  };

  \path[edge] (j) edge [bend left=30] (i)
                  edge [bend left=30] (h)
                  edge [bend left=30] (g)
                  edge [bend left=30] (f)
                  edge [bend left=30] (e);
  \path[edge] (j) .. controls ([{shift=(210:20)}]j) and ([{shift=(-30:20)}]d) .. (d);
  \path[edge] (j) .. controls ([{shift=(210:25)}]j) and ([{shift=(-30:25)}]c) .. (c);
  \path[edge] (j) .. controls ([{shift=(210:30)}]j) and ([{shift=(-30:30)}]b) .. (b);
  \path[edge] (j) .. controls ([{shift=(210:35)}]j) and ([{shift=(-30:35)}]a) .. (a);    

\end{tikzpicture}