节点中的文本重叠

节点中的文本重叠

我创建了一个包含很多节点的 tikzpicture。这些节点有时彼此靠近,并且我的文本重叠。这是我的输出:

在此处输入图片描述

我想要的是这个:

在此处输入图片描述

文本行相互重叠,而不是重叠。有人能帮我解决这个问题吗?

这是我目前的代码:

\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}

答案1

需要将重叠的节点分开,第一个在坐标上方,第二个在坐标下方。一种方法是手动执行此操作:

\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}

在此处输入图片描述

第二种(更简单)可能性是使用相同的节点间距离。在这种情况下,库chains很方便。如果您对此类解决方案感兴趣,请告诉我。

相关内容