Tag Info

Hot answers tagged

117

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) ...


107

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, ...


90

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, ...


83

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}, ...


65

While I'd normally second Will Robertson's comment, since TikZ is fantastic and worth learning, I think TikZ's overkill for this situation. I personally find its tree specification syntax bulkier than necessary. My preferred tool for the job is the qtree package (which is on CTAN, too, and is apparently included in both TeX Live and MikTeX). The package ...


49

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[ % ...


47

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: The solution added a new rule to the L-system, that collected some "good" points where decorations might be ...


40

{\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%# ...


36

Here's an invisible tree. \documentclass[border=0.125cm]{standalone} \usepackage{tikz} \pagecolor{black} \usetikzlibrary{shapes.geometric,decorations} \pgfmathdeclarerandomlist{colors}{{red}{yellow}{pink}{green}{orange}{purple}{blue}{white}} \newcommand\drawstar[1][]{% \pgfmathsetmacro\s{rnd*2+2} \pgfmathsetmacro\t{rnd*.5cm+0.5cm} ...


31

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} ...


30

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, ...


29

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}{!}{% ...


24

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 ...


22

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 ...


21

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 ...


21

The dirtree package is your friend.


19

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 ...


18

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 ...


17

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! \PassOptionsToPackage{rgb,x11names,svgnames}{xcolor} ...


16

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 ...


15

tikz-qtree is an awesome package for more convenient tree drawing in tikz.


15

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. ...


15

Using forest: \documentclass{article} \usepackage{forest} \newcommand\mytable[5]{% #1\\ \begin{tabular}[t]{*{3}{|c}|} \hline & T1 & T2 \\ \hline T1 & #2 & #3 \\ \hline T2 & #4 & #5 \\ \hline \end{tabular}% } \begin{document} \begin{forest} for tree={parent anchor=south, child anchor=north,l=2cm,edge={->}}, for descendants={text ...


15

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} ...


14

I'm happy to report that the answer is yes, at least to some extent. I have created a style for forest which achieves code compatibility: the documents containing qtree trees can be used as they are, changing only \usepackage{qtree} to \usepackage{forest-qtree}. (Note an exception to this statement: any commas in the node labels must be enclosed in braces; ...


14

You could specify options for each level, for instance silbling distance but also level distance. Example: \documentclass{article} \usepackage{tikz} \usetikzlibrary{trees} \begin{document} \begin{tikzpicture}[level distance=1.5cm, level 1/.style={sibling distance=3cm}, level 2/.style={sibling distance=1.5cm}] \node {root} child {node {left} ...


14

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} ] ...


13

Great question! TikZ is not set up to do this kind of tree. It assumes that the position of each child node is a function of the number of the child node and the total number of child nodes. To define the tree you have with a single child node for each leaf won't work because the rayfinned fish leaf needs to get further from the root when you add the ...


13

There isn't a way that I know of to specify the level distance for particular levels using tikz-qtree. Of course you could use the regular tikz methods, but tikz-qtree is generally much more efficient in its input. The simplest solution to your problem is to simply move the labels slightly. You can do this by positioning them [above left] and [above ...


13

Here's an alternative if you're prepared to tell TikZ the order of the labels across the top. It's a bit klunky, especially in that it draws several lines twice (or more!). Also, I've taken you at your word and ignored the fancy styles. \documentclass{minimal} \usepackage{tikz} \begin{document} \begin{tikzpicture}[rotate=45] \begin{scope}[rotate=45] ...



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