Unwanted gap between top margin and text caused by tikzpicture overlay Announcing the arrival...

Marquee sign letters

Like totally amazing interchangeable sister outfit accessory swapping or whatever

Are Flameskulls resistant to magical piercing damage?

Can gravitational waves pass through a black hole?

Why aren't these two solutions equivalent? Combinatorics problem

Can a Knight grant Knighthood to another?

Does using the inspiration rules for character defects tend to encourage players to display MGS?

Why "Go Out and Learn"

Is it OK if I do not take the receipt in Germany?

Why these surprising proportionalities of integrals involving odd zeta values?

Why isn't everyone flabbergasted about Bran's "gift"?

Do chord progressions usually move by fifths?

Lights are flickering on and off after accidentally bumping into light switch

Why does BitLocker not use RSA?

How do I deal with an erroneously large refund?

Are bags of holding fireproof?

Does Prince Arnaud cause someone holding the Princess to lose?

How can I introduce the names of fantasy creatures to the reader?

Weaponising the Grasp-at-a-Distance spell

Can a Wizard take the Magic Initiate feat and select spells from the Wizard list?

Etymology of 見舞い

2 sample t test for sample sizes - 30,000 and 150,000

Should man-made satellites feature an intelligent inverted "cow catcher"?

Is my guitar’s action too high?



Unwanted gap between top margin and text caused by tikzpicture overlay



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Gap between xaxis and bars in tikzpictureUnwanted space between . (“dot”) and YHow to have text overlay top and bottom of image with fade at top and bottom?Justifying text and removing unwanted spacetikzpicture extends over page margin and surrounding textA gap between text and line in tableReduce gap between subfloat and subcaptionHow to fix gap between text and table?Tikzpicture with remember picture and overlay inserting vertical spaceReduce space between title and top margin in scrartcl












0















I have the following code based on atbegshi, tikz and a boolean switch to insert pages with a sidebar:



documentclass[a4paper]{article}

usepackage[margin=1.0cm,noheadfoot,showframe]{geometry}
usepackage{atbegshi,ifthen,tikz,lipsum}

pagestyle{empty}

newboolean{DrawSidebar}
setboolean{DrawSidebar}{false}
AtBeginShipout{ifthenelse{boolean{DrawSidebar}}{%
begin{tikzpicture}[remember picture,overlay]%
fill[red] (current page.north west) rectangle ++(5.0cm,-paperheight);
end{tikzpicture}%
}{}}

begin{document}

lipsum[1-10]

setboolean{DrawSidebar}{true}
newgeometry{left=6.0cm,right=1.0cm,top=1.0cm,bottom=1.0cm,noheadfoot}

lipsum[1-15]

setboolean{DrawSidebar}{false}
restoregeometry

lipsum[1-10]

end{document}


This works quite well, but there is an unwanted gap between the top margin and the text on all pages with sidebar:



enter image description here



I can remove the gap by commenting out the tikzpicture code in AtBeginShipout. So I assume that it is related to the tikzpicture which is quite surprising to me since it is an overlay.



What can I do to remove this gap?










share|improve this question



























    0















    I have the following code based on atbegshi, tikz and a boolean switch to insert pages with a sidebar:



    documentclass[a4paper]{article}

    usepackage[margin=1.0cm,noheadfoot,showframe]{geometry}
    usepackage{atbegshi,ifthen,tikz,lipsum}

    pagestyle{empty}

    newboolean{DrawSidebar}
    setboolean{DrawSidebar}{false}
    AtBeginShipout{ifthenelse{boolean{DrawSidebar}}{%
    begin{tikzpicture}[remember picture,overlay]%
    fill[red] (current page.north west) rectangle ++(5.0cm,-paperheight);
    end{tikzpicture}%
    }{}}

    begin{document}

    lipsum[1-10]

    setboolean{DrawSidebar}{true}
    newgeometry{left=6.0cm,right=1.0cm,top=1.0cm,bottom=1.0cm,noheadfoot}

    lipsum[1-15]

    setboolean{DrawSidebar}{false}
    restoregeometry

    lipsum[1-10]

    end{document}


    This works quite well, but there is an unwanted gap between the top margin and the text on all pages with sidebar:



    enter image description here



    I can remove the gap by commenting out the tikzpicture code in AtBeginShipout. So I assume that it is related to the tikzpicture which is quite surprising to me since it is an overlay.



    What can I do to remove this gap?










    share|improve this question

























      0












      0








      0








      I have the following code based on atbegshi, tikz and a boolean switch to insert pages with a sidebar:



      documentclass[a4paper]{article}

      usepackage[margin=1.0cm,noheadfoot,showframe]{geometry}
      usepackage{atbegshi,ifthen,tikz,lipsum}

      pagestyle{empty}

      newboolean{DrawSidebar}
      setboolean{DrawSidebar}{false}
      AtBeginShipout{ifthenelse{boolean{DrawSidebar}}{%
      begin{tikzpicture}[remember picture,overlay]%
      fill[red] (current page.north west) rectangle ++(5.0cm,-paperheight);
      end{tikzpicture}%
      }{}}

      begin{document}

      lipsum[1-10]

      setboolean{DrawSidebar}{true}
      newgeometry{left=6.0cm,right=1.0cm,top=1.0cm,bottom=1.0cm,noheadfoot}

      lipsum[1-15]

      setboolean{DrawSidebar}{false}
      restoregeometry

      lipsum[1-10]

      end{document}


      This works quite well, but there is an unwanted gap between the top margin and the text on all pages with sidebar:



      enter image description here



      I can remove the gap by commenting out the tikzpicture code in AtBeginShipout. So I assume that it is related to the tikzpicture which is quite surprising to me since it is an overlay.



      What can I do to remove this gap?










      share|improve this question














      I have the following code based on atbegshi, tikz and a boolean switch to insert pages with a sidebar:



      documentclass[a4paper]{article}

      usepackage[margin=1.0cm,noheadfoot,showframe]{geometry}
      usepackage{atbegshi,ifthen,tikz,lipsum}

      pagestyle{empty}

      newboolean{DrawSidebar}
      setboolean{DrawSidebar}{false}
      AtBeginShipout{ifthenelse{boolean{DrawSidebar}}{%
      begin{tikzpicture}[remember picture,overlay]%
      fill[red] (current page.north west) rectangle ++(5.0cm,-paperheight);
      end{tikzpicture}%
      }{}}

      begin{document}

      lipsum[1-10]

      setboolean{DrawSidebar}{true}
      newgeometry{left=6.0cm,right=1.0cm,top=1.0cm,bottom=1.0cm,noheadfoot}

      lipsum[1-15]

      setboolean{DrawSidebar}{false}
      restoregeometry

      lipsum[1-10]

      end{document}


      This works quite well, but there is an unwanted gap between the top margin and the text on all pages with sidebar:



      enter image description here



      I can remove the gap by commenting out the tikzpicture code in AtBeginShipout. So I assume that it is related to the tikzpicture which is quite surprising to me since it is an overlay.



      What can I do to remove this gap?







      tikz-pgf spacing atbegshi






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 18 mins ago









      JotWeJotWe

      1008




      1008






















          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%2f486117%2funwanted-gap-between-top-margin-and-text-caused-by-tikzpicture-overlay%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%2f486117%2funwanted-gap-between-top-margin-and-text-caused-by-tikzpicture-overlay%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

          IEEEtran - How to include ORCID in TeX/PDF with PdfLatexIs there a standard way to include ORCID in TeX /...

          Cicindela nigrior Przypisy | Menu nawigacyjneCicindela varians unicolorManual for the Identification of the...

          Glossaries-extra: Adding glossaries package to “Clas­sicTh­e­sis” template by Dr. André Miede v. 4.6 ...