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












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



























    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

























      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














      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}






      tikz-pgf alignment





      share












      share










      share



      share










      asked 3 mins ago









      subham sonisubham soni

      4,07082981




      4,07082981






















          0






          active

          oldest

          votes











          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

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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

          Accessing regular linux commands in Huawei's Dopra Linux

          Can't connect RFCOMM socket: Host is down

          Kernel panic - not syncing: Fatal Exception in Interrupt