如何在 TikZ 图片中全局更改箭杆的粗细?

如何在 TikZ 图片中全局更改箭杆的粗细?

如何改变厚度全部TikZ 图片中的箭杆,例如,在以下大大简化、精简的示例版本中https://texample.net/tikz/examples/homotopy/

正如注释代码所示,我在两处地方尝试指定厚度,但似乎都没有任何效果。

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
%\tikzstyle{arrow}=[ultra thick] % no effect here ??
\begin{document}
\begin{tikzpicture}%
%[arrow/.style={ultra thick}] % no effect here, either??
  \node  (x1) at (6,0)  {$\bullet$};
  \node  (x0) at (9,4)  {$\bullet$};
  \node (R) at (2,4){$\bullet$};
  \draw[->] ($(R.west)+(-20pt,0)$) to[out=-180,in=240] ++(0,2)
    to [out=60,in=120]node[above,midway]{}(x0);
  \draw[->] ($(R.north)+(0,10pt)$) to [out=60,in=120]
    node[above,midway]{} ++(4.5,-1);
  \draw[->] ($(R.east)+(20pt,0)$)  to [out=0,in=140]
    node[right,midway]{}(x1);
  \draw[->] ($(R.south)+(0,-20pt)$)  to [out=-85,in=-30]
    node[below,midway]{}++(7,0);
\end{tikzpicture}
\end{document}

答案1

使用arrows.meta库并声明全局箭头样式。

全局箭头大小

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc}
\begin{document}
\begin{tikzpicture}[>={Stealth[scale=3]}]
  \node  (x1) at (6,0)  {$\bullet$};
  \node  (x0) at (9,4)  {$\bullet$};  
  \node (R) at (2,4){$\bullet$};
  \draw[->] ($(R.west)+(-20pt,0)$) to[out=-180,in=240] ++(0,2)
    to [out=60,in=120]node[above,midway]{}(x0); 
  \draw[->] ($(R.north)+(0,10pt)$) to [out=60,in=120]
    node[above,midway]{} ++(4.5,-1); 
  \draw[->] ($(R.east)+(20pt,0)$)  to [out=0,in=140]
    node[right,midway]{}(x1); 
  \draw[->] ($(R.south)+(0,-20pt)$)  to [out=-85,in=-30]
    node[below,midway]{}++(7,0);    
\end{tikzpicture}
\end{document}

编辑

如果您想要创建自定义样式,您也必须使用它。如下所示,arr使用 样式。tikzstyle现在已弃用 ,您应该使用tikzset

全局箭头大小 2

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc}

\tikzset{arr/.style={ultra thick,->,>={Stealth[scale=1.5]}}}
\begin{document}
\begin{tikzpicture}
  \node  (x1) at (6,0)  {$\bullet$};
  \node  (x0) at (9,4)  {$\bullet$};  
  \node (R) at (2,4){$\bullet$};
  \draw[arr] ($(R.west)+(-20pt,0)$) to[out=-180,in=240] ++(0,2)
    to [out=60,in=120]node[above,midway]{}(x0); 
  \draw[arr] ($(R.north)+(0,10pt)$) to [out=60,in=120]
    node[above,midway]{} ++(4.5,-1); 
  \draw[arr] ($(R.east)+(20pt,0)$)  to [out=0,in=140]
    node[right,midway]{}(x1); 
  \draw[arr] ($(R.south)+(0,-20pt)$)  to [out=-85,in=-30]
    node[below,midway]{}++(7,0);    
\end{tikzpicture}
\end{document}

答案2

我想你可以重新定义->,但我不知道这是否会产生意想不到的后果,所以请测试一下。这可能是一个坏主意。

<-显然,如果您也想对和实现相同的效果<->,那么您也需要重新定义它们。

\tikzset{->/.style={-Latex, ultra thick}}

在此处输入图片描述

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc} 
\tikzset{->/.style={-Latex, ultra thick}}
\begin{document}
\begin{tikzpicture}%
  \node  (x1) at (6,0)  {$\bullet$};
  \node  (x0) at (9,4)  {$\bullet$};  
  \node (R) at (2,4){$\bullet$};
  \draw[->] ($(R.west)+(-20pt,0)$) to[out=-180,in=240] ++(0,2)
    to [out=60,in=120]node[above,midway]{}(x0); 
  \draw[->] ($(R.north)+(0,10pt)$) to [out=60,in=120]
    node[above,midway]{} ++(4.5,-1); 
  \draw[->] ($(R.east)+(20pt,0)$)  to [out=0,in=140]
    node[right,midway]{}(x1); 
  \draw[->] ($(R.south)+(0,-20pt)$)  to [out=-85,in=-30]
    node[below,midway]{}++(7,0);    
\end{tikzpicture}
\end{document}

相关内容