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.
tikz-pgf positioning coordinates
add a comment |
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.
tikz-pgf positioning coordinates
1
isn't this simpler to achieve with standard document class likearticle? fortikztry to useoverlayansremember picturefor exact positioning your dots on page.
– Zarko
1 hour ago
add a comment |
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.
tikz-pgf positioning coordinates
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
tikz-pgf positioning coordinates
asked 2 hours ago
jmite
5841518
5841518
1
isn't this simpler to achieve with standard document class likearticle? fortikztry to useoverlayansremember picturefor exact positioning your dots on page.
– Zarko
1 hour ago
add a comment |
1
isn't this simpler to achieve with standard document class likearticle? fortikztry to useoverlayansremember picturefor 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
add a comment |
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}
add a comment |
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}

add a comment |
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}
add a comment |
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}
add a comment |
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}
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}
answered 1 hour ago
marmot
77.7k487166
77.7k487166
add a comment |
add a comment |
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}

add a comment |
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}

add a comment |
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}

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}

edited 1 hour ago
answered 1 hour ago
AboAmmar
31.1k22780
31.1k22780
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
1
isn't this simpler to achieve with standard document class like
article? fortikztry to useoverlayansremember picturefor exact positioning your dots on page.– Zarko
1 hour ago