使用 TikZ 绘制这两种语义关系的最佳方法是什么?我在一篇描述 wordnet 中的关系的论文中看到了它。
答案1
你可以尝试
\documentclass[10pt]{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\tikzstyle{normal}=[circle,text=white,fill=black]
\tikzstyle{superset}=[normal,inner sep=1em]
\centering
\begin{tikzpicture}
\matrix [column sep=3em,row sep=1em]
{
\node (a) [normal] {Subset}; & \node (b) [superset] {Superset}; \\
\node (a caption) {\parbox{6em}{\textbf{\{Caption\}}\\Lorem ipsum}}; & \node (b caption) {\parbox{6em}{\textbf{\{Caption\}}\\Lorem ipsum}};\\
};
\begin{pgfonlayer}{background}
\fill (a.center) -- (b.north east) -- (b.south east) -- (a.center);
\end{pgfonlayer}
\end{tikzpicture}
\begin{tikzpicture}
\matrix [column sep=3em,row sep=1em]
{
\node (c) [normal] {One set}; & \node (d) [normal] {One set}; \\
\node (c caption) {\parbox{6em}{\textbf{\{Caption\}}\\Lorem ipsum}}; & \node (d caption) {\parbox{6em}{\textbf{\{Caption\}}\\Lorem ipsum}};\\
};
\begin{pgfonlayer}{background}
\draw [line width=0.8em] (c.center) -- (d.center);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}
但是您必须小心并在需要时使用minimum width
或text width
键值来达到您真正需要的尺寸。
结果:
答案2
您可以使用该mindmap
库;一个小例子:
\documentclass{book}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,mindmap}
\newcommand\MyAnn[4]{%
\node [annotation,below] (#1) at (#2.south) {\textbf{ \{#3\}}\\#4};
}
\begin{document}
\tikzset{concept color=red!50,%
every annotation/.style={text width=4cm,text badly centered,font=\large}}
\begin{tikzpicture}[mindmap]
\node [concept] (vodka) {WN.Pr}
child[grow=left] {node[concept] (caipi) {WN.Br}};
\MyAnn{fn}{vodka}{vodka}{text text text text.};
\MyAnn{sn}{caipi}{caipirosca}{text text text text.};
\end{tikzpicture}
\begin{tikzpicture}
\begin{scope}[every node/.append style={minimum size=3.5cm,font=\large},mindmap]
\node [concept] (chek) {WN.Br}
child[grow=right] {node[concept] (xeque) {WN.Pr}};
\MyAnn{fn}{chek}{chekmate}{text text text text.};
\MyAnn{sn}{xeque}{xeque-mate}{text text text text.};
\end{scope}
\node [style=double arrow,draw,fill=black,scale=0.5] at ($(fn)+(2.4,0.25)$) {dblarrow};
\end{tikzpicture}
\end{document}
编辑:我已改变代码以包含第二个示例。