Tikz with standalone: pinning tikz coordinates to page cm











up vote
2
down vote

favorite












I've got something like the following:



documentclass[tikz]{standalone}% Does not support leap years. 

usepackage{tikz}

usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

newcommand{printdots}[1]{
begin{tikzpicture}[
x=1cm,
y=1cm,
xscale = 1,
yscale=1,
]

%Draw dots
foreach y in {1, 1.5, ..., 24} {
foreach x in {1, 1.5, ..., 11} {
fill[color=black] (x,y) circle (0.05);
}
}

end{tikzpicture}%
}

begin{document}
foreach n in {1,...,2}{%
printdots
}
end{document}


i.e. I'd like to make a 12x15cm standalone, with 2 pages. On each page, I'd like to print dots 0.5cm apart, starting 1cm from the edge.



(Eventually, I'd like to do more complex things, so if there's an easier way to print dots, that probably won't solve my problem).



However, when I compile this, it ends up with a large space on the right and bottom, missing dots on the top and left.
In other words, the tikz coordinates aren't matching the page coordinates.



Is there any way to make my Tikz coordinates exactly match the page coordinates in cm? Basically, I want to tell tikz not to automatically scale the picture at all based on what I have in it.



I've seen lots of tikz posts on attaching specific nodes to a page position, but not how to align the coordinates with the page position.










share|improve this question


















  • 1




    isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
    – Zarko
    1 hour ago















up vote
2
down vote

favorite












I've got something like the following:



documentclass[tikz]{standalone}% Does not support leap years. 

usepackage{tikz}

usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

newcommand{printdots}[1]{
begin{tikzpicture}[
x=1cm,
y=1cm,
xscale = 1,
yscale=1,
]

%Draw dots
foreach y in {1, 1.5, ..., 24} {
foreach x in {1, 1.5, ..., 11} {
fill[color=black] (x,y) circle (0.05);
}
}

end{tikzpicture}%
}

begin{document}
foreach n in {1,...,2}{%
printdots
}
end{document}


i.e. I'd like to make a 12x15cm standalone, with 2 pages. On each page, I'd like to print dots 0.5cm apart, starting 1cm from the edge.



(Eventually, I'd like to do more complex things, so if there's an easier way to print dots, that probably won't solve my problem).



However, when I compile this, it ends up with a large space on the right and bottom, missing dots on the top and left.
In other words, the tikz coordinates aren't matching the page coordinates.



Is there any way to make my Tikz coordinates exactly match the page coordinates in cm? Basically, I want to tell tikz not to automatically scale the picture at all based on what I have in it.



I've seen lots of tikz posts on attaching specific nodes to a page position, but not how to align the coordinates with the page position.










share|improve this question


















  • 1




    isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
    – Zarko
    1 hour ago













up vote
2
down vote

favorite









up vote
2
down vote

favorite











I've got something like the following:



documentclass[tikz]{standalone}% Does not support leap years. 

usepackage{tikz}

usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

newcommand{printdots}[1]{
begin{tikzpicture}[
x=1cm,
y=1cm,
xscale = 1,
yscale=1,
]

%Draw dots
foreach y in {1, 1.5, ..., 24} {
foreach x in {1, 1.5, ..., 11} {
fill[color=black] (x,y) circle (0.05);
}
}

end{tikzpicture}%
}

begin{document}
foreach n in {1,...,2}{%
printdots
}
end{document}


i.e. I'd like to make a 12x15cm standalone, with 2 pages. On each page, I'd like to print dots 0.5cm apart, starting 1cm from the edge.



(Eventually, I'd like to do more complex things, so if there's an easier way to print dots, that probably won't solve my problem).



However, when I compile this, it ends up with a large space on the right and bottom, missing dots on the top and left.
In other words, the tikz coordinates aren't matching the page coordinates.



Is there any way to make my Tikz coordinates exactly match the page coordinates in cm? Basically, I want to tell tikz not to automatically scale the picture at all based on what I have in it.



I've seen lots of tikz posts on attaching specific nodes to a page position, but not how to align the coordinates with the page position.










share|improve this question













I've got something like the following:



documentclass[tikz]{standalone}% Does not support leap years. 

usepackage{tikz}

usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

newcommand{printdots}[1]{
begin{tikzpicture}[
x=1cm,
y=1cm,
xscale = 1,
yscale=1,
]

%Draw dots
foreach y in {1, 1.5, ..., 24} {
foreach x in {1, 1.5, ..., 11} {
fill[color=black] (x,y) circle (0.05);
}
}

end{tikzpicture}%
}

begin{document}
foreach n in {1,...,2}{%
printdots
}
end{document}


i.e. I'd like to make a 12x15cm standalone, with 2 pages. On each page, I'd like to print dots 0.5cm apart, starting 1cm from the edge.



(Eventually, I'd like to do more complex things, so if there's an easier way to print dots, that probably won't solve my problem).



However, when I compile this, it ends up with a large space on the right and bottom, missing dots on the top and left.
In other words, the tikz coordinates aren't matching the page coordinates.



Is there any way to make my Tikz coordinates exactly match the page coordinates in cm? Basically, I want to tell tikz not to automatically scale the picture at all based on what I have in it.



I've seen lots of tikz posts on attaching specific nodes to a page position, but not how to align the coordinates with the page position.







tikz-pgf positioning coordinates






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 2 hours ago









jmite

5841518




5841518








  • 1




    isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
    – Zarko
    1 hour ago














  • 1




    isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
    – Zarko
    1 hour ago








1




1




isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
– Zarko
1 hour ago




isn't this simpler to achieve with standard document class like article? for tikz try to use overlay ans remember picture for exact positioning your dots on page.
– Zarko
1 hour ago










2 Answers
2






active

oldest

votes

















up vote
1
down vote













Now that I've written the answer, I see @Zarko's comment. I agree with him that one should better use article (or something of this sort) to create a multipage document.



documentclass{article}% Does not support leap years. 
usepackage{tikz}
usepackage{eso-pic}

usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}
AddToShipoutPictureBG{%
begin{tikzpicture}[overlay,remember picture,
x=1cm,
y=1cm,
xscale = 1,
yscale=1,
]

%Draw dots
foreach y in {1, 1.5, ..., 24} {
foreach x in {1, 1.5, ..., 11} {
fill[color=black] ([xshift=x*1cm,yshift=y*1cm]current page.south
west) circle (0.05);
}
}
end{tikzpicture}}

begin{document}
~
clearpage
~
end{document}





share|improve this answer




























    up vote
    0
    down vote













    Using other than the standalone class frees you from many limitations. You can use a normal article class with the powerful pic construct from tikz. You can place the dots picture on any page you want without interfering with the page content using the [overlay, remember picture] option as noted out by @Zarko. The new macro drawdots defined below conveniently adds the dots to any page.



    documentclass{article} 
    usepackage{tikz}
    usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

    tikzset{
    mydots/.pic = {
    foreach y in {0, .5, ..., 23}
    foreach x in {0, .5, ..., 10}
    fill[color=black] (x,y) circle (0.05);
    }
    }

    newcommand{drawdots}{%
    begin{tikzpicture}[overlay, remember picture]
    pic at ([shift={(1,1)}]current page.south west) {mydots};
    end{tikzpicture}
    }

    begin{document}
    drawdots
    clearpage
    drawdots
    end{document}


    enter image description here






    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',
      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%2f461638%2ftikz-with-standalone-pinning-tikz-coordinates-to-page-cm%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








      up vote
      1
      down vote













      Now that I've written the answer, I see @Zarko's comment. I agree with him that one should better use article (or something of this sort) to create a multipage document.



      documentclass{article}% Does not support leap years. 
      usepackage{tikz}
      usepackage{eso-pic}

      usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}
      AddToShipoutPictureBG{%
      begin{tikzpicture}[overlay,remember picture,
      x=1cm,
      y=1cm,
      xscale = 1,
      yscale=1,
      ]

      %Draw dots
      foreach y in {1, 1.5, ..., 24} {
      foreach x in {1, 1.5, ..., 11} {
      fill[color=black] ([xshift=x*1cm,yshift=y*1cm]current page.south
      west) circle (0.05);
      }
      }
      end{tikzpicture}}

      begin{document}
      ~
      clearpage
      ~
      end{document}





      share|improve this answer

























        up vote
        1
        down vote













        Now that I've written the answer, I see @Zarko's comment. I agree with him that one should better use article (or something of this sort) to create a multipage document.



        documentclass{article}% Does not support leap years. 
        usepackage{tikz}
        usepackage{eso-pic}

        usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}
        AddToShipoutPictureBG{%
        begin{tikzpicture}[overlay,remember picture,
        x=1cm,
        y=1cm,
        xscale = 1,
        yscale=1,
        ]

        %Draw dots
        foreach y in {1, 1.5, ..., 24} {
        foreach x in {1, 1.5, ..., 11} {
        fill[color=black] ([xshift=x*1cm,yshift=y*1cm]current page.south
        west) circle (0.05);
        }
        }
        end{tikzpicture}}

        begin{document}
        ~
        clearpage
        ~
        end{document}





        share|improve this answer























          up vote
          1
          down vote










          up vote
          1
          down vote









          Now that I've written the answer, I see @Zarko's comment. I agree with him that one should better use article (or something of this sort) to create a multipage document.



          documentclass{article}% Does not support leap years. 
          usepackage{tikz}
          usepackage{eso-pic}

          usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}
          AddToShipoutPictureBG{%
          begin{tikzpicture}[overlay,remember picture,
          x=1cm,
          y=1cm,
          xscale = 1,
          yscale=1,
          ]

          %Draw dots
          foreach y in {1, 1.5, ..., 24} {
          foreach x in {1, 1.5, ..., 11} {
          fill[color=black] ([xshift=x*1cm,yshift=y*1cm]current page.south
          west) circle (0.05);
          }
          }
          end{tikzpicture}}

          begin{document}
          ~
          clearpage
          ~
          end{document}





          share|improve this answer












          Now that I've written the answer, I see @Zarko's comment. I agree with him that one should better use article (or something of this sort) to create a multipage document.



          documentclass{article}% Does not support leap years. 
          usepackage{tikz}
          usepackage{eso-pic}

          usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}
          AddToShipoutPictureBG{%
          begin{tikzpicture}[overlay,remember picture,
          x=1cm,
          y=1cm,
          xscale = 1,
          yscale=1,
          ]

          %Draw dots
          foreach y in {1, 1.5, ..., 24} {
          foreach x in {1, 1.5, ..., 11} {
          fill[color=black] ([xshift=x*1cm,yshift=y*1cm]current page.south
          west) circle (0.05);
          }
          }
          end{tikzpicture}}

          begin{document}
          ~
          clearpage
          ~
          end{document}






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          marmot

          77.7k487166




          77.7k487166






















              up vote
              0
              down vote













              Using other than the standalone class frees you from many limitations. You can use a normal article class with the powerful pic construct from tikz. You can place the dots picture on any page you want without interfering with the page content using the [overlay, remember picture] option as noted out by @Zarko. The new macro drawdots defined below conveniently adds the dots to any page.



              documentclass{article} 
              usepackage{tikz}
              usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

              tikzset{
              mydots/.pic = {
              foreach y in {0, .5, ..., 23}
              foreach x in {0, .5, ..., 10}
              fill[color=black] (x,y) circle (0.05);
              }
              }

              newcommand{drawdots}{%
              begin{tikzpicture}[overlay, remember picture]
              pic at ([shift={(1,1)}]current page.south west) {mydots};
              end{tikzpicture}
              }

              begin{document}
              drawdots
              clearpage
              drawdots
              end{document}


              enter image description here






              share|improve this answer



























                up vote
                0
                down vote













                Using other than the standalone class frees you from many limitations. You can use a normal article class with the powerful pic construct from tikz. You can place the dots picture on any page you want without interfering with the page content using the [overlay, remember picture] option as noted out by @Zarko. The new macro drawdots defined below conveniently adds the dots to any page.



                documentclass{article} 
                usepackage{tikz}
                usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

                tikzset{
                mydots/.pic = {
                foreach y in {0, .5, ..., 23}
                foreach x in {0, .5, ..., 10}
                fill[color=black] (x,y) circle (0.05);
                }
                }

                newcommand{drawdots}{%
                begin{tikzpicture}[overlay, remember picture]
                pic at ([shift={(1,1)}]current page.south west) {mydots};
                end{tikzpicture}
                }

                begin{document}
                drawdots
                clearpage
                drawdots
                end{document}


                enter image description here






                share|improve this answer

























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Using other than the standalone class frees you from many limitations. You can use a normal article class with the powerful pic construct from tikz. You can place the dots picture on any page you want without interfering with the page content using the [overlay, remember picture] option as noted out by @Zarko. The new macro drawdots defined below conveniently adds the dots to any page.



                  documentclass{article} 
                  usepackage{tikz}
                  usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

                  tikzset{
                  mydots/.pic = {
                  foreach y in {0, .5, ..., 23}
                  foreach x in {0, .5, ..., 10}
                  fill[color=black] (x,y) circle (0.05);
                  }
                  }

                  newcommand{drawdots}{%
                  begin{tikzpicture}[overlay, remember picture]
                  pic at ([shift={(1,1)}]current page.south west) {mydots};
                  end{tikzpicture}
                  }

                  begin{document}
                  drawdots
                  clearpage
                  drawdots
                  end{document}


                  enter image description here






                  share|improve this answer














                  Using other than the standalone class frees you from many limitations. You can use a normal article class with the powerful pic construct from tikz. You can place the dots picture on any page you want without interfering with the page content using the [overlay, remember picture] option as noted out by @Zarko. The new macro drawdots defined below conveniently adds the dots to any page.



                  documentclass{article} 
                  usepackage{tikz}
                  usepackage[paperwidth=12cm, paperheight=25cm, margin=0cm]{geometry}

                  tikzset{
                  mydots/.pic = {
                  foreach y in {0, .5, ..., 23}
                  foreach x in {0, .5, ..., 10}
                  fill[color=black] (x,y) circle (0.05);
                  }
                  }

                  newcommand{drawdots}{%
                  begin{tikzpicture}[overlay, remember picture]
                  pic at ([shift={(1,1)}]current page.south west) {mydots};
                  end{tikzpicture}
                  }

                  begin{document}
                  drawdots
                  clearpage
                  drawdots
                  end{document}


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 1 hour ago

























                  answered 1 hour ago









                  AboAmmar

                  31.1k22780




                  31.1k22780






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461638%2ftikz-with-standalone-pinning-tikz-coordinates-to-page-cm%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

                      Lallio

                      Futebolista

                      Jornalista