2

I'm using tikz-qtree to lay out a taxonomy diagram for a literature overview. I would like to have a list of citations under each of the terminal nodes. However, I'm having some issues styling the citation nodes in the tree.

This is what I have so far:

\documentclass[twocolumn]{article} \usepackage{tikz} \usepackage{tikz-qtree} \tikzstyle{concept}=[rectangle, rounded corners, draw=black, fill=blue!20, text centered, text width=2cm] \tikzstyle{citations}=[draw=none, fill=none, text centered, text width=2cm, level distance=1pt] \begin{document} \begin{figure} %\begin{tikzpicture}[grow=down, every internal node/.style={concept, level distance=60pt}, every leaf node/.style={citations, level distance=1pt}] \begin{tikzpicture}[grow=down, level distance=60pt, every internal node/.style={concept}, every leaf node/.style={citations}] \tikzset{sibling distance=2.5pt} \Tree [.Segmentation [.Classical [.{Colour \& intensity} {\cite{a}} ] [.Clustering {\cite{b}} ] ] [.{Deep networks} [.CED ] [.FCN ] [.GAN ] ] ] \end{tikzpicture} \end{figure} \bibliographystyle{unsrt} \bibliography{Literature} \end{document} 

Literature.bib:

@article{a, author={Made up author}, title={One made up citation}, } @article{b, author={Made up author}, title={And another one} } 

Diagram

Specifically, I'd like to change the level spacing for the leaf nodes so the citations appear right below their corresponding categories. Ideally, I'd also like all internal nodes to be centre-aligned vertically (rather than top-aligned as they are currently), and I'd like there to be no edges to the leaf nodes. Note that the solution from this answer of simply using \\ doesn't work, since I'd like the citations to be outside the blue rectangles of the inner nodes. The tree may also be unbalanced so I can't simply change the distance at a specific tree level.

I've tried some different ways of changing the level distance property but with no luck so far. I'm not really tied to tikz-qtree either, so I'd accept a solution using a different package/library for tree layout in tikz as well.

0

1 Answer 1

3

You can add e.g. anchor=center to concept to centre those nodes vertically, but I'd recommend forest for more complex formatting. In particular, forest makes it easy to add the citations as labels. (This may be possible with tikz-qtree, too, but I saw no immediately obvious option in the documentation.)

For example, the following creates a concept style, which is applied to the whole tree, and a cite style, which takes the citation key as an argument and turns it into a label below the current node.

\begin{filecontents}[overwrite]{\jobname.bib} @article{a, author={Made up author}, title={One made up citation}, } @article{b, author={Made up author}, title={And another one} } \end{filecontents} \documentclass[twocolumn]{article} \usepackage[linguistics]{forest} \usepackage{array} \newcolumntype{C}[1]{>{\centering}p{#1}} \forestset{% cite/.style={label=below:{\cite{#1}}}, concept/.style={% anchor=center, rounded corners, draw=black, fill=blue!20, l sep'=60pt, s sep'=2.5pt, align={C{2cm}}, }, } \begin{document} \begin{figure} \begin{forest} for tree={concept}, [Segmentation [Classical [Colour \& intensity, cite={a}] [Clustering, cite={b}] ] [Deep networks [CED] [FCN] [GAN] ] ] \end{forest} \end{figure} \bibliographystyle{unsrt} \bibliography{\jobname} \end{document} 

citations added as labels

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.