Petrinet: How do I bring the figure to the center of the pageCenter figure which spans over whole pageCenter...

Can an earth elemental drown/bury its opponent underground using earth glide?

Why would the IRS ask for birth certificates or even audit a small tax return?

The need of reserving one's ability in job interviews

Is there any relevance to Thor getting his hair cut other than comedic value?

Why did the Cray-1 have 8 parity bits per word?

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

How can I be pwned if I'm not registered on the compromised site?

An Undercover Army

Is every open circuit a capacitor?

Relationship between the symmetry number of a molecule as used in rotational spectroscopy and point group

GDAL GetGeoTransform Documentation -- Is there an oversight, or what am I misunderstanding?

is 'sed' thread safe

What is a term for a function that when called repeatedly, has the same effect as calling once?

Can the Shape Water Cantrip be used to manipulate blood?

Can a Trickery Domain cleric cast a spell through the Invoke Duplicity clone while inside a Forcecage?

How do you say “my friend is throwing a party, do you wanna come?” in german

How does signal strength relate to bandwidth?

Reason why dimensional travelling would be restricted

Wardrobe above a wall with fuse boxes

Specific Chinese carabiner QA?

Is there a way to find out the age of climbing ropes?

Correct physics behind the colors on CD (compact disc)?

Are there other characters in the Star Wars universe who had damaged bodies and needed to wear an outfit like Darth Vader?

Is divide-by-zero a security vulnerability?



Petrinet: How do I bring the figure to the center of the page


Center figure which spans over whole pageCenter figure that is wider than textwidthHow to center align the whole table?Figure is put in the center of the pageLaTeX figure position center of page AFTER textHow to center a piecewise function. (On the page.)How do I move the table to the vertically center, and align figure and table together?Center table in the pageHow to center a line under a figuresvmono: how center figure vertically?













0















In an article environment, how do I bring the tikzpicture to the center of the page. begin{center} and end{center} do not work.



enter image description here



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}

begin{document}
begin{center}
begin{tikzpicture}
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}
end{center}
end{document}









share|improve this question

























  • First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

    – JouleV
    yesterday











  • @JouleV - can you elaborate on reset the margin

    – subham soni
    yesterday











  • The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

    – AndréC
    yesterday


















0















In an article environment, how do I bring the tikzpicture to the center of the page. begin{center} and end{center} do not work.



enter image description here



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}

begin{document}
begin{center}
begin{tikzpicture}
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}
end{center}
end{document}









share|improve this question

























  • First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

    – JouleV
    yesterday











  • @JouleV - can you elaborate on reset the margin

    – subham soni
    yesterday











  • The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

    – AndréC
    yesterday
















0












0








0








In an article environment, how do I bring the tikzpicture to the center of the page. begin{center} and end{center} do not work.



enter image description here



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}

begin{document}
begin{center}
begin{tikzpicture}
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}
end{center}
end{document}









share|improve this question
















In an article environment, how do I bring the tikzpicture to the center of the page. begin{center} and end{center} do not work.



enter image description here



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}

begin{document}
begin{center}
begin{tikzpicture}
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}
end{center}
end{document}






floats horizontal-alignment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









JouleV

4,91111139




4,91111139










asked yesterday









subham sonisubham soni

4,07682981




4,07682981













  • First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

    – JouleV
    yesterday











  • @JouleV - can you elaborate on reset the margin

    – subham soni
    yesterday











  • The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

    – AndréC
    yesterday





















  • First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

    – JouleV
    yesterday











  • @JouleV - can you elaborate on reset the margin

    – subham soni
    yesterday











  • The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

    – AndréC
    yesterday



















First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

– JouleV
yesterday





First you have to reset the margin so that the figure can fit the page. Secondly, use figure environment with centering.

– JouleV
yesterday













@JouleV - can you elaborate on reset the margin

– subham soni
yesterday





@JouleV - can you elaborate on reset the margin

– subham soni
yesterday













The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

– AndréC
yesterday







The geometry package allows you to modify the margins. usepackage [margin=1cm] {geometry}

– AndréC
yesterday












2 Answers
2






active

oldest

votes


















3














Your graphics are too large to be centered. To see this, simply load the showframe package that highlights the page and its margins.



It is therefore necessary to reduce the graph!
I know two different ways to reduce it:




  • with Tikz scale=.5, transform shape

  • with the macro scalebox


documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}
usepackage{showframe}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}

begin{document}
begin{center}
scalebox{.5}{
begin{tikzpicture}%[scale=.6,transform shape]
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}
}
end{center}
end{document}


screenshot






share|improve this answer
























  • I understand the key scale. What is the purpose of transform shape in Tikz

    – subham soni
    yesterday






  • 2





    By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

    – AndréC
    yesterday



















2














You might just use an adjustbox.



documentclass{article}
usepackage{tikz}
usetikzlibrary{positioning}
usetikzlibrary{arrows}
usetikzlibrary{backgrounds}
usetikzlibrary{fit}
usetikzlibrary{decorations.pathmorphing}
usetikzlibrary{calc}

tikzset{squarenode/.style = {
shape = rectangle,
fill = gray!50,
draw = black,
thick,
minimum height = 1cm,
minimum width = 1cm
}}

tikzset{circlenode/.style = {
shape = circle,
fill = blue!20,
draw = blue,
thick,
minimum size = 1cm
}}

tikzset{redcirclenode/.style = {
shape = circle,
fill = red!20,
draw = red,
thick,
minimum size = 1cm
}}

tikzset{help lines/.style=very thin}
tikzset{My Grid/.style={help lines,color=blue!50}}
usepackage{adjustbox}
begin{document}
begin{center}
adjustbox{width=textwidth}{begin{tikzpicture}
[>=stealth']
%draw[My Grid] (-5,-5) grid (15,15);
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below=1cm of s2] (s3) [circlenode] {}; %s3
node[above=1ex of s3,red] {$s leq 3$};
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to [out=-90,in=180] (s3);
draw[->] (s3) to [out=0,in=-90] (r2);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to [out=90,in=180] (s3);
draw[->] (s3) to [out=0,in=90] (r4);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
end{scope}

begin{scope}[xshift=10cm]
node (r1) at (-4,4) [squarenode] {};
node[right=4cm of r1] (r2) [squarenode] {};
node[below=3cm of r1] (r3) [squarenode] {};
node[right=4cm of r3] (r4) [squarenode] {};
node[right=1.5cm of r1] (s2) [circlenode] {};
node[above=1cm of s2] (s1) [circlenode] {}; %s1
node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
node[right=1.5cm of r3] (s4) [circlenode] {};
node[below=1cm of s4] (s5) [circlenode] {}; %s5
node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
node[left=1ex of s3,red] {$s$};
node[right=1ex of s6,red] {$bar{s}$};
draw[fill=black] (s1.center) circle [radius=0.1cm];
draw[fill=black] (s5.center) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
draw[->] (r1) -- (s2);
draw[->] (s2) -- (r2);
draw[->] (r3) -- (s4);
draw[->] (s4) -- (r4);
draw[->] (s1) to [out=180,in=90] (r1);
draw[->] (r1) to (s3);
draw[->] (s6) to (r1);
draw[->] (s3) to (r2);
draw[->] (r2) to (s6);
draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
draw[->] (r3) to (s3);
draw[->] (s6) to (r3);
draw[->] (s3) to (r4);
draw[->] (r4) to (s6);
draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
draw[->] (s5) to [bend left=45] (r3);
begin{scope}[on background layer]
node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
end{scope}
end{scope}

draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

end{tikzpicture}}
end{center}
end{document}





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477960%2fpetrinet-how-do-i-bring-the-figure-to-the-center-of-the-page%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    3














    Your graphics are too large to be centered. To see this, simply load the showframe package that highlights the page and its margins.



    It is therefore necessary to reduce the graph!
    I know two different ways to reduce it:




    • with Tikz scale=.5, transform shape

    • with the macro scalebox


    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning}
    usetikzlibrary{arrows}
    usetikzlibrary{backgrounds}
    usetikzlibrary{fit}
    usetikzlibrary{decorations.pathmorphing}
    usetikzlibrary{calc}
    usepackage{showframe}

    tikzset{squarenode/.style = {
    shape = rectangle,
    fill = gray!50,
    draw = black,
    thick,
    minimum height = 1cm,
    minimum width = 1cm
    }}

    tikzset{circlenode/.style = {
    shape = circle,
    fill = blue!20,
    draw = blue,
    thick,
    minimum size = 1cm
    }}

    tikzset{redcirclenode/.style = {
    shape = circle,
    fill = red!20,
    draw = red,
    thick,
    minimum size = 1cm
    }}

    tikzset{help lines/.style=very thin}
    tikzset{My Grid/.style={help lines,color=blue!50}}

    begin{document}
    begin{center}
    scalebox{.5}{
    begin{tikzpicture}%[scale=.6,transform shape]
    [>=stealth']
    %draw[My Grid] (-5,-5) grid (15,15);
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below=1cm of s2] (s3) [circlenode] {}; %s3
    node[above=1ex of s3,red] {$s leq 3$};
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to [out=-90,in=180] (s3);
    draw[->] (s3) to [out=0,in=-90] (r2);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to [out=90,in=180] (s3);
    draw[->] (s3) to [out=0,in=90] (r4);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
    end{scope}

    begin{scope}[xshift=10cm]
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
    node[left=1ex of s3,red] {$s$};
    node[right=1ex of s6,red] {$bar{s}$};
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to (s3);
    draw[->] (s6) to (r1);
    draw[->] (s3) to (r2);
    draw[->] (r2) to (s6);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to (s3);
    draw[->] (s6) to (r3);
    draw[->] (s3) to (r4);
    draw[->] (r4) to (s6);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
    end{scope}
    end{scope}

    draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

    end{tikzpicture}
    }
    end{center}
    end{document}


    screenshot






    share|improve this answer
























    • I understand the key scale. What is the purpose of transform shape in Tikz

      – subham soni
      yesterday






    • 2





      By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

      – AndréC
      yesterday
















    3














    Your graphics are too large to be centered. To see this, simply load the showframe package that highlights the page and its margins.



    It is therefore necessary to reduce the graph!
    I know two different ways to reduce it:




    • with Tikz scale=.5, transform shape

    • with the macro scalebox


    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning}
    usetikzlibrary{arrows}
    usetikzlibrary{backgrounds}
    usetikzlibrary{fit}
    usetikzlibrary{decorations.pathmorphing}
    usetikzlibrary{calc}
    usepackage{showframe}

    tikzset{squarenode/.style = {
    shape = rectangle,
    fill = gray!50,
    draw = black,
    thick,
    minimum height = 1cm,
    minimum width = 1cm
    }}

    tikzset{circlenode/.style = {
    shape = circle,
    fill = blue!20,
    draw = blue,
    thick,
    minimum size = 1cm
    }}

    tikzset{redcirclenode/.style = {
    shape = circle,
    fill = red!20,
    draw = red,
    thick,
    minimum size = 1cm
    }}

    tikzset{help lines/.style=very thin}
    tikzset{My Grid/.style={help lines,color=blue!50}}

    begin{document}
    begin{center}
    scalebox{.5}{
    begin{tikzpicture}%[scale=.6,transform shape]
    [>=stealth']
    %draw[My Grid] (-5,-5) grid (15,15);
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below=1cm of s2] (s3) [circlenode] {}; %s3
    node[above=1ex of s3,red] {$s leq 3$};
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to [out=-90,in=180] (s3);
    draw[->] (s3) to [out=0,in=-90] (r2);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to [out=90,in=180] (s3);
    draw[->] (s3) to [out=0,in=90] (r4);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
    end{scope}

    begin{scope}[xshift=10cm]
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
    node[left=1ex of s3,red] {$s$};
    node[right=1ex of s6,red] {$bar{s}$};
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to (s3);
    draw[->] (s6) to (r1);
    draw[->] (s3) to (r2);
    draw[->] (r2) to (s6);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to (s3);
    draw[->] (s6) to (r3);
    draw[->] (s3) to (r4);
    draw[->] (r4) to (s6);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
    end{scope}
    end{scope}

    draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

    end{tikzpicture}
    }
    end{center}
    end{document}


    screenshot






    share|improve this answer
























    • I understand the key scale. What is the purpose of transform shape in Tikz

      – subham soni
      yesterday






    • 2





      By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

      – AndréC
      yesterday














    3












    3








    3







    Your graphics are too large to be centered. To see this, simply load the showframe package that highlights the page and its margins.



    It is therefore necessary to reduce the graph!
    I know two different ways to reduce it:




    • with Tikz scale=.5, transform shape

    • with the macro scalebox


    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning}
    usetikzlibrary{arrows}
    usetikzlibrary{backgrounds}
    usetikzlibrary{fit}
    usetikzlibrary{decorations.pathmorphing}
    usetikzlibrary{calc}
    usepackage{showframe}

    tikzset{squarenode/.style = {
    shape = rectangle,
    fill = gray!50,
    draw = black,
    thick,
    minimum height = 1cm,
    minimum width = 1cm
    }}

    tikzset{circlenode/.style = {
    shape = circle,
    fill = blue!20,
    draw = blue,
    thick,
    minimum size = 1cm
    }}

    tikzset{redcirclenode/.style = {
    shape = circle,
    fill = red!20,
    draw = red,
    thick,
    minimum size = 1cm
    }}

    tikzset{help lines/.style=very thin}
    tikzset{My Grid/.style={help lines,color=blue!50}}

    begin{document}
    begin{center}
    scalebox{.5}{
    begin{tikzpicture}%[scale=.6,transform shape]
    [>=stealth']
    %draw[My Grid] (-5,-5) grid (15,15);
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below=1cm of s2] (s3) [circlenode] {}; %s3
    node[above=1ex of s3,red] {$s leq 3$};
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to [out=-90,in=180] (s3);
    draw[->] (s3) to [out=0,in=-90] (r2);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to [out=90,in=180] (s3);
    draw[->] (s3) to [out=0,in=90] (r4);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
    end{scope}

    begin{scope}[xshift=10cm]
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
    node[left=1ex of s3,red] {$s$};
    node[right=1ex of s6,red] {$bar{s}$};
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to (s3);
    draw[->] (s6) to (r1);
    draw[->] (s3) to (r2);
    draw[->] (r2) to (s6);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to (s3);
    draw[->] (s6) to (r3);
    draw[->] (s3) to (r4);
    draw[->] (r4) to (s6);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
    end{scope}
    end{scope}

    draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

    end{tikzpicture}
    }
    end{center}
    end{document}


    screenshot






    share|improve this answer













    Your graphics are too large to be centered. To see this, simply load the showframe package that highlights the page and its margins.



    It is therefore necessary to reduce the graph!
    I know two different ways to reduce it:




    • with Tikz scale=.5, transform shape

    • with the macro scalebox


    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning}
    usetikzlibrary{arrows}
    usetikzlibrary{backgrounds}
    usetikzlibrary{fit}
    usetikzlibrary{decorations.pathmorphing}
    usetikzlibrary{calc}
    usepackage{showframe}

    tikzset{squarenode/.style = {
    shape = rectangle,
    fill = gray!50,
    draw = black,
    thick,
    minimum height = 1cm,
    minimum width = 1cm
    }}

    tikzset{circlenode/.style = {
    shape = circle,
    fill = blue!20,
    draw = blue,
    thick,
    minimum size = 1cm
    }}

    tikzset{redcirclenode/.style = {
    shape = circle,
    fill = red!20,
    draw = red,
    thick,
    minimum size = 1cm
    }}

    tikzset{help lines/.style=very thin}
    tikzset{My Grid/.style={help lines,color=blue!50}}

    begin{document}
    begin{center}
    scalebox{.5}{
    begin{tikzpicture}%[scale=.6,transform shape]
    [>=stealth']
    %draw[My Grid] (-5,-5) grid (15,15);
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below=1cm of s2] (s3) [circlenode] {}; %s3
    node[above=1ex of s3,red] {$s leq 3$};
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to [out=-90,in=180] (s3);
    draw[->] (s3) to [out=0,in=-90] (r2);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to [out=90,in=180] (s3);
    draw[->] (s3) to [out=0,in=90] (r4);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
    end{scope}

    begin{scope}[xshift=10cm]
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
    node[left=1ex of s3,red] {$s$};
    node[right=1ex of s6,red] {$bar{s}$};
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to (s3);
    draw[->] (s6) to (r1);
    draw[->] (s3) to (r2);
    draw[->] (r2) to (s6);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to (s3);
    draw[->] (s6) to (r3);
    draw[->] (s3) to (r4);
    draw[->] (r4) to (s6);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
    end{scope}
    end{scope}

    draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

    end{tikzpicture}
    }
    end{center}
    end{document}


    screenshot







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    AndréCAndréC

    9,90311547




    9,90311547













    • I understand the key scale. What is the purpose of transform shape in Tikz

      – subham soni
      yesterday






    • 2





      By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

      – AndréC
      yesterday



















    • I understand the key scale. What is the purpose of transform shape in Tikz

      – subham soni
      yesterday






    • 2





      By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

      – AndréC
      yesterday

















    I understand the key scale. What is the purpose of transform shape in Tikz

    – subham soni
    yesterday





    I understand the key scale. What is the purpose of transform shape in Tikz

    – subham soni
    yesterday




    2




    2





    By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

    – AndréC
    yesterday





    By default, enlargements and reductions do not affect the nodes, they only affect the coordinates. However, your graph is built with nodes, transform shape also allows you to make scale act on the nodes.

    – AndréC
    yesterday











    2














    You might just use an adjustbox.



    documentclass{article}
    usepackage{tikz}
    usetikzlibrary{positioning}
    usetikzlibrary{arrows}
    usetikzlibrary{backgrounds}
    usetikzlibrary{fit}
    usetikzlibrary{decorations.pathmorphing}
    usetikzlibrary{calc}

    tikzset{squarenode/.style = {
    shape = rectangle,
    fill = gray!50,
    draw = black,
    thick,
    minimum height = 1cm,
    minimum width = 1cm
    }}

    tikzset{circlenode/.style = {
    shape = circle,
    fill = blue!20,
    draw = blue,
    thick,
    minimum size = 1cm
    }}

    tikzset{redcirclenode/.style = {
    shape = circle,
    fill = red!20,
    draw = red,
    thick,
    minimum size = 1cm
    }}

    tikzset{help lines/.style=very thin}
    tikzset{My Grid/.style={help lines,color=blue!50}}
    usepackage{adjustbox}
    begin{document}
    begin{center}
    adjustbox{width=textwidth}{begin{tikzpicture}
    [>=stealth']
    %draw[My Grid] (-5,-5) grid (15,15);
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below=1cm of s2] (s3) [circlenode] {}; %s3
    node[above=1ex of s3,red] {$s leq 3$};
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to [out=-90,in=180] (s3);
    draw[->] (s3) to [out=0,in=-90] (r2);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to [out=90,in=180] (s3);
    draw[->] (s3) to [out=0,in=90] (r4);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
    end{scope}

    begin{scope}[xshift=10cm]
    node (r1) at (-4,4) [squarenode] {};
    node[right=4cm of r1] (r2) [squarenode] {};
    node[below=3cm of r1] (r3) [squarenode] {};
    node[right=4cm of r3] (r4) [squarenode] {};
    node[right=1.5cm of r1] (s2) [circlenode] {};
    node[above=1cm of s2] (s1) [circlenode] {}; %s1
    node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
    node[right=1.5cm of r3] (s4) [circlenode] {};
    node[below=1cm of s4] (s5) [circlenode] {}; %s5
    node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
    node[left=1ex of s3,red] {$s$};
    node[right=1ex of s6,red] {$bar{s}$};
    draw[fill=black] (s1.center) circle [radius=0.1cm];
    draw[fill=black] (s5.center) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
    draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
    draw[->] (r1) -- (s2);
    draw[->] (s2) -- (r2);
    draw[->] (r3) -- (s4);
    draw[->] (s4) -- (r4);
    draw[->] (s1) to [out=180,in=90] (r1);
    draw[->] (r1) to (s3);
    draw[->] (s6) to (r1);
    draw[->] (s3) to (r2);
    draw[->] (r2) to (s6);
    draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
    draw[->] (r3) to (s3);
    draw[->] (s6) to (r3);
    draw[->] (s3) to (r4);
    draw[->] (r4) to (s6);
    draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
    draw[->] (s5) to [bend left=45] (r3);
    begin{scope}[on background layer]
    node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
    end{scope}
    end{scope}

    draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

    end{tikzpicture}}
    end{center}
    end{document}





    share|improve this answer




























      2














      You might just use an adjustbox.



      documentclass{article}
      usepackage{tikz}
      usetikzlibrary{positioning}
      usetikzlibrary{arrows}
      usetikzlibrary{backgrounds}
      usetikzlibrary{fit}
      usetikzlibrary{decorations.pathmorphing}
      usetikzlibrary{calc}

      tikzset{squarenode/.style = {
      shape = rectangle,
      fill = gray!50,
      draw = black,
      thick,
      minimum height = 1cm,
      minimum width = 1cm
      }}

      tikzset{circlenode/.style = {
      shape = circle,
      fill = blue!20,
      draw = blue,
      thick,
      minimum size = 1cm
      }}

      tikzset{redcirclenode/.style = {
      shape = circle,
      fill = red!20,
      draw = red,
      thick,
      minimum size = 1cm
      }}

      tikzset{help lines/.style=very thin}
      tikzset{My Grid/.style={help lines,color=blue!50}}
      usepackage{adjustbox}
      begin{document}
      begin{center}
      adjustbox{width=textwidth}{begin{tikzpicture}
      [>=stealth']
      %draw[My Grid] (-5,-5) grid (15,15);
      node (r1) at (-4,4) [squarenode] {};
      node[right=4cm of r1] (r2) [squarenode] {};
      node[below=3cm of r1] (r3) [squarenode] {};
      node[right=4cm of r3] (r4) [squarenode] {};
      node[right=1.5cm of r1] (s2) [circlenode] {};
      node[above=1cm of s2] (s1) [circlenode] {}; %s1
      node[below=1cm of s2] (s3) [circlenode] {}; %s3
      node[above=1ex of s3,red] {$s leq 3$};
      node[right=1.5cm of r3] (s4) [circlenode] {};
      node[below=1cm of s4] (s5) [circlenode] {}; %s5
      draw[fill=black] (s1.center) circle [radius=0.1cm];
      draw[fill=black] (s5.center) circle [radius=0.1cm];
      draw[->] (r1) -- (s2);
      draw[->] (s2) -- (r2);
      draw[->] (r3) -- (s4);
      draw[->] (s4) -- (r4);
      draw[->] (s1) to [out=180,in=90] (r1);
      draw[->] (r1) to [out=-90,in=180] (s3);
      draw[->] (s3) to [out=0,in=-90] (r2);
      draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
      draw[->] (r3) to [out=90,in=180] (s3);
      draw[->] (s3) to [out=0,in=90] (r4);
      draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
      draw[->] (s5) to [bend left=45] (r3);
      begin{scope}[on background layer]
      node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
      end{scope}

      begin{scope}[xshift=10cm]
      node (r1) at (-4,4) [squarenode] {};
      node[right=4cm of r1] (r2) [squarenode] {};
      node[below=3cm of r1] (r3) [squarenode] {};
      node[right=4cm of r3] (r4) [squarenode] {};
      node[right=1.5cm of r1] (s2) [circlenode] {};
      node[above=1cm of s2] (s1) [circlenode] {}; %s1
      node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
      node[right=1.5cm of r3] (s4) [circlenode] {};
      node[below=1cm of s4] (s5) [circlenode] {}; %s5
      node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
      node[left=1ex of s3,red] {$s$};
      node[right=1ex of s6,red] {$bar{s}$};
      draw[fill=black] (s1.center) circle [radius=0.1cm];
      draw[fill=black] (s5.center) circle [radius=0.1cm];
      draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
      draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
      draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
      draw[->] (r1) -- (s2);
      draw[->] (s2) -- (r2);
      draw[->] (r3) -- (s4);
      draw[->] (s4) -- (r4);
      draw[->] (s1) to [out=180,in=90] (r1);
      draw[->] (r1) to (s3);
      draw[->] (s6) to (r1);
      draw[->] (s3) to (r2);
      draw[->] (r2) to (s6);
      draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
      draw[->] (r3) to (s3);
      draw[->] (s6) to (r3);
      draw[->] (s3) to (r4);
      draw[->] (r4) to (s6);
      draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
      draw[->] (s5) to [bend left=45] (r3);
      begin{scope}[on background layer]
      node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
      end{scope}
      end{scope}

      draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

      end{tikzpicture}}
      end{center}
      end{document}





      share|improve this answer


























        2












        2








        2







        You might just use an adjustbox.



        documentclass{article}
        usepackage{tikz}
        usetikzlibrary{positioning}
        usetikzlibrary{arrows}
        usetikzlibrary{backgrounds}
        usetikzlibrary{fit}
        usetikzlibrary{decorations.pathmorphing}
        usetikzlibrary{calc}

        tikzset{squarenode/.style = {
        shape = rectangle,
        fill = gray!50,
        draw = black,
        thick,
        minimum height = 1cm,
        minimum width = 1cm
        }}

        tikzset{circlenode/.style = {
        shape = circle,
        fill = blue!20,
        draw = blue,
        thick,
        minimum size = 1cm
        }}

        tikzset{redcirclenode/.style = {
        shape = circle,
        fill = red!20,
        draw = red,
        thick,
        minimum size = 1cm
        }}

        tikzset{help lines/.style=very thin}
        tikzset{My Grid/.style={help lines,color=blue!50}}
        usepackage{adjustbox}
        begin{document}
        begin{center}
        adjustbox{width=textwidth}{begin{tikzpicture}
        [>=stealth']
        %draw[My Grid] (-5,-5) grid (15,15);
        node (r1) at (-4,4) [squarenode] {};
        node[right=4cm of r1] (r2) [squarenode] {};
        node[below=3cm of r1] (r3) [squarenode] {};
        node[right=4cm of r3] (r4) [squarenode] {};
        node[right=1.5cm of r1] (s2) [circlenode] {};
        node[above=1cm of s2] (s1) [circlenode] {}; %s1
        node[below=1cm of s2] (s3) [circlenode] {}; %s3
        node[above=1ex of s3,red] {$s leq 3$};
        node[right=1.5cm of r3] (s4) [circlenode] {};
        node[below=1cm of s4] (s5) [circlenode] {}; %s5
        draw[fill=black] (s1.center) circle [radius=0.1cm];
        draw[fill=black] (s5.center) circle [radius=0.1cm];
        draw[->] (r1) -- (s2);
        draw[->] (s2) -- (r2);
        draw[->] (r3) -- (s4);
        draw[->] (s4) -- (r4);
        draw[->] (s1) to [out=180,in=90] (r1);
        draw[->] (r1) to [out=-90,in=180] (s3);
        draw[->] (s3) to [out=0,in=-90] (r2);
        draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
        draw[->] (r3) to [out=90,in=180] (s3);
        draw[->] (s3) to [out=0,in=90] (r4);
        draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
        draw[->] (s5) to [bend left=45] (r3);
        begin{scope}[on background layer]
        node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
        end{scope}

        begin{scope}[xshift=10cm]
        node (r1) at (-4,4) [squarenode] {};
        node[right=4cm of r1] (r2) [squarenode] {};
        node[below=3cm of r1] (r3) [squarenode] {};
        node[right=4cm of r3] (r4) [squarenode] {};
        node[right=1.5cm of r1] (s2) [circlenode] {};
        node[above=1cm of s2] (s1) [circlenode] {}; %s1
        node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
        node[right=1.5cm of r3] (s4) [circlenode] {};
        node[below=1cm of s4] (s5) [circlenode] {}; %s5
        node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
        node[left=1ex of s3,red] {$s$};
        node[right=1ex of s6,red] {$bar{s}$};
        draw[fill=black] (s1.center) circle [radius=0.1cm];
        draw[fill=black] (s5.center) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
        draw[->] (r1) -- (s2);
        draw[->] (s2) -- (r2);
        draw[->] (r3) -- (s4);
        draw[->] (s4) -- (r4);
        draw[->] (s1) to [out=180,in=90] (r1);
        draw[->] (r1) to (s3);
        draw[->] (s6) to (r1);
        draw[->] (s3) to (r2);
        draw[->] (r2) to (s6);
        draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
        draw[->] (r3) to (s3);
        draw[->] (s6) to (r3);
        draw[->] (s3) to (r4);
        draw[->] (r4) to (s6);
        draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
        draw[->] (s5) to [bend left=45] (r3);
        begin{scope}[on background layer]
        node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
        end{scope}
        end{scope}

        draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

        end{tikzpicture}}
        end{center}
        end{document}





        share|improve this answer













        You might just use an adjustbox.



        documentclass{article}
        usepackage{tikz}
        usetikzlibrary{positioning}
        usetikzlibrary{arrows}
        usetikzlibrary{backgrounds}
        usetikzlibrary{fit}
        usetikzlibrary{decorations.pathmorphing}
        usetikzlibrary{calc}

        tikzset{squarenode/.style = {
        shape = rectangle,
        fill = gray!50,
        draw = black,
        thick,
        minimum height = 1cm,
        minimum width = 1cm
        }}

        tikzset{circlenode/.style = {
        shape = circle,
        fill = blue!20,
        draw = blue,
        thick,
        minimum size = 1cm
        }}

        tikzset{redcirclenode/.style = {
        shape = circle,
        fill = red!20,
        draw = red,
        thick,
        minimum size = 1cm
        }}

        tikzset{help lines/.style=very thin}
        tikzset{My Grid/.style={help lines,color=blue!50}}
        usepackage{adjustbox}
        begin{document}
        begin{center}
        adjustbox{width=textwidth}{begin{tikzpicture}
        [>=stealth']
        %draw[My Grid] (-5,-5) grid (15,15);
        node (r1) at (-4,4) [squarenode] {};
        node[right=4cm of r1] (r2) [squarenode] {};
        node[below=3cm of r1] (r3) [squarenode] {};
        node[right=4cm of r3] (r4) [squarenode] {};
        node[right=1.5cm of r1] (s2) [circlenode] {};
        node[above=1cm of s2] (s1) [circlenode] {}; %s1
        node[below=1cm of s2] (s3) [circlenode] {}; %s3
        node[above=1ex of s3,red] {$s leq 3$};
        node[right=1.5cm of r3] (s4) [circlenode] {};
        node[below=1cm of s4] (s5) [circlenode] {}; %s5
        draw[fill=black] (s1.center) circle [radius=0.1cm];
        draw[fill=black] (s5.center) circle [radius=0.1cm];
        draw[->] (r1) -- (s2);
        draw[->] (s2) -- (r2);
        draw[->] (r3) -- (s4);
        draw[->] (s4) -- (r4);
        draw[->] (s1) to [out=180,in=90] (r1);
        draw[->] (r1) to [out=-90,in=180] (s3);
        draw[->] (s3) to [out=0,in=-90] (r2);
        draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
        draw[->] (r3) to [out=90,in=180] (s3);
        draw[->] (s3) to [out=0,in=90] (r4);
        draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
        draw[->] (s5) to [bend left=45] (r3);
        begin{scope}[on background layer]
        node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R1) {};
        end{scope}

        begin{scope}[xshift=10cm]
        node (r1) at (-4,4) [squarenode] {};
        node[right=4cm of r1] (r2) [squarenode] {};
        node[below=3cm of r1] (r3) [squarenode] {};
        node[right=4cm of r3] (r4) [squarenode] {};
        node[right=1.5cm of r1] (s2) [circlenode] {};
        node[above=1cm of s2] (s1) [circlenode] {}; %s1
        node[below left=1.35cm and 0cm of s2,] (s3) [redcirclenode] {}; %s3
        node[right=1.5cm of r3] (s4) [circlenode] {};
        node[below=1cm of s4] (s5) [circlenode] {}; %s5
        node[right=0.5cm of s3] (s6) [redcirclenode] {}; %s6
        node[left=1ex of s3,red] {$s$};
        node[right=1ex of s6,red] {$bar{s}$};
        draw[fill=black] (s1.center) circle [radius=0.1cm];
        draw[fill=black] (s5.center) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)-(0.23,0.15)$) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)-(0,-0.23)$) circle [radius=0.1cm];
        draw[fill=black] ($(s6.center)+(0.23,-0.15)$) circle [radius=0.1cm];
        draw[->] (r1) -- (s2);
        draw[->] (s2) -- (r2);
        draw[->] (r3) -- (s4);
        draw[->] (s4) -- (r4);
        draw[->] (s1) to [out=180,in=90] (r1);
        draw[->] (r1) to (s3);
        draw[->] (s6) to (r1);
        draw[->] (s3) to (r2);
        draw[->] (r2) to (s6);
        draw[->] (r2) to [bend right=45] node[auto,swap] {2} (s1);
        draw[->] (r3) to (s3);
        draw[->] (s6) to (r3);
        draw[->] (s3) to (r4);
        draw[->] (r4) to (s6);
        draw[->] (r4) to [bend left=45] node[auto] {2} (s5);
        draw[->] (s5) to [bend left=45] (r3);
        begin{scope}[on background layer]
        node [fill=gray!15,rounded corners,fit=(s1) (s3) (s5) (r1) (r2)] (R2) {};
        end{scope}
        end{scope}

        draw[shorten >=1mm,-to,thick,decorate,decoration={snake,amplitude=.4mm,segment length=2mm,pre=moveto,pre length=1mm,post length=2mm}] (R1) -- (R2) node [above=1mm,midway,text width=3cm,align=center] {replacement of the textcolor{red}{capacity} by textcolor{red}{two places}};

        end{tikzpicture}}
        end{center}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        marmotmarmot

        106k5128242




        106k5128242






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f477960%2fpetrinet-how-do-i-bring-the-figure-to-the-center-of-the-page%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

            Castillo d'Acher Características Menú de navegación

            Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...