6

I was wondering if there is any package for text annotation in Latex like Brat.

This is the kind of result I would like to obtain in a figure:

enter image description here

Is there a way to achieve that by using brat or some other libraries, without drawing it with inkscape and converting it to svg, or with tikz?

All solutions and hints accepted!

4

Just for fun, since I didn't know the tikz-dependency package percusse cited in his comment.

\documentclass{article}
\usepackage{tikz-dependency}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{dependency}[label style={draw=white}]
\begin{deptext}[column sep=1em,
row 2/.style={nodes={fill=cyan!16, draw=white}}]
PRP \& VBD \& NNP \& NNP \&[2.5em] POS \& NN \&[-.5em] .\\[1.6ex]
It \& was \& Jesse \& Bear \& 's \& birthday \& . \\
\end{deptext}
\depedge[edge unit distance=2.5ex]{6}{1}{nsubj}
\depedge[edge unit distance=2.3ex]{6}{2}{cop}
\depedge{6}{4}{poss}
\depedge{4}{3}{nn}
\depedge{4}{5}{possesive}
\wordgroup[group style={fill=cyan!40, draw=cyan, inner sep=0pt}]{1}{1}{1}{a}
\wordgroup[group style={fill=green!40, draw=green, inner sep=0pt}]{1}{2}{2}{b}
\wordgroup[group style={fill=blue!40, draw=blue, inner sep=0pt}]{1}{3}{3}{c}
\wordgroup[group style={fill=blue!40, draw=blue, inner sep=0pt}]{1}{4}{4}{d}
\wordgroup[group style={fill=violet!40, draw=violet, inner sep=0pt}]{1}{5}{5}{e}
\wordgroup[group style={fill=blue!40, draw=blue, inner sep=0pt}]{1}{6}{6}{f}
\wordgroup[group style={fill=red!40, draw=red, inner sep=0pt}]{1}{7}{7}{g}
\foreach \ind in {1,..., 7}{
\draw[blue,decorate,decoration={brace}] (\wordref{2}{\ind}.north west)-- (\wordref{2}{\ind}.north east);}
\end{dependency}
\end{document}

enter image description here

|improve this answer|||||

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.