我正在尝试绘制一个由三个节点组成的三角形简单图表。我很难让箭头“连接”到其中一个节点,箭头和节点本身之间有一个小间隙,我似乎无法将其移除。我使用搜索功能但没有成功。
这是我正在使用的代码:
\documentclass[10pt]{standalone}
% AMS Libraries
\usepackage{amsmath}
% Graphics Packages
\usepackage{tikz}
% Font Packages
\usepackage{concrete}
\usepackage[small,euler-digits]{eulervm}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[kerning,spacing,babel,final]{microtype}
% TiKz Options
\usetikzlibrary{positioning,arrows,calc}
\tikzset{
% general settings for a modal logic diagram
modal/.style={>=stealth', auto, very thick, align=center, anchor=center,
transform shape,font=\scriptsize},
% define the style for the events of an update model
event/.style={rectangle, rounded corners, draw, minimum size=0.5cm},
Event/.style={double, rectangle, rounded corners, draw, minimum size=0.5cm},
% define the styles for reflexive arcs in a Kripke structure or update model
reflexive above/.style={->, loop, looseness=7, in=120, out=60},
reflexive below/.style={->, loop, looseness=7, in=240, out=300},
reflexive left/.style={->, loop, looseness=7, in=150, out=210},
reflexive right/.style={->, loop, looseness=7, in=30, out=330},
symmetric/.style={<->}
}
\begin{document}
\begin{tikzpicture}[modal]
% define the points of the Kripke structure
\node[Event] (e1) {$\varepsilon_{1}$};
\node[event] (e2) [right=2cm of e1] {$\varepsilon_{2}$};
\coordinate (mid) at ($(e1)!0.5!(e2)$);
\node[event] (e3) [below=1cm of mid] {$\varepsilon_{3}$};
% define the accessibility relations of the Kripke structure
\path[symmetric] (e1) edge node[midway,above] {$B$} (e2);
\path[reflexive left] (e1) edge node[midway,left] {$A$} (e1);
\path[->] (e1) edge node[sloped,below] {$B,C$} (e3);
\path[reflexive right] (e2) edge node[midway,right] {$A$} (e2);
\path[->] (e2) edge node[sloped,below] {$B,C$} (e3);
\end{tikzpicture}
\end{document}
我怀疑我遗漏了一些琐碎的事情,如果可能的话,我想要一个能够容忍复杂细节的解决方案,因为我需要有更多类似的例子。
这是该图像的副本:
答案1
这仅仅是因为您使用的是rounded corners
矩形。因此,您应该通过发出选项来补偿修剪效果(如果您希望箭头接触矩形)shorten >= -2pt, shorten <= -2pt
。您可以手动控制shorten
距离。请注意,您只需要将两个边缘补偿到节点 e3。
修改后的代码如下:
\documentclass[tikz,10pt]{standalone}
\usepackage{amsmath}
% Font Packages
\usepackage{concrete}
\usepackage[small,euler-digits]{eulervm}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[kerning,spacing,babel,final]{microtype}
% TiKz Options
\usetikzlibrary{positioning,arrows,calc}
\tikzset{
% general settings for a modal logic diagram
modal/.style={>=stealth', auto, very thick, align=center, anchor=center,
transform shape,font=\scriptsize},
% define the style for the events of an update model
event/.style={rectangle,rounded corners, draw, minimum size=0.5cm},
Event/.style={double, rectangle, rounded corners, draw, minimum size=0.5cm},
% define the styles for reflexive arcs in a Kripke structure or update model
reflexive above/.style={->, loop, looseness=7, in=120, out=60},
reflexive below/.style={->, loop, looseness=7, in=240, out=300},
reflexive left/.style ={->, loop, looseness=7, in=150, out=210},
reflexive right/.style={->, loop, looseness=7, in=30, out=330},
symmetric/.style={<->}
}
\begin{document}
\begin{tikzpicture}[modal]
% define the points of the Kripke structure
\node[Event] (e1) {$\varepsilon_{1}$};
\node[event] (e2) [right=2cm of e1] {$\varepsilon_{2}$};
\coordinate (mid) at ($(e1)!0.5!(e2)$);
\node[event] (e3) [below=1cm of mid] {$\varepsilon_{3}$};
% define the accessibility relations of the Kripke structure
\path[symmetric] (e1) edge node[midway,above] {$B$} (e2);
\path[reflexive left] (e1) edge node[midway,left] {$A$} (e1);
\path[->,shorten >= -2pt, shorten <= -2pt] (e1) edge node[sloped,below] {$B,C$} (e3);
\path[reflexive right] (e2) edge node[midway,right] {$A$} (e2);
\path[->,shorten >= -2pt, shorten <= -2pt] (e2) edge node[sloped,below] {$B,C$} (e3);
\end{tikzpicture}
\end{document}
输出如下: