Tag Info

New answers tagged

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


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


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


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

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

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


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


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


8

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


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


3

You can do exactly what you're trying, you just have to specify a node text: \node (someName) at (A -| B) {SomeName}; or use a coordinate: \coordinate (someName) at (A -| B); An additional option is to use the let path operation from the calc library, described on page 161 of the 3.0.0 manual: \documentclass[tikz]{standalone} \usetikzlibrary{calc} ...


5

For A: Put the node right after to[out=90,in=90] like \draw [<->] (data) to[out=90,in=90]node [pos=.5, above, sloped] (TextNode) {TCP} (app) ; For B, do this: \draw[<->,postaction={decorate,decoration={text along path,raise=1ex,text align=center,text={TCP}}}] (data) to[out=90,in=90] (app); Full code: \documentclass{article} ...


4

Do you want something like this? \documentclass[tikz, border=5pt]{standalone} \begin{document} \tikzset{ charge node/.style={inner sep=0pt}, pics/sum block/.style n args={4}{ code={ \path node (n) [draw, circle, inner sep=0pt, minimum size=9mm] {} (n.north) +(0,-1.5mm) node [charge node] {$#1$} (n.south) ...



Top 50 recent answers are included