5

I have three problems with a tikz picture given in the MWE below.

The first problem is that the head of the arrow lies on the line/border of the Brectangle (not much, but some visible pixels). What I would like to achieve is that the head of the arrow ends directly at the line.

The second problem occurs where the line/border of the A rectangle crosses the shadow of the B rectangle. The part which lies under the shadow is gray which is correct. However, I would like to have the line "above" the shadow and thus no influence on its color appearance.

The last problem occurs where the line/border of the A rectangle crosses the dashed line/border of the E rectangle. Here the line of A should end at the border of the dashed line and not in the middle of it.

Edit: Pictures added

First problem: First problem

Second problem: Second problem

Third problem: Third problem

MWE

\documentclass {report} 


\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,positioning}
\usetikzlibrary{shadows}

\begin{document}


\begin{tikzpicture}
[
    box/.style ={draw,minimum height=0.9cm,minimum width=2.1cm,inner sep=4,align=center,fill=white,drop shadow={opacity=0.4,shadow xshift=.3ex,shadow yshift=-.3ex}},
    arrowstyle/.style={-{Latex[angle=90:8pt]},line width=4pt, rounded corners=10pt}
]


    \node[draw,minimum width=4cm,minimum height=1.4cm](D){};
        \node[right=0.5cm of D.west](A){A};
        \node[box, above right = 0.4cm and -1.5cm of A.east](B){B};
        \node[box, above = 2cm of B.north](C){C};

        \node[draw,minimum height=2.2cm,minimum width=3cm,thick,dashed,align=center,fill=white,right = 1.3cm of B.east](E){E};

    \draw[->,arrowstyle,gray!90]    (C.south) -- (B.north); 

\end{tikzpicture}


\end{document}
5
  • The first problem is only visible if you really zoom in. And I don't understand the second problem. Can you upload a picture of what you get with your code? I have the feeling we're seeing different things.
    – Alenanno
    Commented May 15, 2016 at 15:23
  • @Alenanno I know that the first issue is minor. Nonetheless, I would like to resolve it. I added a picture for the second issue. The black line coming from the right changes it's color to a dark grey, because of the shadow of the node B. Commented May 15, 2016 at 16:25
  • shorten <=1pt or shorten >=1pt change appropriately
    – daleif
    Commented May 15, 2016 at 16:31
  • @daleif Thanks, that resolved the first issue. However, it's strange that this manual adjustment is necessary as all other arrow heads which where not customized end just fine before the line. Commented May 15, 2016 at 16:45
  • @user2653422 1. It seems the precision of PGF ist not good enough to calculate the proper dimensions of the arrow down to the hundredth of a millimetre. 2. Draw the shadowed node first. 3 The filled rectangle only includes half the linewidth. If you use a proper line instead of the D node, the outer sep fully work. Commented May 15, 2016 at 17:16

1 Answer 1

8
  1. Fixed by shorten >=.1pt.

  2. Fixed by drawing the rectangle of node D afterwards, over the gray shadowed area. Clipping is needed for preventing drawing inside nodes B and E.

  3. Fixed by Clipping.

Full example:

\documentclass {report}

\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta,positioning}
\usetikzlibrary{calc}
\usetikzlibrary{shadows}

\begin{document}


\begin{tikzpicture}[
  box/.style ={
    draw,
    minimum height=0.9cm,
    minimum width=2.1cm,
    inner sep=4,
    align=center,
    fill=white,
    drop shadow={
      opacity=0.4,
      shadow xshift=.3ex,
      shadow yshift=-.3ex,
    },
  },
  arrowstyle/.style={
    -{Latex[angle=90:8pt]},
    line width=4pt,
    rounded corners=10pt,
  },
]

  \node[
    % draw,
    minimum width=4cm,
    minimum height=1.4cm,
  ] (D) {};
  \node[right=0.5cm of D.west](A){A};
  \node[box, above right = 0.4cm and -1.5cm of A.east](B){B};
  \node[box, above = 2cm of B.north](C){C};

  \node[
    draw,
    minimum height=2.2cm,
    minimum width=3cm,
    thick,
    dashed,
    align=center,
    fill=white,
    right = 1.3cm of B.east,
  ] (E) {E};

  \draw[->, arrowstyle, gray!90, shorten >=.1pt] (C.south) -- (B.north);

  \begin{scope}
    \clip (B.south west) -- (B.south east) -- (B.north east)
      -- (E.north west) -- (E.south west) -- (E.south east)
      -- ($(current bounding box.south east) + (0pt, -.4pt)$)
      -- (current bounding box.south west) -- cycle
    ;
    \draw (D.south west) rectangle (D.north east);
  \end{scope}

\end{tikzpicture}
\end{document}

Result

You must log in to answer this question.

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