Skip to main content
16 votes

Making a (simple) directory tree

Following @cfr's lead: a rewrite of one of Gonzalo Medina's trees but with an option to put files inside the tree as well. Just call the option is file for the file nodes. Also the folder pic now ...
Guilherme Zanotelli's user avatar
15 votes

How can we draw a Christmas tree with decorations, using TikZ?

Well, for 2020 (we really deserve something for 2020), with circuitikz: Plain bog simple LaTeX code (I would never try to compete with David Carlisle's one)... \documentclass[border=10pt]{standalone} ...
Rmano's user avatar
  • 42k
13 votes

Making a (simple) directory tree

Rewrite of one of Gonzalo Medina's trees above for Forest v2 which makes it much easier to draw this kind of tree. Updated versions of two of the other styles: https://tex.stackexchange.com/a/361248/ ...
cfr's user avatar
  • 205k
12 votes

Drawing a directory listing a la the tree command in TikZ

Here is my take on it: \documentclass{standalone} \usepackage{tikz} \usepackage{fontawesome} \begin{document} \newcommand{\FTdir}{} \def\FTdir(#1,#2,#3){% \FTfile(#1,{{\color{black!40!white}\...
François Févotte's user avatar
12 votes

Is there a better way of setting this tree?

Schemata is a package designed to draw, well, schemata basically. It defines a series of macros to facilitate the drawing and adjustment of this type of diagram. The easiest way to use it is to ...
cfr's user avatar
  • 205k
12 votes
Accepted

squiggly trees in latex

I would, naturally, use Forest because I happen to like it. It is very powerful and extremely flexible. I would load it with the linguistics library defaults \usepackage[linguistics]{forest} use a ...
cfr's user avatar
  • 205k
11 votes

How can we draw a Christmas tree with decorations, using TikZ?

Here is my own little Christmas tree for this collection. I have decorated it with baubles, tinsel, flashing fairy lights, and a star tree-topper, and placed presents beneath the tree. Code: \...
Ulysses's user avatar
  • 1,933
11 votes
Accepted

Drawing a k-ary tree using TikZ without overlap

Use forest. It automatically spaces nodes to make as compact a tree as possible, and has a much easier syntax. Depending on your needs, you could also generate the tree programmatically. \...
Alan Munn's user avatar
  • 220k
11 votes

Undefined control sequence. \usetikzlibrary for creating a tree

The implicit load of TikZ package in that example comes from the fact that standalone class has an option to load TikZ automatically if you use \documentclass[tikz]{standalone} but if you are using ...
percusse's user avatar
  • 158k
11 votes

How to draw a tree diagram with 90º degrees branches

Here's a version using forest. \documentclass{article} \usepackage[edges]{forest} \forestset{ declare count register=labelcount, enumerate/.style={labelcount=#1, for tree={content/.pgfmath=...
Alan Munn's user avatar
  • 220k
11 votes
Accepted

How do you use environments that have the same name within a single LaTeX document?

As explained in the prooftrees documentation, you can use the environment tableau instead of prooftree if you load the prooftrees package with the tableaux option. This allows you to use both ...
Alan Munn's user avatar
  • 220k
11 votes
Accepted

B-Tree in TikZ without root node

May I suggest using forest instead of the base TikZ tree methods. There are many advantages to using forest for trees over other methods: much more compact syntax (labelled bracketting) automatic ...
Alan Munn's user avatar
  • 220k
10 votes
Accepted

Probability tree is colliding

Basically, with this approach to drawing trees, you have to figure out suitable spacing for the tree. TikZ doesn't do it for you. In this case, the bag nodes need to be wider (or you need to break ...
cfr's user avatar
  • 205k
10 votes
Accepted

Table of content as right side growing tree

Definitely shouldn't have tried to answer this .... Proof of concept: \documentclass{article} \usepackage[edges]{forest} \forestset{% subsection/.style={% delay n={% >O{n} % }{% ...
cfr's user avatar
  • 205k
9 votes
Accepted

Specify where and how edge connects to child (tikz)

You can use options child anchor=west, edge from parent macro=\myedgefromparent, with \def\myedgefromparent#1#2{ [style=edge from parent,#1] (\tikzparentnode\tikzparentanchor) to #2 (\...
esdd's user avatar
  • 85.9k
9 votes

How can I reproduce this simple tree diagram?

Please always include the code you've got as it makes it much easier to help effectively. Not knowing how you tried to do things or what you have done makes it really hard to provide meaningful ...
cfr's user avatar
  • 205k
9 votes
Accepted

Which is the best package for drawing rooted trees and how do you use it?

*I think I ought not answer do-it-for-mes (or questions which are edited in ways which invalidate existing answers). But I'm procrastinating and like trees, so will do what I ought not. * However, I ...
cfr's user avatar
  • 205k
9 votes

How to make binary search trees in an easy and straight forward way?

This is a solution using tikz, as an example consider the following tree To create this code I used \documentclass[border = 5pt, tikz]{standalone} \begin{document} \begin{tikzpicture}[ every node/...
caverac's user avatar
  • 7,931
9 votes
Accepted

How can I draw a simple factor tree like this?

The context of use the showed image is not entirely clear, so see if the following image is what you after. The MWE, which produce it, is: \documentclass[border=3.141592]{standalone} \usepackage{tikz}...
Zarko's user avatar
  • 299k
8 votes

Square edges in forest package

With current Forest, it is a simple question of loading the edges library and adding forked edges to the tree's preamble. \documentclass[border=10pt]{standalone} \usepackage[edges]{forest} \begin{...
cfr's user avatar
  • 205k
8 votes
Accepted

Trees in context

Most of the code in qtree-tikz is TeX code, which one exception: pgfsubpic.sty uses \begin{...} .. \end{...}, which is easy to circumvent. Here is an example from the qtree-tikz manual: \usemodule[...
Aditya's user avatar
  • 62.6k
8 votes
Accepted

Resizing qtree to fit pagewidth

Although you can resize the diagram, this is not recommended as you will end up with a mish-mash of font sizes. Instead, I would recommend using a newer, more powerful package to draw the tree. ...
cfr's user avatar
  • 205k
8 votes
Accepted

Table right of horizontal forest

Fake it. Or spend your life trying to maintain the unmaintainable. Make each terminal node a single-row tabular. Draw the cell borders by referring to the Forest nodes. Add headers and so on ...
cfr's user avatar
  • 205k
8 votes
Accepted

How to make binary search trees in an easy and straight forward way?

i would simplify tree layout as follows: and in drawing use package forest: \documentclass[margin=3mm]{standalone} \usepackage[edges]{forest} \begin{document} \begin{forest} for tree={ grow=...
Zarko's user avatar
  • 299k
8 votes

How to draw a tree diagram with 90º degrees branches

\documentclass[border = 5pt]{standalone} \usepackage{tikz-qtree} \begin{document} \begin{tikzpicture}[grow' = up] \tikzset{ edge from parent/.style = {draw, edge from parent path={(\...
caverac's user avatar
  • 7,931
8 votes
Accepted

Write a simple tree in LaTeX

Here's a way to do it. \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows, positioning} \begin{document} \begin{tikzpicture}[every node/.style={shape=circle,fill=black,circle,inner ...
Vincent's user avatar
  • 20.3k
7 votes

Is there a better way of setting this tree?

I can offer no flexible solution, but two different ones. The first creates something similar to your original MWE, but with better spacing. I placed everything in minipages to stay uniform, you might ...
Douba's user avatar
  • 626
7 votes

Tree, then arrow, then tree

Instead of using minipage use the adjustbox package, which gives you much simpler control over the spacing. Also, you can save yourself a lot of typing by defining a global style for your trees: \...
Alan Munn's user avatar
  • 220k
7 votes

squiggly trees in latex

The first tree is barely a tree, and so you may want to draw it manually with a matrix of nodes. The second tree is fairly straightforward but needs some trickery to have the multidominance structure ...
Alan Munn's user avatar
  • 220k

Only top scored, non community-wiki answers of a minimum length are eligible