\begin{tikzpicture}[>=latex'] 是什麼意思?

\begin{tikzpicture}[>=latex'] 是什麼意思?

代碼來自這裡。在該行中\begin{tikzpicture}[auto, node distance=2cm,>=latex']我不明白這個命令>=latex'。我在手冊中沒有找到任何相關內容TikZ & PGF

提前謝謝你的幫忙!

答案1

來自 TikZ 版本 3.0.1a 手冊,第 16.4 節,第 201 頁:

在此輸入影像描述

所以,>=是一個簡寫來告知您想要的箭頭提示。注意與>=Latex和相關的不同箭頭樣式>=Stealth

答案2

測試後我得到了關注。

與舊圖書館和>=

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows}% old library
\begin{document}
  \begin{tikzpicture}
    \draw [-> = latex'] (0, 3) -- (1, 3);% old arrow tip
    \draw [-> = latex] (0, 2) -- (1, 2);% old arrow tip
    \draw [-> = Latex] (0, 1) -- (1, 1);
    \draw [->] (0, 0) -- (1, 0);
  \end{tikzpicture}
\end{document}

該行\draw [-> = Latex] (0, 1) -- (1, 1);產生錯誤(如預期):

!包 pgf 錯誤:未知的箭頭類型“Latex”。

結果:

結果

所以>=在這種語法中不起作用。

與舊圖書館和-arrow tip type

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows}% old library
\begin{document}
  \begin{tikzpicture}
    \draw [-latex'] (0, 3) -- (1, 3);% old arrow tip
    \draw [-latex] (0, 2) -- (1, 2);% old arrow tip
    \draw [-Latex] (0, 1) -- (1, 1);
    \draw [->] (0, 0) -- (1, 0);
  \end{tikzpicture}
\end{document}

該行\draw [-Latex] (0, 1) -- (1, 1);會產生錯誤,如上所述。

結果:

結果1

它像它應該的那樣工作。

有了新的圖書館和>=.

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
  \begin{tikzpicture}
    \draw [> = latex'] (0, 3) -- (1, 3);% old arrow tip
    \draw [> = latex] (0, 2) -- (1, 2);% old arrow tip
    \draw [> = Latex] (0, 1) -- (1, 1);
    \draw [->] (0, 0) -- (1, 0);
  \end{tikzpicture}
\end{document}

該行\draw [> = latex'] (0, 3) -- (1, 3);產生錯誤(如預期):

!包 pgf 錯誤:未知的箭頭類型“乳膠”。

結果:

結果2

同樣>=在這種語法中不起作用。

新圖書館有-arrow tip type

\documentclass{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\begin{document}
  \begin{tikzpicture}
    \draw [-latex'] (0, 3) -- (1, 3);% old arrow tip
    \draw [-latex] (0, 2) -- (1, 2);% old arrow tip
    \draw [-Latex] (0, 1) -- (1, 1);
    \draw [->] (0, 0) -- (1, 0);
  \end{tikzpicture}
\end{document}

該行\draw [> = latex'] (0, 3) -- (1, 3);會產生錯誤,如上所述。

結果:

結果3

它像它應該的那樣工作。

手冊中的描述TikZ(第 16.1 節,第 182 頁):

評論:下面描述的幾乎所有功能都是在 3.0 版本中引入的TikZ。出於相容性原因,舊的箭頭提示仍然可用。為了區分舊的和新的箭頭提示,使用以下規則:Latex與舊的箭頭提示相比,新的、更強大的箭頭提示以大寫字母開頭,如latex

評論: 庫arrowsarrows.spaced已棄用。使用arrows.meta替代/附加,它允許您執行舊庫提供的所有操作,甚至更多。但是,舊的庫仍然可以工作,您甚至可以混合使用舊的和新的箭頭提示(只是,舊的箭頭提示不能按照本節其餘部分中描述的方式進行配置;例如,說scale=2for a arrow 沒有效果,而for箭頭的大小如人們所預期的增加了一倍。latexLatex

相關內容