
Мой вопрос заключается в следующем: как вы можете видеть в коде ниже, я разместил несколько узлов и хочу соединить их линиями. Но пока мне не удалось сделать так, чтобы все линии начинались/заканчивались в одной и той же точке. Поэтому всегда есть дыры, и я понятия не имею, как их избежать.
\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\node[anchor=center] (1) at (0,5) {};
\node[above left=1 and 1 of 1.center,anchor=center] (11) {};
\node[above left =1 and 0.5 of 1.center,anchor=center] (12) {};
\draw (1) -- (11);
\draw (1) -- (12);
\node[anchor=center] (2) at (5,3) {};
\node[above right=1 and 1 of 2.center,anchor=center] (21) {};
\node[above right=0.5 and 1 of 2.center,anchor=center] (22) {};
\draw (2) -- (21);
\draw (2) -- (22);
\draw (1) -- (2);
\end{tikzpicture}
\end{document}
решение1
короче и правильнее:
\documentclass{article}
%\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\coordinate (1) at (0,5);
\draw (1) -- ++ (-1.0,1);
\draw (1) -- ++ (-0.5,1);
\coordinate (2) at (5,3);
\node[above right=1 and 1 of 2.center,anchor=center] (21) {};
\node[above right=0.5 and 1 of 2.center,anchor=center] (22) {};
\draw (2) -- ++ (1.0,1);
\draw (2) -- ++ (0.5,1);
\draw (1) -- (2);
\end{tikzpicture}
\end{document}