Tag Info

Hot answers tagged

107

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


96

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


85

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


76

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


51

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


37

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


36

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


34

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


30

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


27

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


27

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


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


23

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


18

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

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


17

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


16

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


15

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

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


13

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


12

I find that adding labels to the nodes makes this work. Note the (D) and (F) in the syntax for the corresponding nodes. \documentclass[10pt]{book} \usepackage{tikz} \usetikzlibrary{backgrounds} \usetikzlibrary{trees,positioning,arrows} \begin{document} \begin{tikzpicture}[scale=0.8,font=\small, edge from parent fork down, every node/.style={fill=blue!10}, ...


12

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


12

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


12

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


12

This is more "proof of concept" than a fully working example; the point of it is as follows. Firstly, to show how to build up a tree recursively using a \foreach loop. Secondly, it uses the tree stuff already in TikZ. Thirdly, someone just mentioned the Htree to me and in figuring out how to draw that, I had an answer-in-search-of-a-question and it ...


12

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


12

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


12

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


12

Summary Fixed the node names. For easier reference, I named the node from top to bottom, left to right with a,b,.... As suggested by Qrrbrbirlbel, I used the rectangle split node shape available in the library shapes.multipart instead of the tabular environment. Instead of defining a new to path I used the brace decoration from the ...


12

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



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