I want to create a straight line between two nodes in a tikzpicture
interrupted in the middle by a dotted portion. This should work whatever the orientation of the line.
Here is an expected output:
The best would be to have a line style defined for this instead of each time using clip
to remove the straight line and then tweak a dotted one to fit the hole. A minimal code for the solution would look like
\documentclass[a4paper, 12pt]{report}
\usepackage{tikz}
\tikzset{
middle dotted line/.style={
thick,
% YOUR HELP HERE
}
}% end of tikzset
\begin{document}
\begin{tikzpicture}
\node (A) at (0, 3) {};
\node (B) at (5, 3) {};
\node (C) at (0, 2) {};
\node (D) at (5, 0) {};
\draw[middle dotted line] (A) -- (B);
\draw[middle dotted line] (C) -- (D);
\end{tikzpicture}
\end{document}