以下是我正在尝试做的事情的快速近似/破解:
但我希望顶部看起来更像这样
问题是我不知道矩形的顶部在哪里,也不知道如何将节点附加到顶部。也许还有其他方法可以做到这一点,或者有一种在 tikz 中制作字符串图的通用方法?我希望解决方案是相当模块化的,因为我将制作一个很多并将它们粘合在一起。矩形中的证明是使用总线证明(使用选项)制作的\EnableBpAbbreviations
。
图1:
\begin{tikzpicture}
\node (g1) at (0, 5) [label = above: $\Gamma_1$] {};
\node (g2) at (4, 5) [label = above: $\Gamma_2$] {};
\node (atb) at (2,5) [label = above: $A \otimes B$] {};
\node (t) at (2,4) [circle,draw,inner sep = 0pt] {$\otimes$};
\node (box) at (2,2) [rectangle,draw] {
\AXC{$D_i$}
\UIC{$f:\Gamma_1 , A , B , \Gamma_2 \vdash \Delta $}
\DisplayProof
};
\node (d) at (2,0) [label = below: $\Delta$] {};
\draw (g1) to [out = 270, in = 150] (box) ;
\draw (g2) to [out = 270, in = 30] (box) ;
\draw (atb) to (t) ;
\draw (t) to [out = 225, in = 120] (box);
\draw (t) to [out = 315, in = 60] (box);
\draw (box) to (d) ;
\end{tikzpicture}
图2:
\begin{tikzpicture}
\node (g1) at (0, 2) [label = above: $\Gamma_1$] {};
\node (g2) at (4, 2) [label = above: $\Gamma_2$] {};
\node (atb) at (2,2) [label = above: $A \otimes B$] {};
\node (t) at (2,1) [circle,draw,inner sep = 0pt] {$\otimes$};
\node (g1x) at (0,0) {};
\node (g2x) at (4,0) {};
\node (a) at (1,0) {};
\node (b) at (3,0) {};
\draw (g1) to (g1x) ;
\draw (g2) to (g2x) ;
\draw (atb) to (t) ;
\draw (t) to [out = 225, in = 90] (a);
\draw (t) to [out = 315, in = 90] (b);
\end{tikzpicture}
答案1
我将先从盒子开始,然后使用库绘制相对于它的其余部分positioning
。
\documentclass[border=3.14mm,tikz]{standalone}
\usetikzlibrary{positioning}
\usepackage{bussproofs}
\EnableBpAbbreviations
\begin{document}
\begin{tikzpicture}
% start with the box
\node (box) at (2,2) [rectangle,draw] {
\AXC{$D_i$}
\UIC{$f:\Gamma_1 , A , B , \Gamma_2 \vdash \Delta $}
\DisplayProof
};
% add the rest relative to the box
\node[above=1.5cm of box] (t) [circle,draw,inner sep = 0pt] {$\otimes$};
% as you are working with labels, you could replace the nodes by coordinates
\path (box.north west) -- (box.north east) coordinate[pos=0.25] (t1)
coordinate[pos=0.75] (t2) coordinate[pos=0.02] (t0) coordinate[pos=0.98] (t3);
\draw (t0) -- ++(0,3cm) coordinate[label = above: $\Gamma_1$] (g1){};
\draw (t3) -- ++(0,3cm) coordinate[label = above: $\Gamma_2$] (g2){};
\node[above=2.5cm of box] (atb) [label = above: $A \otimes B$] {};
\node[below=1.5cm of box] (d) [label=below:$\Delta$] {};
\draw (atb) to (t) ;
\draw (t) to [out = 225, in = 90,looseness=1.2] (t1);
\draw (t) to [out = 315, in = 90,looseness=1.2] (t2);
\draw (box) to (d) ;
\end{tikzpicture}
\end{document}
答案2
另一种方法是使用lualatex
其内置的元帖子图书馆,有unicode-math
。
\documentclass[border=5mm]{standalone}
\usepackage{luatex85}
\usepackage{luamplib}
\usepackage{unicode-math}
\usepackage{bussproofs}
\EnableBpAbbreviations
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
z0 = origin;
x0 = x12 = x4;
y12 = y31 = y32 = -y4 = 55;
-x31 = x32 = 42;
z1 = 5/8 [z0, z12];
picture P[];
P0 = thelabel("\AXC{$D_i$}\UIC{$f : Γ_1, A, B, Γ_2 ⊢ Δ$}\DisplayProof", z0);
P12 = thelabel("$A ⊗ B$", z12);
P31 = thelabel("$Γ_1$", z31);
P32 = thelabel("$Γ_2$", z32);
P4 = thelabel("$Δ$", z4);
interim bboxmargin := 4pt;
drawoptions(withcolor 1/4[1/2 blue, white]);
draw point 1/2 of bbox P32 {down} .. point 15/7 of bbox P0 {down};
draw point 1/2 of bbox P31 {down} .. point 20/7 of bbox P0 {down};
draw point 1/2 of bbox P12 .. z1 {down} .. point 16/7 of bbox P0 {down};
draw point 1/2 of bbox P12 .. z1 {down} .. point 19/7 of bbox P0 {down};
draw point 1/2 of bbox P0 .. point 5/2 of bbox P4;
draw bbox P0;
unfill fullcircle scaled 10 shifted z1;
draw fullcircle scaled 10 shifted z1;
drawoptions();
draw P0;
draw P12;
draw P31;
draw P32;
draw P4;
label("$⊗$", z1);
endfig;
\end{mplibcode}
\end{document}