The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

1

Schrödinger's cat was right. I should be using coordinates instead of nodes for the internal nodes of the tree. This is my preferred solution over AboAmmar's ++ syntax since I want to save the coordinate of the internal node for use later on.


1

\documentclass{article} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{tikz-cd} \begin{document} \[ \begin{tikzcd}[column sep=0em] & \text{Intermediate fields}\\[-4ex] & \mathbb{Q}(\sqrt{3},\sqrt{5})\ar[d, dash]\ar[dr, dash]\ar[dl, dash]\\ \mathbb{Q}(\sqrt{3}) & \mathbb{Q}(\sqrt{5}) & \mathbb{Q}(\sqrt{15})\\ & \mathbb{Q}\ar[u, ...


0

Following the advice given by the very good users in the comments here there is my short proposal. \documentclass[a4paper,12pt]{article} \usepackage{tikz-cd} \usepackage[bb = boondox]{mathalfa} \usepackage[margin=1cm]{geometry} \usepackage{mathtools} \begin{document} \begin{tikzcd} & \overset{\text{Intermediate fields}}{\mathbb{Q}(\sqrt 3, \sqrt 5)} \...


4

I'd go with a style, as suggested in the other answer. The problem seems to lie in expandability, as the following working code shows. \documentclass[12pt,a4paper]{article} \usepackage{forest,xparse} \NewExpandableDocumentCommand{\probaweight}{sm}{% \IfBooleanTF{#1}% {}% {node[midway, fill=white]{#2}}% } \begin{document} \begin{forest} [ [...


8

I cannot answer the question about the usage starred macros in forest keys, but it is generally not recommended to use macros that expand to pgf keys. Rather, this is what styles are for. And with styles there is no problem, and the code becomes even shorter. \documentclass[12pt,a4paper]{article} \usepackage{forest} \forestset{el/.style={edge label={node[...


1

Based on answer (which was significantly improved by edit of @marmoth, thank you again!): \documentclass[12pt, margin=3mm]{standalone} \usepackage{forest} \begin{document} \forestset{ declare toks={elo}{font=\footnotesize, inner sep=2pt, midway, sloped}, % Edge Label Options anchors/.style={anchor=#1,child anchor=#1,parent anchor=#1}, dot/....


2

Like Alan Munn and cfr I also do not understand the problem. You could make the code you have a bit more versatile by using the auto enumeration that can be found in the forest manual on p. 52, and then all you need to do is to add some basic pgf functions. You may want to adjust the items "cat","mole","duck","marmot",... to your needs. \documentclass[12pt,...


2

You can do it in a single line like this: \documentclass[tikz, border=2pt]{standalone} \begin{document} \begin{tikzpicture}[inner sep=2pt] \draw (0,0) node [below left]{$C$} -- ++(.5,.5) -- ++(.5,-.5) node[below right]{$H$}; \end{tikzpicture} \end{document} Addendum: It is easy to also keep coordinates' names for later reference using: \draw (0,0)...


1

As suggested, forest can do a better job more easily. I don't know just what the trees should look like, so this may need adjustment. For example, you might want a straight line in the last tree or to use fit=band globally. \documentclass[border=9pt]{standalone} \usepackage[]{forest} \usetikzlibrary{shapes} \tikzset{ pl1/.style = {draw, inner sep = 0, ...


5

\documentclass[border=9pt]{standalone} \usepackage[linguistics]{forest} \forestset{ declare toks={multi name}{}, multi dom/.style={ if={>On={level}{0}}{}{% delay/.process={OOw2}{name}{multi name}{ insert before={[##2,tier=##1]}, insert after={[##2,tier=##1]}, !u.s sep'=0pt, }, before typesetting nodes={ ...


3

I'm not sure if this is what you want, but you can use 'invisible' nodes at level 2 so it doesn't look as if there are nodes there. You just need to make them coordinates. If the angles matter, you'll need to adjust those in the usual ways, but I guess this gives the general idea. \documentclass[tikz,border=9pt]{standalone} \usetikzlibrary{trees} \begin{...


2

\documentclass[tikz]{standalone} \usepackage[edges]{forest} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc} \forestset{ declare boolean={my folder}{0}, folder/.append style={ for descendants=my folder}, folders down/.style={ for tree={grow'=0, folder}, tier=level me, }, } \begin{document} \begin{forest} forked edges, /tikz/>/.tip={...


2

You could move the D node a bit to the left to make room, with e.g. node [circle,draw,xshift=-5mm] {D} and perhaps also reduce the distance between H and I the same way you did earlier, with node [circle,draw]{F} [sibling distance=7mm] child {node[circle,draw]{H}} child {node[circle,draw]{I}} If you don't need to emphasize the missing children, then no ...


2

Like this: \documentclass[10pt]{article} \usepackage{tikz} \pagestyle{empty} \begin{document} \begin{center} \begin{tikzpicture} \node [circle,draw]{F} [level distance=10mm,sibling distance=25mm] child { node [circle,draw]{D} [level distance=10mm ,sibling distance=15mm] child {node [circle,draw] {B} child {node [circle,draw] ...


1

Just for fun. Since this tree can be found almost literally in the forest manual, I thought it might be worthwhile to add it here. \documentclass{article} \usepackage[edges]{forest} \begin{document} \tikzset{selected/.style={draw=red,fill=red!30}, optional/.style={dashed,fill=gray!50}} \begin{forest} for tree={draw,grow'=0,folder} [texmf [doc] [...


3

Adaptations: added tikz option: growth parent anchor=south west (default was south) changed tikz option: edge from parent path to starting point ([xshift=2mm] \tikzparentnode.south west) changed the grow points to avoid overlapping Use tikzset instead of tikzstyle (see Should \tikzset or \tikzstyle be used to define TikZ styles?). Code: \documentclass{...


1

As explained in the tikz-qtree manual, you can use \node commands in the tree. This allows you to use fit to draw a frame around nodes that you gave names. \documentclass[12pt]{article} \usepackage[margin=2cm,left=2cm,includefoot]{geometry} \usepackage{tikz-qtree} \usetikzlibrary{fit} \begin{document} \begin{tikzpicture}[scale = 0.7] \Tree [.IP [.\node(DP)...


2

Here is a possible way. You need to be careful with the braces. I removed them around #2 and #4 in order to not confuse the parser. Other than that I first expand the nested \phrase in a macro \temp, which gets used in the way you do in the case of the unnested \phrase. \documentclass{article} \usepackage{tikz} \usepackage{tikz-qtree} \usepackage{amssymb} \...


Top 50 recent answers are included