Tikz:画线时出现尺寸过大错误

Tikz:画线时出现尺寸过大错误

我正在尝试创建一个映射来显示课程中的思想流,类似于

但是,每当我尝试创建一条连接主题和主题的长路径时,我都会收到“维度太大”错误。我看不出存在数学溢出错误。这似乎纯粹是由路径的长度引起的。在下面的 MWE 中,麻烦的行试图将主题 1 连接到主题 1。但是,即使我尝试将主题 1 连接到比第 3 节更远的内容(例如第 2 节),我也会收到相同的错误,这让我认为错误与路径的长度有关,但我看不出 tikz 中存在这样的路径长度限制。

\documentclass{beamer}
  
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
  
\usepackage[orientation=landscape,size=a0,scale=1.0]{beamerposter}

\begin{document}
\begin{frame}{} 
    \begin{tikzpicture}

        \draw[help lines,xstep=1,ystep=1] (0,0) grid (115,70);
        \foreach \x in {0,1,...,115} { \node [anchor=north] at (\x,0) {\small{\x}}; }
        \foreach \y in {0,1,...,70} { \node [anchor=east] at (0,\y) {\small{\y}}; }
    
        \node [anchor=west] at (1,66)  {\small{Topic 1}};
        \node [anchor=west] at (1,30)  {\small{Topic 2}};
        \draw (20,10) node [anchor=west] {\small{Section 1}};
        \draw (20,30) node [anchor=west] {\small{Section 2}};
        \draw (20,31) node [anchor=west] {\small{Section 3}};
        \draw (20,32) node [anchor=west] {\small{Section 4}};
        \draw (20,33) node [anchor=west] {\small{Section 5}};
        \draw (20,35) node [anchor=west] {\small{Section 6}};
        \draw (20,40) node [anchor=west] {\small{Section 7}};
        \draw (20,50) node [anchor=west] {\small{Section 8}};
    
        \draw (4.0,66) to [out=0, in=180] (20,50);
        \draw (4.0,66) to [out=0, in=180] (20,40);
        \draw (4.0,66) to [out=0, in=180] (20,35);
        \draw (4.0,66) to [out=0, in=180] (20,33);
        \draw (4.0,66) to [out=0, in=180] (20,32);
        \draw (4.0,66) to [out=0, in=180] (20,31);
%       \draw (4.0,66) to [out=0, in=180] (20,30);  % This line causes a "Dimensions too large" error
%       \draw (4.0,66) to [out=0, in=180] (20,10);  % This line causes a "Dimensions too large" error
        \draw (4.0,30) to [out=0, in=180] (20,10);

    \end{tikzpicture}
\end{frame}

\end{document}

任何帮助解决此错误的帮助都将不胜感激。我可能忽略了一些非常明显的东西。

更新 这很奇怪。按照这个问题的答案中的提示 尺寸过大错误,tikz 标记过多,我刚刚要求 pdflatex 继续编译文档,路径就出现了。使用 tracingmacros 和 tracingcommands 命令,我认为“尺寸太大”错误似乎与 \pgf@ya 有关,但我没有时间深入研究。

答案1

有一种方法可以解决这个问题。本质上,你可以将 x 和 y 值重新定义为 .5cm 而不是 1cm,然后将其缩放 2 倍。这不是很优雅,但编译时没有错误并给出你想要的输出:

\documentclass{beamer}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage[orientation=landscape,size=a0,scale=1.0]{beamerposter}

\begin{document}
    \begin{frame}{} 
        \centering
        \begin{tikzpicture}[x=1cm,y=1cm,every node/.style={font=\small}]
            \draw[help lines,xstep=1,ystep=1] (0,0) grid (115,70);
            \foreach \x in {0,1,...,115} {\node [anchor=north] at (\x,0) {\x};}
            \foreach \y in {0,1,...,70} {\node [anchor=east] at (0,\y) {\y};}
            \node[anchor=east] at (4,66)  {Topic 1};
            \node[anchor=east] at (4,30)  {Topic 2};
            \begin{scope}[every node/.style={anchor=west}]
                \draw (4.0,30) to [out=0, in=180] (20,10);
                \foreach \i/\j in {31/3, 32/4, 33/5, 35/6, 40/7, 50/8} {
                    \draw (4.0,66) to [out=0, in=180] (20,\i) node {Section \j};
                }
            \end{scope} 
            \begin{scope}[x=.5cm,y=.5cm,scale=2,every node/.style={anchor=west}]
                \foreach \i/\j in {10/1, 30/2} {
                    \draw (4.0,66) to [out=0, in=180] (20,\i) node {Section \j};
                }
            \end{scope} 
        \end{tikzpicture}
    \end{frame}
\end{document}

根据上面的评论,我还擅自将您的代码缩短了一点。

相关内容