如何在LaTeX中创建以下插图?

问题描述 投票:1回答:3

我试图在LaTex中创建以下插图,但效果不佳。问题是我无法确定想要的箭头的起点或终点。任何建议/提示如何成功做到这一点?

[Illustration of a game theoretic setup

image latex
3个回答
1
投票

这里有可能使用带有计算和定位库的tikz实现

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,calc}

\begin{document}
  \begin{tikzpicture}[box/.style={
      draw,thick,
    },
    label/.style={draw=none,midway,sloped,above,font=\small},
    myarrow/.style={->,thick} ,
    ]
    %poition upper and lower nodes
    \node[box] (gov) {Government};
    \node[box,below=4cm of gov,minimum width=3cm,dotted] (trans) {Transaction} ;

    % position first line extremity at, say, 1/3 gov node
    \coordinate (extr1) at ($(trans.north west)!0.33!(trans.north east)$) ;
    % then extremity 2 slightly at the right of extr1
    \coordinate (extr2) at ([xshift=2mm]extr1) ;

    % position bank vertically halfway gov/trans and centered wrt extr1 and extr2
    % due to some limitations in tikz parser, one must first define intermediate coords
    \coordinate (extr12) at ($(extr1)!0.5!(extr2)$) ;
    \coordinate (mid) at ($(gov)!0.5!(trans)$);
    \node[box] (bank) at (extr12 |- mid) {Bank};
    % draw first arrows
    \draw[myarrow] (extr1) -- (extr1 |- bank.south) node[label] {information};
    \draw[myarrow] (extr2 |- bank.south) -- (extr2) node[label] {monitoring};
    \draw[myarrow] (extr1 |- bank.north) -- (extr1 |- gov.south) node[label] {reporting} ;
    \draw[myarrow] (extr2 |- gov.south) -- (extr2 |- bank.north) node[label] {fines} ;
    % position last arrow midway from east border of bank and gov
    \coordinate (extr3) at ($(bank.east)!0.5!(gov.east)$) ;
    \draw[myarrow] (extr3 |- gov.south) -- (extr3 |- trans.north) node[label] {investigation} ;
\end{tikzpicture}
\end{document}

enter image description here

您必须为所需的定位修改几个参数,并根据需要向节点/线添加样式。


0
投票

到目前为止,我已经完成了这里...:D:

\begin{center}
\begin{tikzpicture}

\draw[fill=blue!20](3,3) rectangle (7,5) node[midway,align=center](Pankki){Pankki};

\draw[fill=blue!20](5,7) rectangle (10,10) node[midway,align=center](Valtio){Valtio};


[enter image description here][1]
\end{tikzpicture}
\end{center} 

0
投票

使用northsouth(和phantom)使其在垂直方向上正常。相反,我想使用calc TikZ库以更优雅的方式从节点(a)(b)(c)水平偏移箭头的端点,但我没有成功:

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{arrows,decorations.markings}

\begin{document}
  \begin{tikzpicture}[>=triangle 45, thick, sloped]
    \node [rectangle, very thick, draw, right] (a) at (0,6) {\large\textbf{Government}};
    \node [rectangle, very thick, draw, right] (b) at (0,3) {\large\textbf{Bank}};
    \node [rectangle, densely dotted, draw, right] (c) at (0,0) {\large Transaction};
    \node (d) at (.2,6) {\phantom{G}};
    \node (e) at (.2,3) {\phantom{B}};
    \node (f) at (.2,0) {\phantom{T}};
    \node (g) at (1.1,6) {\phantom{G}};
    \node (h) at (1.1,3) {\phantom{B}};
    \node (i) at (1.1,0) {\phantom{T}};
    \node (j) at (2,6) {\phantom{G}};
    \node (k) at (2,0) {\phantom{T}};
    \draw [->] (e.north) -- (d.south) node[pos=0.5, above] {reporting};
    \draw [->] (g.south) -- (h.north) node[pos=0.5, above] {fines};
    \draw [->] (f.north) -- (e.south) node[pos=0.5, above] {information};
    \draw [->] (h.south) -- (i.north) node[pos=0.5, above] {monitoring};
    \draw [->] (j.south) -- (k.north) node[pos=0.5, above] {investigation};
  \end{tikzpicture}
\end{document}

此代码导致:

screenshot of output image

然后您可以根据自己的口味进行调整!

© www.soinside.com 2019 - 2024. All rights reserved.