1

I've created a tikzpicture that has a lot of nodes. These nodes are sometimes close to eachother and my text is overlapping. This is my output:

enter image description here

What i want to have is this:

enter image description here

The text lines under eachother instead of overlapping. Can someone help me with this?

This is my code so far:

\documentclass{article} \usepackage{array} \usepackage{longtable} \usepackage{graphicx} \usepackage[space]{grffile} %fix voor \inclusegraphics \usepackage{color} \usepackage[document]{ragged2e} \usepackage{etoolbox} \usepackage{pgfplots} \usepackage{pgfkeys} \usepackage{tikz, amsmath} \usetikzlibrary{shapes.geometric,arrows.meta,positioning} \usepackage{amssymb} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \tikzset{oplus/.style={path picture={\draw[black](path picture bounding box.south) -- (path picture bounding box.north) (path picture bounding box.west) -- (path picture bounding box.east);}}} \node(start)[oplus, fill = black!10, draw = black, thick, circle] { }; \node(end)[oplus, fill = black!10, draw = black, thick, circle, below = 18cm of start] { }; \draw[thick, double](start)--(end); \node(streng)[above = 3mm of start] {\textbf{VW004}}; \node(strengend)[below = 3mm of end] {\textbf{VW005}}; \node(prestart1)[left = 1cm of start] {00:00:00}; \node(prestart)[left = 1cm of prestart1] {}; \node(video)[ultra thick, above = 1cm of prestart1] {\textbf{Video}}; \node(foto)[ultra thick, left = 1cm of video] {\textbf{Foto}}; \node(afst)[ultra thick, right = 2.2cm of video] {\textbf{Afst./m}}; \node(toestand)[ultra thick, right = 3.5cm of video] {\textbf{Toest.}}; \node(beschr)[ultra thick, right = 5cm of video] {\textbf{Beschrijving}}; \node (startline) [right= 1cm of start] {000.00 - BCDA - Beginknooppunt, rioolput}; \draw [thick] (start)--(startline); \node(001)[fill = black!10, draw = black, thick, circle, below = 3.5758cm of start]{}; \node(001t)[right= 1cm of 001]{011.80 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:10}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 5.2424cm of start]{}; \node(001t)[right= 1cm of 001]{017.30 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:12}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 6.6152cm of start]{}; \node(001t)[right= 1cm of 001]{022.20 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:14}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 6.7879cm of start]{}; \node(001t)[right= 1cm of 001]{022.40 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:16}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 7.9394cm of start]{}; \node(001t)[right= 1cm of 001]{026.20 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:20}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 8.4545cm of start]{}; \node(001t)[right= 1cm of 001]{027.90 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:24}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 9.3939cm of start]{}; \node(001t)[right= 1cm of 001]{031.00 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:26}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 10.8485cm of start]{}; \node(001t)[right= 1cm of 001]{035.80 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:28}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 11.2727cm of start]{}; \node(001t)[right= 1cm of 001]{037.20 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:32}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 12.303cm of start]{}; \node(001t)[right= 1cm of 001]{040.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:34}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 12.9091cm of start]{}; \node(001t)[right= 1cm of 001]{042.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:38}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 14.5455cm of start]{}; \node(001t)[right= 1cm of 001]{048.00 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:42}; \draw [thick] (001)--(001t); \node(001)[fill = black!10, draw = black, thick, circle, below = 16.2424cm of start]{}; \node(001t)[right= 1cm of 001]{053.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p)[left = 1cm of 001] { 00:00:46}; \draw [thick] (001)--(001t); \node(preend)[left = 1cm of end] { 00:00:52}; \node (endline) [right= 1cm of end] {059.40 - BCEA - Eindknooppunt, rioolput}; \draw [thick] (end)--(endline); \end{tikzpicture} \end{document} 
2
  • Welcome to TeX.SE! Please complete your code fragment to small, self contained compilable document. Also try to remove errors in code. Commented Oct 14, 2020 at 12:15
  • I comleted my code now... could you take a look for me? Commented Oct 14, 2020 at 13:31

1 Answer 1

1

Nodes, which overlap you need to push apart, first bove, second below the coordinate. One way is to do this manualy:

\documentclass{article} %--------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} % \usepackage{lipsum} % for dummy text %---------------------------------------------------------------% \usepackage[vmargin=20mm]{geometry} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \noindent% \begin{tikzpicture}[ node distance = 5mm and 10mm, every node/.append style = {inner ysep=1pt}, C/.style = {circle, draw, fill=gray!30, thick, inner sep=3pt, node contents={}}, oplus/.style = {% circle, draw, fill=gray!30, inner sep=3pt, path picture={\draw (path picture bounding box.south) -- (path picture bounding box.north) (path picture bounding box.west) -- (path picture bounding box.east);}} ] \node (start) [oplus, label=\textbf{VW004}] {}; \node (end) [oplus, label=below:\textbf{VW005}, below = 18cm of start] {}; \draw[thick, double](start)--(end); % colum titles \node (video) [above left = of start] {\textbf{Video}}; \node (foto) [left = of video] {\textbf{Foto}}; \node (afst) [above right = 5mm and 8mm of start] {\textbf{Afst./m}}; \node (toest) [right = 0mm of afst] {\textbf{Toest.}}; \node (beschr) [right = 0mm of toest]{\textbf{Beschrijving}}; % body \node [left = of start] {00:00:00}; \node (startline) [right= of start] {000.00 - BCDA - Beginknooppunt, rioolput}; \draw (start) -- (startline); \node (001) [C, below = 3.5 of start]; \node (001p) [above left = 0mm and 10mm of 001] { 00:00:10}; \node (001t) [above right = 0mm and 10mm of 001] {011.80 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001p.east); \draw (001)--(001t.west); \node (001) [C, below = 3.6 of start]; \node (001p) [below left = 0mm and 10mm of 001] {00:00:12}; \node (001t) [below right = 0mm and 10mm of 001] {017.30 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001p.east); \draw (001)--(001t.west); \node (001) [C, below = 5.4 of start]; \node (001p) [left = of 001] {00:00:14}; \node (001t) [right = of 001] {021.50 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 6.8 of start]; \node (001p) [left = of 001] {00:00:16}; \node (001t) [right = of 001] {022.40 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node(001) [C, below = 8 of start]; \node(001t) [right = of 001] {026.20 - BCAB - zadelaansluiting - geboord, open aansluiting }; \node(001p) [left = of 001] { 00:00:20}; \draw (001)--(001t); \node (001) [C, below = 8.5 of start]; \node (001p) [left = of 001] { 00:00:24}; \node (001t) [right = of 001] {027.90 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 9.3 of start]; \node (001p) [left = of 001] {00:00:26}; \node (001t) [right = of 001] {031.00 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 10.8 of start]{}; \node (001p) [left = of 001] { 00:00:28}; \node (001t) [right = of 001] {035.80 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 11.3 of start]{}; \node (001p) [left = of 001] {00:00:32}; \node (001t) [right = of 001] {037.20 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 12.3 of start]{}; \node (001p) [left = of 001] {00:00:34}; \node (001t) [right = of 001] {040.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 12.9 of start]{}; \node (001p) [left = of 001] {00:00:38}; \node (001t) [right = of 001] {042.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 14.5455cm of start]{}; \node (001p) [left = of 001] {00:00:42}; \node (001t) [right = of 001] {048.00 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (001) [C, below = 16.2 of start]{}; \node (001p) [left = of 001] {00:00:46}; \node (001t) [right = of 001] {053.60 - BCAB - zadelaansluiting - geboord, open aansluiting }; \draw (001)--(001t); \node (preend) [left = of end] {00:00:52}; \node (endline) [right = of end] {059.40 - BCEA - Eindknooppunt, rioolput}; \draw (end) -- (endline); \end{tikzpicture} \end{document} 

enter image description here

The second (simpler) possibility is to use the same distance between nodes. In this case the library chains is handy. Let me know, if you interested for the such solution.

1
  • Thanks a lot for your comment. The nodes are generated based on data from a database. In visual studio i run a foreach loop and every run generates a code line for tex, like this: tex.AppendLine(@"\node(" + inlaat.Id + ")[fill = black!10, draw = black, thick, circle, below = " + newdeelafstand + "cm of start]{};"); So i can't use the same distance between nodes. Sometimes they need to be close to eachother.. But maybe ik can make a statement in visual studio that if node0 and node1 distance is smaller than 5mm, i make the (001p.east) lines. I will try that. Commented Oct 14, 2020 at 13:58

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.