I am new to TikZ and I am looking to draw simple abstraction of word embeddings.

Here's a quick sketch from Keynote: enter image description here

Any help will be much appreciated. Thanks!

  • Have you attempted anything so far? If so please post what you have. – Null Nov 5 '15 at 4:43
  • How long is the sentence with some words? Will it go beyond one line? – user11232 Nov 5 '15 at 4:46
  • The sentence will be short, so one line. I haven't implemented it yet, but I think @john's answer below will work. Thanks! – ya_ Nov 6 '15 at 15:20

There are a number of ways one can go with this. One could insert \tikzmark into regular text and overlay the arrows. One could put each word into a separate \tikz[remember picture]{node(name){...};} and overlay the arrows from the south anchor.

This approach put everything into one tikzpicture with the entire sentence in one node. The arrow ends are specified relative to the node anchors using the calc library notation. The weird doohicky was specified as a pic to make it easy to reproduce. Unlike nodes, pics don't have anchors.


\fill[color=Aqua,rounded corners] (-15pt,-11pt) rectangle (15pt,-1pt);
\fill[color=yellow] (-10pt,-6pt) circle[radius=4pt]
                    (0pt,-6pt) circle[radius=4pt]
                    (10pt,-6pt) circle[radius=4pt];

\node (A) {Sentence with some words};
\draw[-latex] ($(A.south west)!.2!(A.south east)$) -- ++(-20pt,-20pt) pic{doohicky};
\draw[-latex] ($(A.south west)!.45!(A.south east)$) -- ++(-7.5pt,-20pt) pic{doohicky};
\draw[-latex] ($(A.south west)!.65!(A.south east)$) -- ++(7.5pt,-20pt) pic{doohicky};
\draw[-latex] ($(A.south west)!.9!(A.south east)$) -- ++(20pt,-20pt) pic{doohicky};

weird doohickies

Note, it is generally easier to debug a pic as a regular tikzpicture, then copy the code into the \tikzset.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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