处理重叠向量 tikz

处理重叠向量 tikz

以下产生了不理想的输出,因为向量的“尾部”重叠且难以看清。有没有办法通过让所有向量仅绘制其距离的 95% 来更好地自动化某些事情?

有没有比我所规定的更好的解决方案?

此外,怎样才能将箭头->换成封闭的箭头-|>

\begin{tikzpicture}[scale=1.5]
%\tkzInit[xmin=-3,xmax=7,ymin=-6,ymax=5] \tkzGrid
\tkzInit

\tkzDefPoint(0,0){A}
\tkzDefPoint(4,0){B}
\tkzDefPoint(5,-3){C}
\tkzDefPoint(1,-3){D}

\draw[thick,->] (A) -- (B) node[above] {$B$};
\draw[thick,<-] (B) -- (C) node[below] {$C$};
\draw[thick,<-] (C) -- (D) node[below] {$D$};
\draw[thick,->] (D) -- (A) node[above] {$A$};

\tkzDefMidPoint(B,D) \tkzGetPoint{E}
\draw[thick,->] (D) -- (E) node[above] {$E$};
\draw[thick,->] (C) -- (E);
\draw[thick,->] (E) -- (A);
\draw[thick,->] (E) -- (B);

\end{tikzpicture}

在此处输入图片描述

答案1

一种解决方法是选择完整的箭头尖,并减少这些尖的角度,同时相应增加它们的长度。由于我对它tikz的箭头了解不多,这里是一个使用 MetaPost 的示例,其中我更改了相关参数的默认值ahlengthahangle适合该图。

包含在LuaLaTeX程序中,方便排版:

\documentclass[border=2bp]{standalone}
\usepackage{luamplib}
  \mplibsetformat{metafun}
  \mplibtextextlabel{enable}
\begin{document}
\begin{mplibcode}
  numeric u; u = 1.5cm;
  pair A, B, C, D, E; 
  A = origin; B = (4u, 0); C = u*(5, -3); D = u*(1, -3);
  E = .5[B, D] = .5[A, C];
  beginfig(1);
    ahangle := 22.5; % default 45°
    ahlength := 8bp; % default 4 bp
    drawarrow A -- B;
    drawarrow B -- C;
    drawarrow C -- D;
    drawarrow D -- A;
    drawarrow D -- E;
    drawarrow C -- E;
    drawarrow E -- A;
    drawarrow E -- B;
    freelabeloffset := 1.5bp;
    for str = "A", "B", "C", "D":
      freelabel("$" & str & "$", scantokens str, E);
    endfor
    label.top("$E$", E);
  endfig;
\end{mplibcode}
\end{document}

ahlength在和更改之前ahangle

在此处输入图片描述

修改后:

在此处输入图片描述

答案2

您可以使用shorten每行基础。由于这里的方向不同,因此不可能进行全局(自动解决方案)更改。要将箭头从 交换为->-|>请使用\usetikzlibrary{arrows.meta}并执行-|>..

\documentclass[a4paper]{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{arrows.meta}
\begin{document}
  \begin{tikzpicture}[scale=1.5]
%\tkzInit[xmin=-3,xmax=7,ymin=-6,ymax=5] \tkzGrid
\tkzInit

\tkzDefPoint(0,0){A}
\tkzDefPoint(4,0){B}
\tkzDefPoint(5,-3){C}
\tkzDefPoint(1,-3){D}

\draw[thick,->,shorten >=.5mm] (A) -- (B) node[above] {$B$};
\draw[thick,<-,shorten <=.5mm] (B) -- (C) node[below] {$C$};
\draw[thick,<-,shorten <=.5mm] (C) -- (D) node[below] {$D$};
\draw[thick,->,shorten >=.5mm] (D) -- (A) node[above] {$A$};

\tkzDefMidPoint(B,D) \tkzGetPoint{E}
\draw[thick,->,shorten >=.5mm] (D) -- (E) node[above] {$E$};
\draw[thick,->,shorten >=.5mm] (C) -- (E);
\draw[thick,->,shorten >=.7mm] (E) -- (A);
\draw[thick,->,shorten >=.5mm] (E) -- (B);

%% arrow head

\draw[thick,-|>] (C) -- +(2cm,0);

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

全局选项其实不是问题。你只需定义一个样式并更改命令中箭头的方向\draw,即你总是说“从 x 到 y 画一个箭头”,y 就是箭头指向的位置。

对于封闭的箭头,你应该看看 tikz 的箭头库。一个简单的是-stealth

\documentclass[a4paper]{article}
\usepackage{tkz-euclide}
\usetkzobj{all}
\usetikzlibrary{arrows.meta}
\begin{document}
  \begin{tikzpicture}[
    scale=1.5,
    ar/.style={thick, -stealth, shorten >=.5mm}]
  \tkzInit

  \tkzDefPoint(0,0){A}
  \tkzDefPoint(4,0){B}
  \tkzDefPoint(5,-3){C}
  \tkzDefPoint(1,-3){D}

  \draw[ar] (A) -- (B) node[above] {$B$};
  \draw[ar] (C) -- (B) node[below] {$C$};
  \draw[ar] (D) -- (C) node[below] {$D$};
  \draw[ar] (D) -- (A) node[above] {$A$};

  \tkzDefMidPoint(B,D) \tkzGetPoint{E}
  \draw[ar] (D) -- (E) node[above] {$E$};
  \draw[ar] (C) -- (E);
  \draw[ar] (E) -- (A);
  \draw[ar] (E) -- (B);

  %% arrow head

  \draw[thick,-|>] (C) -- +(2cm,0);

 \end{tikzpicture}
 \end{document}

相关内容