我对下面 MWE 中给出的 tikz 图片有三个问题。
第一个问题是箭头的头部位于B
矩形的线/边框上(不多,但有一些可见的像素)。我想要实现的是箭头的头部直接位于线上。
第二个问题发生在矩形的线/边框与矩形A
的阴影相交的地方B
。阴影下方的部分是灰色的,这是正确的。但是,我希望线条位于阴影“上方”,这样就不会影响其颜色外观。
最后一个问题出现在矩形的线/边框A
与矩形的虚线/边框相交的地方E
。这里的线A
应该结束在虚线的边框处,而不是在虚线的中间。
编辑:添加图片
平均能量损失
\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}
答案1
由 修复
shorten >=.1pt
。通过在灰色阴影区域上绘制节点的矩形来修复
D
。需要进行剪切以防止在节点 B 和 E 内进行绘制。通过剪辑修复。
完整示例:
\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}