在 Latex 中创建蕴涵图

在 Latex 中创建蕴涵图

我正在尝试创建如下图所示的图表:

enter image description here

有人能帮帮我吗?如果可能的话,我更愿意使用 tikz 来完成,不过任何解决方案都很好。

答案1

这里为您提供一个快速入门指南,您可以进行调整。

箭头装饰由马克·维布罗这里

\documentclass[border=10]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,decorations}% for positioning nodes, decorating arrows
\pgfdeclaredecoration{arrows}{draw}{
\state{draw}[width = \pgfdecoratedinputsegmentlength]{%
  \path [every arrow subpath/.try] \pgfextra{%
    \pgfpathmoveto{\pgfpointdecoratedinputsegmentfirst}%
    \pgfpathlineto{\pgfpointdecoratedinputsegmentlast}%
   };
}}
\tikzset{% define styles for each node type and edges
                 base/.style = { circle, draw },
               filled/.style = { base, fill = black!50 },
  every arrow subpath/.style = { ->, draw, thick }
}
\def\xdist{2}
\def\yheight{2.5*\xdist}
\begin{document}
\begin{tikzpicture}
  % draw all the nodes first
  \draw node[filled] (1)                                     {1}
        node[filled] (3) at ($(1)-(0,\yheight)$)             {3}
        node[filled] (2) at ($(1)!.5!(3)$)                   {2}
        node[base]   (9) at ($(2)+(-4*\xdist,0)$)            {9}
        node[base]   (7) at ($(9)+(\xdist,-0.6*\xdist)$)     {7}
        node[base]   (8) at ($(9)+(2*\xdist,0)$)             {8}
        node[base]   (4) at ($(8)!.5!(1)$)                   {4}
        node[base]   (6) at ($(4)-(2*\xdist,0)$)             {6}
        node[base]   (5) at ($(8)!.5!(3)$)                   {5}
  ;
  % now the fun with arrows
  \draw[decoration=arrows, decorate]
        (9) -- (8) -- (4) -- (1)
        (6) -- (8) -- (5) -- (3)
        (7) -- (8) -- (4) -- (1)
        (4) -- (2)
        (5) -- (2)
  ;
\end{tikzpicture}
\end{document}

implication graph

相关内容