# Tag Info

## Hot answers tagged nodes

9

There are probably various approaches to this. This example shows one that I frequently use. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \tikzstyle{bordered} = [draw,thick,inner sep=5,minimum size=10,minimum width=100,font=\sffamily] \tikzstyle{arrow} = ...

7

Since the text inside the roofed node is a node itself internally and you can't embed nodes within nodes, you need to attack this problem in a slightly different way. The basic idea is to make the parent node of the roofed node the named node instead. Then if you want to show, e.g. an arrow from each of the nodes you have to offset the starting point of the ...

6

Somewhat simpler variant using the perpendicular syntax (|- or -|): \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \tikzstyle{bordered} = [draw,thick,inner sep=5,minimum size=10,minimum width=100,font=\sffamily] \tikzstyle{arrow} = [thick,-latex,font=\sffamily] ...

5

This is simply because your are using rounded corners rectangles. So, you should compensate for the trim effect (if you want the arrows to touch the rectangles) by issuing the option shorten >= -2pt, shorten <= -2pt. You can manually control the shorten distance. Note that you need only to compensate the two edges to node e3. Here is the modified ...

5

Just in case it had escaped anybody's notice, I tend to prefer forest when drawing trees. This solution does not require manually repeating the word 'here' or manually adjusting the positioning of the start of the arrow. It is based on an example from page 20 of the manual, though I may have mangled it a little. triangle is used for the roof a style, ...

4

Using labels and above key: \documentclass{article} \usepackage{tikz} \usetikzlibrary{shapes,backgrounds} \begin{document} \begin{tikzpicture} \node[rounded corners, draw, fill=gray!20 ,text height = 5.5cm,minimum width=9cm] (main){All Feasible Schedules}; \node[ellipse, draw, fill=red!20, text height =3cm, minimum width = ...

4

You are complicating life. tikz has facilities to define styles via \tikzset. So define a style and use it. No need for a macro. \documentclass{article} \usepackage{tikz} \tikzset{vertex/.style={ circle, inner sep = 2pt, draw=black, fill=black } } \begin{document} \begin{tikzpicture} \foreach \cnt in {1,...,5}{ \node[vertex] (\cnt) ...

4

I need the upper node as wide as the lower one and without the double drawn line in the middle of them. Hence, the simplest way is not to create separate shapes, but rather use the old and very useful rectangle split which automatically helps avoiding the double line and preserves the width for both parts. A possible solution: ...

3

You can (mis)use the title. Change the position of the title and use it. \documentclass{Article} \usepackage{pgfplots} \pgfplotsset{compat=1.12} \begin{document} \begin{tikzpicture}[baseline=(current bounding box.north)] \begin{axis}[ width=0.45\textwidth,clip=false, title style={at={(0.5,-0.2)},text ...

2

A PSTricks solution: \documentclass{article} \usepackage{pstricks-add} \usepackage{expl3} \ExplSyntaxOn \cs_new_eq:NN \calc \fp_eval:n \ExplSyntaxOff % parameters \def\boxWidth{3.4} \def\boxHeight{0.7} \def\separation{1} \def\arrow{0.4} % helping functions \def\constA#1#2{\calc{#1*\boxHeight+#2*\separation}} \def\constB#1{\calc{1+#1*\arrow}} ...

2

The macro \vertex is defined with two arguments. But inside the \foreach loop, it is given only one argument. Instead, it should be called as \vertex{\cnt}{(\cnt, 0)}: \documentclass{article} \usepackage{tikz} \begin{document} \newcommand*{\vertex}[2]{% \node[ circle, inner sep = 2pt, draw=black, fill=black ] (#1) at #2 {}% } ...

2

Set row sep=\-pgflinewidth in matrix options. It will work if all nodes have same line width. Both nodes can have same width with every node={minimum width=4cm, draw} in matrix declaration. \documentclass[a4paper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{tikz} \makeatletter \pgfdeclareshape{recttop}{ \inheritsavedanchors[from=rectangle] % ...

1

Since the labels account to the width of the picture, the centered text may always seem a bit off-centered. \documentclass{article} \usepackage{pgfplots} \usepackage{showframe} \pgfplotsset{compat=1.12} \begin{document} \begin{figure} \begin{minipage}{.35\linewidth} \begin{tikzpicture}[baseline=(current bounding box.north)] \begin{axis}[ ...

1

If you assign a name to the axis, you can access the border by its anchors (north east, south west, etc.) You can also obtain the exact dimensions of the box, which is NOT 0.45\textwidth. \documentclass{standalone} \usepackage{pgfplots} \newlength{\tempwidth} \begin{document} \fbox{% no figures in standalone class \begin{tikzpicture} ...

1

You have to use right = of (which is the syntax for positioning library) instead of right of =. \documentclass[tikz,border=10pt]{standalone} \usetikzlibrary{shapes,arrows,positioning} \begin{document} \tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em] \tikzstyle{line} = [->, dashed] \begin{tikzpicture}[auto, node ...

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