Hot answers tagged

131

Merry Christmas everyone! \documentclass[11pt]{scrartcl} \usepackage[dvipsnames,svgnames]{xcolor} \usepackage{tikz} \usetikzlibrary{shapes,decorations.shapes} \newsavebox{\mycandle} \savebox{\mycandle}{ \begin{tikzpicture}[scale=.1] \shade[top color=yellow,bottom color=red] (0,0) .. controls (1,.2) and (1,.5) .. (0,2) .. controls (-1,.5) and (-1,.2) .....


118

Just in case the code isn't clear from behind the picture, here it is in full: \documentclass{article} \usepackage{listings} \usepackage{tikz} \usetikzlibrary{% lindenmayersystems, decorations.pathmorphing, decorations.markings, shapes.geometric, calc% } \tikzset{ tinsel/.style={ #1, rounded corners=10mm, ultra thin, decorate, ...


101

Another tree that can be decorated: Merry Christmas, everybody! \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \begin{document} % \begin{tikzpicture} \begin{axis}[ hide axis, clip=false, y domain=0:2*pi, samples=30,axis equal, view={45}{20}] \addplot3 [domain=0:4,surf,shader=flat,z buffer=sort,fill=green!50!brown, draw=green!50!...


93

Here's mine: \documentclass{article} \usepackage{tikz} \usetikzlibrary{scopes,svg.path,shapes.geometric,shadows} \begin{document} \begin{tikzpicture}[ mystar/.style={star, minimum size=2cm, star point ratio=2.5, shade, thick, line join=round, color=yellow!80!black, draw=red!20!black, top color=yellow!80!white, bottom color=yellow!60!black}, ...


73

Here's one option using the powerful forest package; since its built upon TikZ the customization possibilities are enormous. For example one can easily simulate the style produced by dirtree: \documentclass[border=5pt]{standalone} \usepackage{forest} \begin{document} \begin{forest} for tree={ font=\ttfamily, grow'=0, child anchor=west, ...


72

Having been having fun with straight-edge-and-compass constructions (thanks to What is the simplest way to draw this triangle exactly?), I thought I'd try my hand at a Christmas tree constructed using straight-edge and compass. (The animated version is about 5Mb. I'll have to stick it somewhere other than imgur and link to it.) \documentclass[ % handout, ...


62

A bit late, but here's a simple Christmas tree for 2016: \documentclass[border=5]{standalone} \usepackage{tikz} \newbox\stereogrambox \pgfmathdeclarerandomlist{colors}{{red}{green!50!black}{green}{white}{blue}} \begin{document} \setbox\stereogrambox=\hbox{% \begin{tikzpicture}[x=1/2pt,y=1/2pt] \foreach \x in {0,...,95} \foreach \y in {0,...,119}{ \...


62

Alan's answer works OK, but with the current version of Forest there is no need to define the edge path from scratch. Instead, we can use the edges library with the option forked edges. Moreover, we can eliminate growth parent anchor=east as it doesn't do anything (even in the old version of Forest), and we can use the parent and children anchors rather than ...


59

Previous solutions don't really use the fact that the tree can be completely generated procedurally (I think this is what the OP originally intended): And the picture will change every year! :) Tree for 2012: Tree for 2013: Tree for 2014: Tree for 2015: Tree for 2016: Tree for 2017: Tree for 2018: The solution added a new rule to the L-system, that ...


50

{\let~\catcode~`A0 AgdefAs.#1.{Acsname#1Aendcsname}AdefAq#1#2#3#4#5#6#7#8#9{%####################### AdefAy##1###1##3##4##5###3###2##8##9{AdefAw####1#####1####3####4####5#####3#####2####8####9{%####### AdefAz########1#########1########3########4########5#########3#########2########8########9{Aegroup%# As.d####9cum##5ntc#6##9ss.[11pt]{scr####4tc#6}%###########...


48

I am going to put in a plea on behalf of forest. Although forest is extremely flexible and powerful, it can also be used very simply. Like qtree, it uses a simple, concise syntax which 'reads like a tree' but I found forest's syntax a bit easier to learn. (However, this may be because I learnt qtree first.) Like tikz-qtree, it gives you all the power of TikZ ...


42

We are still within the 12 days of Christmas and the wise men have not yet arrived bearing gifts, so I trust that I do not arrive too late. I wondered... If we have trees, why not a forest? There is, of course, no reason whatsoever to draw a Christmas tree using forest.... Nadolig Llawen! Note that the current code has been updated to work with Forest ...


40

This is not very difficult to do with forest. The following example should get you started. \documentclass{article} \usepackage{forest} \begin{document} \begin{forest}for tree={ grow=east parent anchor=east, child anchor=west, math content, edge path={\noexpand\path[\forestoption{edge},->, >={latex}] (!u.parent anchor) --...


38

I have learned a couple of new things in TikZ and created an own minimalistic version loosely based on Altermundus' first creation (and a beautiful one it is). Hopefully he does not mind. Merry Christmas to all of you! \documentclass[border=2mm]{standalone} \usepackage[dvipsnames]{xcolor} \usepackage{tikz} \usetikzlibrary{shapes,decorations.shapes} \...


36

As already mentioned, the only real solution is to define a new shape, with correct border anchors. So, here it is: rectangle with rounded corners. The radius of the corner is controllable by /pgf/rectangle corner radius. \documentclass{article} \usepackage{tikz} \usetikzlibrary{intersections} \begin{document} \makeatletter \pgfkeys{/pgf/.cd, ...


34

Merry Christmast everyone! \documentclass{beamer} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usepackage{animate} \usepackage{hyperref} \hypersetup{pdfpagemode=FullScreen} \usepackage{ifthen} \newcounter{mycount} \setcounter{mycount}{0} \begin{document} \begin{frame}[fragile]{} \begin{center} \resizebox{5cm}{!}{% \begin{...


32

Refer to Section 18.4 Specifying Options for Trees and Children of the pgfmanual. Using sibling distance, you can solve the problem (use the values that best suit your needs): \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture}[every node/.style={circle,draw},level 1/.style={sibling distance=30mm},level 2/.style={sibling ...


30

I just came across this thanks to the duplicate at Vertical trees with TikZ. The following code seems to work, though I will admit to not testing it fully and making up the numbers so that it just works. Let's start with some output: Here's the code: \documentclass[border=10]{standalone} \usepackage{tikz} \makeatletter \newcount\dirtree@lvl \newcount\...


29

For simple, non "graphical" tree you can use the dirtree package: \documentclass{article} \usepackage{dirtree} \begin{document} \dirtree{% .1 debug. .2 filename. .2 modules. .3 module. .3 module. .3 module. .2 level. } \end{document}


26

The trees library provides a grow cyclic key/growth function. A few styles for the levels and a few child foreach path operators give you the following. Code \documentclass[tikz]{standalone} \usetikzlibrary{trees} \begin{document} \begin{tikzpicture}[ grow cyclic, level distance=1cm, level/.style={ level distance/.expanded=\ifnum#1>1 \...


24

Here's another option using forest to illustrate some other of its features: \documentclass{standalone} \usepackage{tabularx} \usepackage{forest} \usetikzlibrary{shapes.geometric} % comment out the following four lines if the Helvet Neue font are not available: \usepackage{fontspec} \newfontfamily\namefont[]{Helvetica Neue Condensed Bold} \...


23

This is not commonly the way trees are represented in the linguistic literature, so none of the regular tree drawing packages (qtree and tikz-qtree) do this by default. Specifically, the way trees are drawn in the linguistics literature, the terminal nodes are not drawn at the same level (i.e. with the words along a baseline and the tree growing up from ...


23

Get used to this error, it's a common one with tikz-qtree: tikz-qtree requires a space before a node's contents and its closing ]. So you need to insert some spaces before each ] in your tree. \Tree [.{Boolean Groups} [.{Abelian Groups} [.Groups ] % Here ] [.{Class 3} [.{Class 5} ] % Here etc. [.{Class 1} ] [.{...


22

This answer uses a completely different approach since the code was unfortunately lost from the original version of the question. It may be less helpful since it is not based on that code, but I will leave it here since it may be of use to somebody at some point. Here's a basic Forest style, tableaux, which might be used for this kind of diagram. The ...


20

Here are two concepts doing it with TikZ. The first one doesn't draw enough lines, the second one draws too many. I guess one needs counters for each level. Those counters would be increased if the same level occurs again and draw a line to it, while they would reset when a higher level is encounterd, e.g. like one could principally do with \usepackage{...


20

Just a tree with extremely ugly code(I do not know how to do it corectly?! -ovelay and center): \documentclass{article} \usepackage{overpic} \usepackage{graphicx} \begin{document} \begin{overpic}[unit=1cm, width=8cm, height=12cm]{ttt} \put(14.5,0){\includegraphics[width=4cm,height=12cm]{ttt}} \put(23,0){\includegraphics[width=1.5cm,height=12cm]{ttt}} \end{...


19

The newly released genealogytree package would help you! This post previously mentioned version 0.10 alpha I had to install the current version manually, because the current Latex distribution is frozen until the new upgrade. A current example of what can be done with the package: http://mirrors.ctan.org/macros/latex/contrib/genealogytree/genealogytree-...


17

You can do this sort of tree easily with the tikz-qtree package: In the code below, the labels are created using a tree with branches that are not actually drawn (using a style blank which sets [draw=none]). This ensures that they line up with the levels of the main tree. By putting two trees as nodes in a matrix we achieve a reasonable separation between ...


17

I would do this in TikZ. Section 18.1 of the version 2.10 manual shows how to make trees. The nodes on the trees are a little nonstandard, but perhaps section 16.3 on multi-part nodes would be helpful. Here's a quick mockup: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes} \begin{document} \begin{center} \begin{tikzpicture} \tikzstyle{...


17

The modifications suggested in this answer have now been subsumed into the tikz-qtree package (version 1.2 or higher). See the documentation for details on how to accomplish this with the latest version. (This happened in April 2012.) Looking through the code for tikz-qtree then it appears* that it completely reimplements the tree-planting routines. ...


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