如何在 TikZ 中获得自定义箭头尖

如何在 TikZ 中获得自定义箭头尖

我想知道是否有可能获得确切地以下箭头提示带有TikZ-PGF? 我已经在 PGF 手册和此站点中搜索了所有可能的解决方案,但只有近似的解决方案可用。以下是不同大小和方向的一些快照:

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

中间的图片提供了最准确的形状。

我需要详细信息。在我的例子中,构成箭头凸包的点,而不是中的四个点,例如,stealth或中的三个点latex

以下是所需的详细信息(当然,我有些夸张以突出小细节):

在此处输入图片描述

非常感谢您的任何建议。

答案1

stealth好吧,我设法解决了这个问题。在我找到内置箭头的代码后,这很容易。这个想法很简单,就是将我的情况中的额外点(即点 3、4、6 和 7)添加到原始代码中stealth。添加所需的点后,需要进行一些调整才能获得我想要的形状。

现在这是我为此构建的代码:

\pgfarrowsdeclare{varstealth}{varstealth}
 {
  \pgfarrowsleftextend{-5.59\pgflinewidth}
  \pgfarrowsrightextend{4.5\pgflinewidth}}
 {
  \pgfpathmoveto{\pgfpoint{4.5\pgflinewidth}{0pt}} %Point5
  \pgfpathlineto{\pgfpoint{-0.63\pgflinewidth}{1.09\pgflinewidth}} %Point4
  \pgfpathlineto{\pgfpoint{-5.48\pgflinewidth}{3.06\pgflinewidth}} %Point3
  \pgfpathlineto{\pgfpoint{-5.59\pgflinewidth}{3.0\pgflinewidth}}%Point2
  \pgfpathlineto{\pgfpoint{-3.95\pgflinewidth}{0pt}} %Point1
  \pgfpathlineto{\pgfpoint{-5.59\pgflinewidth}{-3.0\pgflinewidth}}%Point8
  \pgfpathlineto{\pgfpoint{-5.48\pgflinewidth}{-3.06\pgflinewidth}}%Point7
  \pgfpathlineto{\pgfpoint{-0.63\pgflinewidth}{-1.09\pgflinewidth}}%Point6
  \pgfusepathqfill
 }

我也尝试过使用它,如下面的例子所示(最初发现这里):

在此处输入图片描述

以下是此情况的代码:

\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\usetikzlibrary{backgrounds} 
\begin{document}
\pgfarrowsdeclare{varstealth}{varstealth}% My new arrow tip declaration
 {
  \pgfarrowsleftextend{-5.58\pgflinewidth}
  \pgfarrowsrightextend{4.5\pgflinewidth}}
 {
  \pgfpathmoveto{\pgfpoint{4.5\pgflinewidth}{0pt}} %Point5
  \pgfpathlineto{\pgfpoint{-0.63\pgflinewidth}{1.09\pgflinewidth}} %Point4
  \pgfpathlineto{\pgfpoint{-5.48\pgflinewidth}{3.06\pgflinewidth}} %Point3
  \pgfpathlineto{\pgfpoint{-5.59\pgflinewidth}{3.0\pgflinewidth}}%Point2
  \pgfpathlineto{\pgfpoint{-3.95\pgflinewidth}{0pt}} %Point1
  \pgfpathlineto{\pgfpoint{-5.59\pgflinewidth}{-3.0\pgflinewidth}}%Point8
  \pgfpathlineto{\pgfpoint{-5.48\pgflinewidth}{-3.06\pgflinewidth}}%Point7
  \pgfpathlineto{\pgfpoint{-0.63\pgflinewidth}{-1.09\pgflinewidth}}%Point6
  \pgfusepathqfill
 }

\begin{tikzpicture}[>=varstealth,line width= 1pt,node distance=1cm, auto, description/.style={fill=white,inner sep=2pt},punkt/.style={rectangle,rounded corners,draw=black, very thick,text width=6.5em,minimum height=3.5em,text centered}]

 %nodes
 \node[punkt]                      (Banks)  {Banks ($B_b$)};
 \node[left=4cm of Banks]          (dummy1) {};
 \node[right=4cm of Banks]         (dummy2) {};
 \node[punkt, above=4cm of dummy1] (CB)     {CB};
 \node[punkt, below=4cm of dummy1] (Gov)    {Government};
 \node[punkt, above=4cm of dummy2] (Firms)  {Firms ($F_f$)};
 \node[punkt, below=4cm of dummy2] (HH)     {HH ($HH_{hh}$)};

\path[->]
  (Gov.20)      edge[] node[below, rotate=48]  {\small Bonds}                       (Banks.220)
  (Banks.200)   edge[] node[above, rotate=48]  {\small Deposits}                    (Gov.40)
  (Firms.250)   edge[] node[above, rotate=90]  {\small wage, dividends}             (HH.110)
  (HH.70)       edge[] node[below, rotate=90]  {\small equity, consumption}         (Firms.290)
  (Gov.350)     edge[] node[below]             {\small unempl. benefit}             (HH.190)
  (HH.170)      edge[] node[above]             {\small Taxes}                       (Gov.10)
  (CB.325)      edge[] node[fill=white,below, sloped] {\small interest, OSDF}              (Banks.160)     
  (Banks.143)   edge[] node[fill=white,above, sloped] {\small interest, IDL, OMO, OSLF}    (CB.345)        
  (Firms.200)   edge[] node[above, rotate=48]  {\small principal/interest payments} (Banks.40)
  (Banks.20)    edge[] node[below, rotate=48]  {\small Loans, interest}             (Firms.220)
  (HH.143)      edge[] node[above, rotate=-50] {\small equity}                     (Banks.345)
  (Banks.325)   edge[] node[below, rotate=-50] {\small interest, dividends}        (HH.160)
  (Banks.west)  edge[out=200, in=340, looseness=5] node[below]  {\small interbank loans} (Banks.east);

\begin{scope}[on background layer]   %new code
\path[->, thick](Firms.170) edge[bend right=35]node[above, near end, rotate=60]  {\small Taxes} (Gov.120);
\end{scope}
\end{tikzpicture}
\end{document}

相关内容