tikz-pfg 手册第 316 页描述了元箭头尖,并说通常我们不希望尖头以与支撑线相同的方式缩放。有没有办法保留此功能,即当使用时line width=5pt
,尖头应该比大五倍line width=1pt
?
答案1
v2.10 pgfmanual 在第 609 页讨论了这些内容。它显示了元箭头和调整大小箭鎖。
在手册的 TeX 代码中,箭头的尖端使用 进行编码pgfarrowsdeclare
。基于此,我认为没有现成的选项可以简单地将箭头调整大小根据线宽。因此,如果您想使用它们,则需要在文档中包含下面显示的bad latex
和箭头样式的代码。然后,要选择它们,而不是将箭头指定为或箭头,您只需使用或。bad to
[-latex]
[-to]
[-bad latex]
[-bad to]
下面是一个比较。红色箭头表示调整大小根据线的大小,蓝色的是元箭头不是简单地按比例缩放的。从小线和大线宽可以清楚地看出元箭头产生更好看的结果:
以下是几乎直接从中复制的代码pgfmanual-en-base-arrows.tex
:
\documentclass{article}
\usepackage{tikz}
\usepackage{soul}% for highlighting output
\begin{document}
\pgfarrowsdeclare{bad latex}{bad latex}
{
\pgfarrowsleftextend{-1\pgflinewidth}
\pgfarrowsrightextend{9\pgflinewidth}
}
{
\pgfpathmoveto{\pgfpoint{9\pgflinewidth}{0pt}}
\pgfpathcurveto
{\pgfpoint{6.3333\pgflinewidth}{.5\pgflinewidth}}
{\pgfpoint{2\pgflinewidth}{2\pgflinewidth}}
{\pgfpoint{-1\pgflinewidth}{3.75\pgflinewidth}}
\pgfpathlineto{\pgfpoint{-1\pgflinewidth}{-3.75\pgflinewidth}}
\pgfpathcurveto
{\pgfpoint{2\pgflinewidth}{-2\pgflinewidth}}
{\pgfpoint{6.3333\pgflinewidth}{-.5\pgflinewidth}}
{\pgfpoint{9\pgflinewidth}{0pt}}
\pgfusepathqfill
}
\pgfarrowsdeclare{bad to}{bad to}
{
\pgfarrowsleftextend{-2\pgflinewidth}
\pgfarrowsrightextend{\pgflinewidth}
}
{
\pgfsetlinewidth{0.8\pgflinewidth}
\pgfsetdash{}{0pt}
\pgfsetroundcap
\pgfsetroundjoin
\pgfpathmoveto{\pgfpoint{-3\pgflinewidth}{4\pgflinewidth}}
\pgfpathcurveto
{\pgfpoint{-2.75\pgflinewidth}{2.5\pgflinewidth}}
{\pgfpoint{0pt}{0.25\pgflinewidth}}
{\pgfpoint{0.75\pgflinewidth}{0pt}}
\pgfpathcurveto
{\pgfpoint{0pt}{-0.25\pgflinewidth}}
{\pgfpoint{-2.75\pgflinewidth}{-2.5\pgflinewidth}}
{\pgfpoint{-3\pgflinewidth}{-4\pgflinewidth}}
\pgfusepathqstroke
}
\newcommand*{\ArrowType}[1]{\hl{\textbf{-#1}}}%
\sethlcolor{lightgray}
These are the \emph{resized} \ArrowType{bad latex} and \ArrowType{bad to} arrows:
\medskip
\begin{tikzpicture}[draw=red,fill=red]
\draw[-bad latex,line width=0.1pt] (0pt,0ex) -- +(3,0) node[thin,right] {line width is 0.1pt};
\draw[-bad latex,line width=0.4pt] (0pt,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
\draw[-bad latex,line width=1.2pt] (0pt,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
\draw[-bad latex,line width=5pt] (0pt,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\draw[-bad to,line width=0.1pt] (6cm,0ex) -- +(3,0) node[thin,right] {line width is 0.1pt};
\draw[-bad to,line width=0.4pt] (6cm,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
\draw[-bad to,line width=1.2pt] (6cm,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
\draw[-bad to,line width=5pt] (6cm,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\end{tikzpicture}
\bigskip\bigskip
And the standard meta \ArrowType{latex} and \ArrowType{to} arrows:
\medskip
\begin{tikzpicture}[draw=blue,fill=blue]
\draw[-latex,line width=0.1pt] (0pt,0ex) -- +(3,0) node[thin,right] {line width is 0.1pt};
\draw[-latex,line width=0.4pt] (0pt,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
\draw[-latex,line width=1.2pt] (0pt,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
\draw[-latex,line width=5pt] (0pt,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\draw[-to,line width=0.1pt] (6cm,0ex) -- +(3,0) node[thin,right] {line width is 0.1pt};
\draw[-to,line width=0.4pt] (6cm,-2em) -- +(3,0) node[thin,right] {line width is 0.4pt};
\draw[-to,line width=1.2pt] (6cm,-4em) -- +(3,0) node[thin,right] {line width is 1.2pt};
\draw[-to,line width=5pt] (6cm,-6em) -- +(3,0) node[thin,right] {line width is 5pt};
\end{tikzpicture}
\end{document}