Tikzpicture / PGF layers rendering in the margin












0















Alrightly folks, I have one that has stumped me thoroughly and hopefully one of you beautiful brilliant people can help me out.



I am attempting to use tikz/pgf to enable me to use absolute positioning of images and text over my document with coordinates. However, my PGF layers keep rendering inside the margin.



Latex Code:



documentclass[letterpaper]{letter}
usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
usepackage{tikz}

pgfdeclarelayer{back}
pgfdeclarelayer{front}
pgfsetlayers{back,main,front}

begin{document}
begin{tikzpicture}[remember picture,overlay]
begin{pgfonlayer}{back}
tikz[remember picture,overlay] {draw[thick,red,fill] (current page.north west) rectangle (current page.south east);}
This is some text, it is on the main layer.\
end{pgfonlayer}
end{tikzpicture}

end{document}


Result:
enter image description here



Any help would sincerely be appreciated!










share|improve this question





























    0















    Alrightly folks, I have one that has stumped me thoroughly and hopefully one of you beautiful brilliant people can help me out.



    I am attempting to use tikz/pgf to enable me to use absolute positioning of images and text over my document with coordinates. However, my PGF layers keep rendering inside the margin.



    Latex Code:



    documentclass[letterpaper]{letter}
    usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
    usepackage{tikz}

    pgfdeclarelayer{back}
    pgfdeclarelayer{front}
    pgfsetlayers{back,main,front}

    begin{document}
    begin{tikzpicture}[remember picture,overlay]
    begin{pgfonlayer}{back}
    tikz[remember picture,overlay] {draw[thick,red,fill] (current page.north west) rectangle (current page.south east);}
    This is some text, it is on the main layer.\
    end{pgfonlayer}
    end{tikzpicture}

    end{document}


    Result:
    enter image description here



    Any help would sincerely be appreciated!










    share|improve this question



























      0












      0








      0








      Alrightly folks, I have one that has stumped me thoroughly and hopefully one of you beautiful brilliant people can help me out.



      I am attempting to use tikz/pgf to enable me to use absolute positioning of images and text over my document with coordinates. However, my PGF layers keep rendering inside the margin.



      Latex Code:



      documentclass[letterpaper]{letter}
      usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
      usepackage{tikz}

      pgfdeclarelayer{back}
      pgfdeclarelayer{front}
      pgfsetlayers{back,main,front}

      begin{document}
      begin{tikzpicture}[remember picture,overlay]
      begin{pgfonlayer}{back}
      tikz[remember picture,overlay] {draw[thick,red,fill] (current page.north west) rectangle (current page.south east);}
      This is some text, it is on the main layer.\
      end{pgfonlayer}
      end{tikzpicture}

      end{document}


      Result:
      enter image description here



      Any help would sincerely be appreciated!










      share|improve this question
















      Alrightly folks, I have one that has stumped me thoroughly and hopefully one of you beautiful brilliant people can help me out.



      I am attempting to use tikz/pgf to enable me to use absolute positioning of images and text over my document with coordinates. However, my PGF layers keep rendering inside the margin.



      Latex Code:



      documentclass[letterpaper]{letter}
      usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
      usepackage{tikz}

      pgfdeclarelayer{back}
      pgfdeclarelayer{front}
      pgfsetlayers{back,main,front}

      begin{document}
      begin{tikzpicture}[remember picture,overlay]
      begin{pgfonlayer}{back}
      tikz[remember picture,overlay] {draw[thick,red,fill] (current page.north west) rectangle (current page.south east);}
      This is some text, it is on the main layer.\
      end{pgfonlayer}
      end{tikzpicture}

      end{document}


      Result:
      enter image description here



      Any help would sincerely be appreciated!







      tikz-pgf tikz-pic pgflayers






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 7 at 16:06









      user180639

      2048




      2048










      asked Feb 7 at 15:12









      James DunlapJames Dunlap

      203




      203






















          1 Answer
          1






          active

          oldest

          votes


















          4














          Using tikz inside a tikzpicture is not a good idea (tikz is a short form for creating a new tikzpicture and they must not be nested). Remove it and directly draw the rectangle (don't forget to compile two times):



          documentclass[letterpaper]{letter}
          usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
          usepackage{tikz}

          pgfdeclarelayer{back}
          pgfdeclarelayer{front}
          pgfsetlayers{back,main,front}


          begin{document}
          begin{tikzpicture}[remember picture,overlay]
          begin{pgfonlayer}{back}
          fill[red] (current page.north west) rectangle (current page.south east);
          end{pgfonlayer}
          node at (current page.center) {text on main layer};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 1





            @marmot Thank you for your vote!

            – user180639
            Feb 7 at 16:19











          • First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

            – James Dunlap
            Feb 7 at 18:31











          • Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

            – James Dunlap
            Feb 7 at 18:33






          • 1





            @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

            – user180639
            Feb 8 at 0:11








          • 1





            @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

            – user180639
            Feb 8 at 0:13











          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%2f473777%2ftikzpicture-pgf-layers-rendering-in-the-margin%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          Using tikz inside a tikzpicture is not a good idea (tikz is a short form for creating a new tikzpicture and they must not be nested). Remove it and directly draw the rectangle (don't forget to compile two times):



          documentclass[letterpaper]{letter}
          usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
          usepackage{tikz}

          pgfdeclarelayer{back}
          pgfdeclarelayer{front}
          pgfsetlayers{back,main,front}


          begin{document}
          begin{tikzpicture}[remember picture,overlay]
          begin{pgfonlayer}{back}
          fill[red] (current page.north west) rectangle (current page.south east);
          end{pgfonlayer}
          node at (current page.center) {text on main layer};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 1





            @marmot Thank you for your vote!

            – user180639
            Feb 7 at 16:19











          • First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

            – James Dunlap
            Feb 7 at 18:31











          • Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

            – James Dunlap
            Feb 7 at 18:33






          • 1





            @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

            – user180639
            Feb 8 at 0:11








          • 1





            @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

            – user180639
            Feb 8 at 0:13
















          4














          Using tikz inside a tikzpicture is not a good idea (tikz is a short form for creating a new tikzpicture and they must not be nested). Remove it and directly draw the rectangle (don't forget to compile two times):



          documentclass[letterpaper]{letter}
          usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
          usepackage{tikz}

          pgfdeclarelayer{back}
          pgfdeclarelayer{front}
          pgfsetlayers{back,main,front}


          begin{document}
          begin{tikzpicture}[remember picture,overlay]
          begin{pgfonlayer}{back}
          fill[red] (current page.north west) rectangle (current page.south east);
          end{pgfonlayer}
          node at (current page.center) {text on main layer};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer





















          • 1





            @marmot Thank you for your vote!

            – user180639
            Feb 7 at 16:19











          • First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

            – James Dunlap
            Feb 7 at 18:31











          • Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

            – James Dunlap
            Feb 7 at 18:33






          • 1





            @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

            – user180639
            Feb 8 at 0:11








          • 1





            @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

            – user180639
            Feb 8 at 0:13














          4












          4








          4







          Using tikz inside a tikzpicture is not a good idea (tikz is a short form for creating a new tikzpicture and they must not be nested). Remove it and directly draw the rectangle (don't forget to compile two times):



          documentclass[letterpaper]{letter}
          usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
          usepackage{tikz}

          pgfdeclarelayer{back}
          pgfdeclarelayer{front}
          pgfsetlayers{back,main,front}


          begin{document}
          begin{tikzpicture}[remember picture,overlay]
          begin{pgfonlayer}{back}
          fill[red] (current page.north west) rectangle (current page.south east);
          end{pgfonlayer}
          node at (current page.center) {text on main layer};
          end{tikzpicture}

          end{document}


          enter image description here






          share|improve this answer















          Using tikz inside a tikzpicture is not a good idea (tikz is a short form for creating a new tikzpicture and they must not be nested). Remove it and directly draw the rectangle (don't forget to compile two times):



          documentclass[letterpaper]{letter}
          usepackage[lmargin=15pt,rmargin=15pt,tmargin=0pt,bmargin=10pt]{geometry}
          usepackage{tikz}

          pgfdeclarelayer{back}
          pgfdeclarelayer{front}
          pgfsetlayers{back,main,front}


          begin{document}
          begin{tikzpicture}[remember picture,overlay]
          begin{pgfonlayer}{back}
          fill[red] (current page.north west) rectangle (current page.south east);
          end{pgfonlayer}
          node at (current page.center) {text on main layer};
          end{tikzpicture}

          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 7 at 15:52

























          answered Feb 7 at 15:42









          user180639user180639

          2048




          2048








          • 1





            @marmot Thank you for your vote!

            – user180639
            Feb 7 at 16:19











          • First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

            – James Dunlap
            Feb 7 at 18:31











          • Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

            – James Dunlap
            Feb 7 at 18:33






          • 1





            @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

            – user180639
            Feb 8 at 0:11








          • 1





            @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

            – user180639
            Feb 8 at 0:13














          • 1





            @marmot Thank you for your vote!

            – user180639
            Feb 7 at 16:19











          • First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

            – James Dunlap
            Feb 7 at 18:31











          • Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

            – James Dunlap
            Feb 7 at 18:33






          • 1





            @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

            – user180639
            Feb 8 at 0:11








          • 1





            @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

            – user180639
            Feb 8 at 0:13








          1




          1





          @marmot Thank you for your vote!

          – user180639
          Feb 7 at 16:19





          @marmot Thank you for your vote!

          – user180639
          Feb 7 at 16:19













          First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

          – James Dunlap
          Feb 7 at 18:31





          First, thanks for clearing up some of structure. Is it acceptable to nest tikzpictures or is that always a no no?

          – James Dunlap
          Feb 7 at 18:31













          Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

          – James Dunlap
          Feb 7 at 18:33





          Second..... THANK YOU SO MUCH! Some how I had never discovered that I needed to compile twice and this has been haunting me for weeks through all my projects trying to use certain packages. Your extra effort to remind me to compile two times has changed my life for the better. I am in your debt.

          – James Dunlap
          Feb 7 at 18:33




          1




          1





          @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

          – user180639
          Feb 8 at 0:11







          @JamesDunlap First: In general you should not nest tikzpictures. While this might sometimes give the results you want, problems caused by this are a pain in the a** to debug, so better never nest them. And in the code you show nesting them really makes no sense.

          – user180639
          Feb 8 at 0:11






          1




          1





          @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

          – user180639
          Feb 8 at 0:13





          @JamesDunlap Second: My pleasure to help! Compiling two times is necessary because in the first run tikz has to look up all kinds of things, like how big the page is. I the second run it can use all these stored variables to correctly position things.

          – user180639
          Feb 8 at 0:13


















          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%2f473777%2ftikzpicture-pgf-layers-rendering-in-the-margin%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

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?