4

I am trying to make double line remove border of the shapes that it connects. The best I was able to achieve is this:

\draw[line width=1pt, double=white, draw=black!30, double distance=3pt, 
      shorten >= -1.8pt, shorten <= -1.8pt] 
      (Photos) -- (PhotosM);

It works fine-ish in case of horizontal line, here is an example:

The problem is that:

  1. shorten distances have to be adjusted manually and
  2. it does not work in case of non-horizontal lines:

enter image description here

Minimal Example:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary {positioning}
\begin{document}
\begin{tikzpicture}
   \tikzstyle{rounded_rectangle} = [rectangle, rounded corners=8pt, minimum height=17pt] % Shape % minimum width=1cm, minimum height=0.1cm,
   \tikzstyle{noders_default}    = [rounded_rectangle, font=\footnotesize, text centered, draw=black!30, thick, fill=white] % node resizing
   \tikzstyle{nodefx_default}    = [noders_default, text width=70pt] % node fixed width
   \begin{scope}[every node/.style=noders_default]
      \node                      (col1) {column 1};
      \node [right=70pt of col1] (col2) {column 2};
   \end{scope}
   \begin{scope}[node distance=12pt, every node/.style=nodefx_default]
      \node[nodefx_default, below=of col1]   (Photos)   {Photos};
      \node[nodefx_default, below=of Photos] (Messages) {Messages};
   \end{scope}
   \begin{scope}[anchor=west]
      \node[noders_default] at (Photos   -| col2.west) (PhotosM)   {qwer};
      \node[noders_default] at (Messages -| col2.west) (MessagesM) {asdf};
   \end{scope}

   %
   %
   % THE QUESTION IS HERE:
   %

   \draw[line width=1pt, double=white, draw=black!30, double distance=3pt, shorten >= -1.8pt, shorten <= -1.8pt] (Photos) -- (PhotosM);
   \draw[line width=1pt, double=white, draw=black!30, double distance=3pt, shorten >= -3pt, shorten <= -9pt] (Photos) -- (MessagesM);

\end{tikzpicture}
\end{document}

1 Answer 1

5

You can put the main lines in a background layer, and then redraw the white core to cancel out the borders. Probably you can go away with a fixed shorten now, but I did not check.

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary {positioning, backgrounds}
\begin{document}
\begin{tikzpicture}
    % tikzstyle is obsolete, this is the "new way":
    \tikzset{rounded_rectangle/.style={rectangle, rounded corners=8pt,
        minimum height=17pt},
        noders_default/.style={rounded_rectangle, font=\footnotesize,
        text centered, draw=black!30, thick, fill=white},
        nodefx_default/.style={noders_default, text width=70pt},
    }%
    \begin{scope}[every node/.style=noders_default]
        \node                      (col1) {column 1};
        \node [right=70pt of col1] (col2) {column 2};
    \end{scope}
    \begin{scope}[node distance=12pt, every node/.style=nodefx_default]
        \node[nodefx_default, below=of col1]   (Photos)   {Photos};
        \node[nodefx_default, below=of Photos] (Messages) {Messages};
    \end{scope}
    \begin{scope}[anchor=west]
        \node[noders_default] at (Photos   -| col2.west) (PhotosM)   {qwer};
        \node[noders_default] at (Messages -| col2.west) (MessagesM) {asdf};
    \end{scope}

    %
    %
    % THE QUESTION IS HERE:
    %
    \begin{scope}[on background layer]
        \draw[line width=1pt, double=white, draw=black!30, double distance=3pt, shorten >= -1.8pt, shorten <= -1.8pt] (Photos) -- (PhotosM);
        \draw[line width=1pt, double=white, draw=black!30, double distance=3pt, shorten >= -3pt, shorten <= -9pt] (Photos) -- (MessagesM);
    \end{scope}
    \draw[line width=3pt, draw=white, shorten >= -1.8pt, shorten <= -1.8pt] (Photos) -- (PhotosM);
    \draw[line width=3pt, draw=white, shorten >= -3pt, shorten <= -9pt] (Photos) -- (MessagesM);

\end{tikzpicture}
\end{document}

enter image description here

3
  • Nice answer....
    – Sebastiano
    Nov 24, 2021 at 12:19
  • Almost perfect! The only problem is if text in a node is too close to the white arrow (overlap) - white arrow will erase it as well. If there is no another answer, I will accept it, thank you! :)
    – DimanNe
    Nov 24, 2021 at 13:21
  • 1
    @DimanNe yes, I noticed it --- but It's complex (short of re-write the text also, which seems overkill). Maybe just bump up a bit the inner sep...?
    – Rmano
    Nov 24, 2021 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .