I'm fairly new to LaTeX/TikZ and I have written a python script that generates .tex
files for our dependency graphs.
The problem is that I encountered two errors or warnings when I compile these .tex
files with pdflatex
to PDF. They are generated but the following message comes up:
! Dimension too large.
<recently read> \pgf@xa
l.167 ...art, below, sloped] {nsubj}(3token.south)
;
?
! Dimension too large.
<recently read> \pgf@xa
l.168 ...art, below, sloped] {nsubj}(3token.south)
;
?
I guess it is the arrows that I'm trying to draw at the bottom of the text tokens but I can't see why they don't work in this case and do in other files. It is just the case in 2 of 660 files, so I don't see where this error is coming from.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs, positioning, arrows.meta}
\begin{document}
\tikzset{token/.style={
rectangle,
minimum size=8mm,
very thick,
draw=green!50,
text height=4ex,
text depth=1ex,
node distance=0.5,
font=\sffamily\huge
}}
\tikzset
{root/.style={
font =\sffamily,
circle,
minimum size=10mm,
very thick,
draw = black,
top color = white,
bottom color = black!20
}}
\tikzset{knot/.style={
font =\sffamily,
rectangle,
minimum size=6mm,
rounded corners=3mm,
very thick,
draw = black,
top color = white,
bottom color = black!20
}}
\tikzset{label/.style={
font=\sffamily\LARGE,
thick
}}
\def\hoch{4}
\begin{tikzpicture}
%TOKEN NODES
\node (1token) [token, below] at (0,0) {(1)BMPs};
\node (2token) [token, right=of 1token] {(2)are};
\node (3token) [token, right=of 2token] {(3)members};
\node (4token) [token, right=of 3token] {(4)of};
\node (5token) [token, right=of 4token] {(5)the};
\node (6token) [token, right=of 5token] {(6)transforming};
\node (7token) [token, right=of 6token] {(7)growth};
\node (8token) [token, right=of 7token] {(8)factor};
\node (9token) [token, right=of 8token] {(9)-};
\node (10token) [token, right=of 9token] {(10)beta};
\node (11token) [token, right=of 10token] {(11)(};
\node (12token) [token, right=of 11token] {(12)TGF};
\node (13token) [token, right=of 12token] {(13)-};
\node (14token) [token, right=of 13token] {(14)beta};
\node (15token) [token, right=of 14token] {(15))};
\node (16token) [token, right=of 15token] {(16)family};
\node (17token) [token, right=of 16token] {(17)that};
\node (18token) [token, right=of 17token] {(18)bind};
\node (19token) [token, right=of 18token] {(19)to};
\node (20token) [token, right=of 19token] {(20)type};
\node (21token) [token, right=of 20token] {(21)II};
\node (22token) [token, right=of 21token] {(22)and};
\node (23token) [token, right=of 22token] {(23)type};
\node (24token) [token, right=of 23token] {(24)I};
\node (25token) [token, right=of 24token] {(25)serine};
\node (26token) [token, right=of 25token] {(26)-};
\node (27token) [token, right=of 26token] {(27)threonine};
\node (28token) [token, right=of 27token] {(28)kinase};
\node (29token) [token, right=of 28token] {(29)receptors};
\node (30token) [token, right=of 29token] {(30),};
\node (31token) [token, right=of 30token] {(31)and};
\node (32token) [token, right=of 31token] {(32)transduce};
\node (33token) [token, right=of 32token] {(33)signals};
\node (34token) [token, right=of 33token] {(34)through};
\node (35token) [token, right=of 34token] {(35)Smad};
\node (36token) [token, right=of 35token] {(36)and};
\node (37token) [token, right=of 36token] {(37)non-Smad};
\node (38token) [token, right=of 37token] {(38)signalling};
\node (39token) [token, right=of 38token] {(39)pathways};
\node (40token) [token, right=of 39token] {(40).};
%ANCHOR NODES
\node (1) [knot, above=0.1cm+0*\hoch cm of 1token] {1};
\node (2) [knot, above=0.1cm+0*\hoch cm of 2token] {2};
\node (3) [knot, above=0.1cm+6*\hoch cm of 3token] {3};
\node (4) [knot, above=0.1cm+0*\hoch cm of 4token] {4};
\node (5) [knot, above=0.1cm+0*\hoch cm of 5token] {5};
\node (6) [knot, above=0.1cm+0*\hoch cm of 6token] {6};
\node (7) [knot, above=0.1cm+0*\hoch cm of 7token] {7};
\node (8) [knot, above=0.1cm+1*\hoch cm of 8token] {8};
\node (9) [knot, above=0.1cm+0*\hoch cm of 9token] {9};
\node (10) [knot, above=0.1cm+2*\hoch cm of 10token] {10};
\node (11) [knot, above=0.1cm+0*\hoch cm of 11token] {11};
\node (12) [knot, above=0.1cm+0*\hoch cm of 12token] {12};
\node (13) [knot, above=0.1cm+0*\hoch cm of 13token] {13};
\node (14) [knot, above=0.1cm+1*\hoch cm of 14token] {14};
\node (15) [knot, above=0.1cm+0*\hoch cm of 15token] {15};
\node (16) [knot, above=0.1cm+3*\hoch cm of 16token] {16};
\node (17) [knot, above=0.1cm+0*\hoch cm of 17token] {17};
\node (18) [knot, above=0.1cm+5*\hoch cm of 18token] {18};
\node (19) [knot, above=0.1cm+0*\hoch cm of 19token] {19};
\node (20) [knot, above=0.1cm+4*\hoch cm of 20token] {20};
\node (21) [knot, above=0.1cm+0*\hoch cm of 21token] {21};
\node (22) [knot, above=0.1cm+0*\hoch cm of 22token] {22};
\node (23) [knot, above=0.1cm+1*\hoch cm of 23token] {23};
\node (24) [knot, above=0.1cm+0*\hoch cm of 24token] {24};
\node (25) [knot, above=0.1cm+0*\hoch cm of 25token] {25};
\node (26) [knot, above=0.1cm+0*\hoch cm of 26token] {26};
\node (27) [knot, above=0.1cm+1*\hoch cm of 27token] {27};
\node (28) [knot, above=0.1cm+0*\hoch cm of 28token] {28};
\node (29) [knot, above=0.1cm+2*\hoch cm of 29token] {29};
\node (30) [knot, above=0.1cm+0*\hoch cm of 30token] {30};
\node (31) [knot, above=0.1cm+0*\hoch cm of 31token] {31};
\node (32) [knot, above=0.1cm+3*\hoch cm of 32token] {32};
\node (33) [knot, above=0.1cm+0*\hoch cm of 33token] {33};
\node (34) [knot, above=0.1cm+0*\hoch cm of 34token] {34};
\node (35) [knot, above=0.1cm+2*\hoch cm of 35token] {35};
\node (36) [knot, above=0.1cm+0*\hoch cm of 36token] {36};
\node (37) [knot, above=0.1cm+0*\hoch cm of 37token] {37};
\node (38) [knot, above=0.1cm+0*\hoch cm of 38token] {38};
\node (39) [knot, above=0.1cm+1*\hoch cm of 39token] {39};
\node (40) [knot, above=0.1cm+0*\hoch cm of 40token] {40};
%ROOT NODE
\node[root,above=1*\hoch cm of 3] (0) {ROOT};
%EDGES WITH LABELS
\draw[-,black,thick](0) -- node[label,near end,above,sloped] {root}(3);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {conj:and}(32);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {nsubj}(1);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {cop}(2);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {punct}(40);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {nmod:of}(10);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {ref}(17);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {acl:relcl}(18);
\draw[-,black,thick](3) -- node[label,near end,above,sloped] {cc}(31);
\draw[-,black,thick](8) -- node[label,near end,above,sloped] {compound}(7);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {case}(4);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {det}(5);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {amod}(6);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {compound}(8);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {punct}(9);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {appos}(14);
\draw[-,black,thick](10) -- node[label,near end,above,sloped] {punct}(15);
\draw[-,black,thick](14) -- node[label,near end,above,sloped] {punct}(11);
\draw[-,black,thick](14) -- node[label,near end,above,sloped] {compound}(12);
\draw[-,black,thick](14) -- node[label,near end,above,sloped] {punct}(13);
\draw[-,black,thick](16) -- node[label,near end,above,sloped] {conj}(29);
\draw[-,black,thick](18) -- node[label,near end,above,sloped] {xcomp}(20);
\draw[-,black,thick](18) -- node[label,near end,above,sloped] {cc}(22);
\draw[-,black,thick](20) -- node[label,near end,above,sloped] {nsubj}(16);
\draw[-,black,thick](20) -- node[label,near end,above,sloped] {aux}(19);
\draw[-,black,thick](20) -- node[label,near end,above,sloped] {dobj}(21);
\draw[-,black,thick](23) -- node[label,near end,above,sloped] {compound}(24);
\draw[-,black,thick](27) -- node[label,near end,above,sloped] {compound}(25);
\draw[-,black,thick](27) -- node[label,near end,above,sloped] {punct}(26);
\draw[-,black,thick](29) -- node[label,near end,above,sloped] {compound}(27);
\draw[-,black,thick](29) -- node[label,near end,above,sloped] {compound}(28);
\draw[-,black,thick](29) -- node[label,near end,above,sloped] {punct}(30);
\draw[-,black,thick](29) -- node[label,near end,above,sloped] {compound}(23);
\draw[-,black,thick](32) -- node[label,near end,above,sloped] {dobj}(33);
\draw[-,black,thick](32) -- node[label,near end,above,sloped] {nmod:through}(35);
\draw[-,black,thick](35) -- node[label,near end,above,sloped] {case}(34);
\draw[-,black,thick](35) -- node[label,near end,above,sloped] {cc}(36);
\draw[-,black,thick](35) -- node[label,near end,above,sloped] {conj:and}(39);
\draw[-,black,thick](39) -- node[label,near end,above,sloped] {amod}(37);
\draw[-,black,thick](39) -- node[label,near end,above,sloped] {compound}(38);
%BACK RELATION EDGES WITH LABELS
\draw[-{Latex[length=5mm,red]}, red](20token.south) to[out = -150, in =-30] node[label, near start, below, sloped] {nsubj}(3token.south);
\draw[-{Latex[length=5mm,red]}, red](18token.south) to[out = -150, in =-30] node[label, near start, below, sloped] {nsubj}(3token.south);
%HELP EDGES
\draw[-,dotted,black!80,thick] (3token) -- (3);
\draw[-,dotted,black!80,thick] (8token) -- (8);
\draw[-,dotted,black!80,thick] (10token) -- (10);
\draw[-,dotted,black!80,thick] (14token) -- (14);
\draw[-,dotted,black!80,thick] (16token) -- (16);
\draw[-,dotted,black!80,thick] (18token) -- (18);
\draw[-,dotted,black!80,thick] (20token) -- (20);
\draw[-,dotted,black!80,thick] (23token) -- (23);
\draw[-,dotted,black!80,thick] (27token) -- (27);
\draw[-,dotted,black!80,thick] (29token) -- (29);
\draw[-,dotted,black!80,thick] (32token) -- (32);
\draw[-,dotted,black!80,thick] (35token) -- (35);
\draw[-,dotted,black!80,thick] (39token) -- (39);
\end{tikzpicture}
\end{document}
pos = <number between zero and one>
would be an idea. Or putting more distance between the nodes. If it makes the figure to large, maybe thescale
option could then squeeze it back.