Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

What is the best way to draw those two semantical relations with TikZ? I’ve seen it in a paper describing relations within wordnets.

synonym

hypernym

share|improve this question
2  
If you would like that, you can make an exact copy using tikz, then define a command to make it easier to use. Is it an one-off illustration or do you plan to make extensive use of such drawings? If you do not need exactly the same result, you can also try mindmapping library as in texample.net/tikz/examples/computer-science-mindmap –  ipavlic Apr 12 '11 at 13:39
    
I plan using it just once for a report, but I think eventually I’ll want to use it in an article. The result doesn't have to be exactly the same. However, the size of the circles and the dashes connecting them are meaningful. For instance, checkmate and xeque-mate have the same circle size and the same dash size because they share a direct synonym relation. –  rberaldo Apr 12 '11 at 13:55
add comment

2 Answers

up vote 4 down vote accepted

You might try with

\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}

But you have to be careful and use minimum width or text width key-values when needed to achieve the sizes you really need.

Result:

Sets

share|improve this answer
    
What if I wanted to put a caption above node b? Is that possible? –  rberaldo Apr 12 '11 at 14:59
    
All the nodes are contained inside a matrix, so you can just rearrange them however you see fit -- instead of a matrix a & b \\ a caption & b caption you could create a matrix [empty] & b caption \\ a & b \\ a caption & [empty] –  ipavlic Apr 12 '11 at 15:55
add comment

You can use the mindmap library; a little example:

\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}

EDIT: I've changed the code to include the second example.

enter image description here

share|improve this answer
    
I think I’ll go with that by now. How do I control font size with TikZ? Or should I use regular LaTeX commands, such as \small and \normalsize? Thank you! –  rberaldo Apr 12 '11 at 14:16
    
@Rafael Beraldo: of course, you can use the standard font switches; I've added a second example code showing how to change the annotations style. –  Gonzalo Medina Apr 12 '11 at 19:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.