我有一个箭头样式,它适用于直箭头。该样式的唯一目的是放大箭头,因此如果有更简单的方法可以做到这一点,请告诉我。无论如何,当我将样式应用于弯曲箭头时,不会渲染任何箭头。提供的 MWE 显示带有默认箭头的弯曲箭头,但我非常希望以某种方式应用我的箭头样式。
\documentclass{article}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{calc,shapes.multipart,chains,arrows,decorations.markings}
\begin{document}
\begin{figure}[H]
\centering
\begin{tikzpicture}[list/.style={rectangle split, rectangle split parts=2,
draw, rectangle split horizontal, thick, minimum
height=1cm}, >=stealth, start chain]
\tikzstyle{arrow} = [decoration={markings,mark=at position 1 with
{\arrow[scale=2,>=stealth]{>}}},postaction={decorate}]
\node[list,on chain] (A) {$A_1$};
\node[list,on chain] (B) {$A_2$};
\node[list,on chain] (C) {$A_3$};
\node[list,on chain] (D) {$A_4$};
\node[list,on chain] (E) {$A_5$};
\node[on chain] (F) {NULL};
\draw[arrow] let \p1 = (A.two), \p2 = (A.center) in (\x1,\y2) -- (B);
\draw[arrow, dashed] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) -- (C);
%%%%---I would like the arrowhead style applied here---%%%%
\draw[->,>=stealth, thick] let \p1 = (B.two), \p2 = (B.center) in (\x1,\y2) to [bend left=60] (D.one west);
\draw[arrow] let \p1 = (C.two), \p2 = (C.center) in (\x1,\y2) -- (D);
\draw[arrow] let \p1 = (D.two), \p2 = (D.center) in (\x1,\y2) -- (E);
\draw[arrow] let \p1 = (E.two), \p2 = (E.center) in (\x1,\y2) -- (F);
\end{tikzpicture}
\end{figure}
\end{document}
答案1
像这样?
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, % <---
bending,
chains,
shapes.multipart}
\begin{document}
\begin{tikzpicture}[
every edge/.style = {draw, -{Stealth[angle=30:7pt, bend]}}, % <---
start chain = going right,
list/.style = {rectangle split, rectangle split parts=2,
rectangle split horizontal,
rectangle split empty part width=1.5em,
draw, thick, minimum height=1cm,
on chain},
]
\begin{scope}[nodes={list}]
\node (A) {$A_1$};
\node (B) {$A_2$};
\node (C) {$A_3$};
\node (D) {$A_4$};
\node (E) {$A_5$};
\end{scope}
\node [on chain] (F) {NULL};
%
\draw (A.two north |- A.two east) edge (B)
(B.two north |- C.two east) edge[dashed] (C)
(C.two north |- C.two east) edge (D)
(D.two north |- D.two east) edge (E)
(E.two north |- E.two east) edge (F);
\draw[semithick]
(B.two north |- B.two east) edge[bend left=45] (D.west);
\end{tikzpicture}
\end{document}
编辑: 添加了箭头尺寸的详细信息。如果箭头长度相同,则所有箭头都相同:
如何确定箭头尺寸在章节中描述16.3.1 大小在里面TikZ & PGF 手册,第 194-197 页。它是您
tikz
安装的一部分,或者您可以在 CTAN 中找到它(使用谷歌找到它)。如果箭头是弯曲的,则将箭头头与弯曲线对齐,选项
bend
和flex
。它们的用法在章节中描述16.3.8 弯曲和屈曲,第 202-204 页。对于这两个功能,您需要加载库
arrows.meta
和bending