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

Can this water damage be explained by lack of gutters and grading issues?

Can gravitational waves pass through a black hole?

Is there a way to convert Wolfram Language expression to string?

How to create a command for the "strange m" symbol in latex?

Is Bran literally the world's memory?

Why does BitLocker not use RSA?

Can the van der Waals coefficients be negative in the van der Waals equation for real gases?

Why these surprising proportionalities of integrals involving odd zeta values?

How do I deal with an erroneously large refund?

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

Etymology of 見舞い

Raising a bilingual kid. When should we introduce the majority language?

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

Does GDPR cover the collection of data by websites that crawl the web and resell user data

How do I overlay a PNG over two videos (one video overlays another) in one command using FFmpeg?

Are Flameskulls resistant to magical piercing damage?

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

How to mute a string and play another at the same time

Coin Game with infinite paradox

Are there any AGPL-style licences that require source code modifications to be public?

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

Converting a text document with special format to Pandas DataFrame

Is there a verb for listening stealthily?

Why did Israel vote against lifting the American embargo on Cuba?



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



























    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

























      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














      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












      share










      share



      share










      asked 9 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

          Installing LyX: “No textclass is found.”LyX installation error- text class not found- 'Reconfigure' or...

          (1602) Indiana Índice Designación y nombre Características orbitales Véase...

          Universidad Autónoma de Occidente Índice Historia Campus Facultades Programas Académicos Medios de...