我是 TikZ 的新手,制作了下图
这就是我想要的,但由于某种原因,箭头线并非全部连接到菱形的中心,这是为什么?我怎样才能让它们全部连接起来?我使用的代码是:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsthm, mathrsfs}
\newcommand{\scri}{\mathscr{I}}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.markings}
\usetikzlibrary{calc}
\usepgflibrary{arrows}
\begin{document}
%Arrows in centre
\tikzset{->-/.style={decoration={
markings,
mark=at position #1 with {\arrow[scale=1]{>}}},postaction={decorate}}}
\begin{tikzpicture}[>=open triangle 90]
\node (I) at ( 4,0) {};
\node (II) at (-5,0) {};
\path % Four conners of the right diamond
(I) +(90:4) coordinate[label=90:$i^+$] (Itop)
+(-90:4) coordinate[label=-90:$i^-$] (Ibot)
+(180:4) coordinate (Ileft)
+(0:4) coordinate[label=0:$i^0$] (Iright)
+(45: 2.825) coordinate (Imidtr)
+(225:2.825) coordinate (Imidbl)
+(135:2.825) coordinate (Imidtl)
+(-45:2.825) coordinate (Imidbr)
;
;
\draw (Ileft) --
node[midway, below, sloped] {$H^+$}
(Itop) --
node[midway, above right] {$\scri^+$}
node[midway, below, sloped] {$\bar{v}=\infty$}
(Iright) --
node[midway, below right] {$\scri^-$}
node[midway, above, sloped] {$\bar{u}=-\infty$}
(Ibot) --
node[midway, below, sloped] {$H^-$}
(Ileft) -- cycle;
%draw arrowed mode lines
\draw[->-=.5] (Imidbr) -- (I);
\draw[->-=.5] (I) -- (Imidtl);
\draw[->-=.5] (I) -- (Imidtr);
%REPEAT FOR THE DOWN MODES
\path % Four conners of the other diamond
(II) +(90:4) coordinate[label=90:$i^+$] (IItop)
+(-90:4) coordinate[label=-90:$i^-$] (IIbot)
+(180:4) coordinate (IIleft)
+(0:4) coordinate[label=0:$i^0$] (IIright)
+(45: 2.825) coordinate (IImidtr)
+(225:2.825) coordinate (IImidbl)
+(135:2.825) coordinate (IImidtl)
+(-45:2.825) coordinate (IImidbr)
;
% draw other diamond
\draw (IIleft) --
node[midway, below, sloped] {$H^+$}
(IItop) --
node[midway, above right] {$\scri^+$}
node[midway, below, sloped] {$\bar{v}=\infty$}
(IIright) --
node[midway, below right] {$\scri^-$}
node[midway, above, sloped] {$\bar{u}=-\infty$}
(IIbot) --
node[midway, below, sloped] {$H^-$}
(IIleft) -- cycle;
%draw modes:
\draw[->-=.5] (IImidbl) -- (II);
\draw[->-=.5] (II) -- (IImidtl);
\draw[->-=.5] (II) -- (IImidtr);
\end{tikzpicture}
\end{document}
答案1
将以下节点更改为坐标可解决问题....
\coordinate (I) at ( 4,0) ;
\coordinate (II) at (-5,0) ;
原因在于节点具有默认形状,其面积为非零,形状边界处有各种锚点。正如 Ryan Reich 在他的评论中提到的那样,大小取决于一些关键值,例如minimum width/height,inner sep,outer sep,line width
等。人们可以尝试将节点驱动得尽可能小,但这实际上不是一个好主意,因为这样它的底层路径绘制计算将被强制为 TeX 精度,并且可能(尽管并非总是如此)无论如何它都不会表现为坐标。
相比之下coordinate
, 只有一个锚点,即 ,center
它表征coordinate
。此外,当使用选项时,它们没有要绘制的形状或背景路径draw
。由于它们确实是坐标,因此线条会连接在一起。