Why does standalone not detect the TikZ crop correctly?
up vote
14
down vote
favorite
This small example
documentclass{standalone}
usepackage{xltxtra,textcomp,graphicx,color,tikz}
usepackage[absolute,overlay]{textpos}
begin{document}
begin{tikzpicture}
clip (0,0) rectangle (12.8cm, 1.15cm);
draw (0,0) grid (12.8cm, 1.15cm);
end{tikzpicture}
end{document}
generates this output:

Where is the margin / extra space on the left side coming from, and how can I remove it? Shouldn't clip take care of that?
tikz-pgf margins standalone
add a comment |
up vote
14
down vote
favorite
This small example
documentclass{standalone}
usepackage{xltxtra,textcomp,graphicx,color,tikz}
usepackage[absolute,overlay]{textpos}
begin{document}
begin{tikzpicture}
clip (0,0) rectangle (12.8cm, 1.15cm);
draw (0,0) grid (12.8cm, 1.15cm);
end{tikzpicture}
end{document}
generates this output:

Where is the margin / extra space on the left side coming from, and how can I remove it? Shouldn't clip take care of that?
tikz-pgf margins standalone
You don't needgraphicx,colorif you're loading TikZ. You almost certainly shouldn't be loading bothxltxtraandtextcomp. That suggests some level of confusion. Do you really wanttextposfor a standalone TikZ picture?
– cfr
Jun 7 '16 at 22:21
add a comment |
up vote
14
down vote
favorite
up vote
14
down vote
favorite
This small example
documentclass{standalone}
usepackage{xltxtra,textcomp,graphicx,color,tikz}
usepackage[absolute,overlay]{textpos}
begin{document}
begin{tikzpicture}
clip (0,0) rectangle (12.8cm, 1.15cm);
draw (0,0) grid (12.8cm, 1.15cm);
end{tikzpicture}
end{document}
generates this output:

Where is the margin / extra space on the left side coming from, and how can I remove it? Shouldn't clip take care of that?
tikz-pgf margins standalone
This small example
documentclass{standalone}
usepackage{xltxtra,textcomp,graphicx,color,tikz}
usepackage[absolute,overlay]{textpos}
begin{document}
begin{tikzpicture}
clip (0,0) rectangle (12.8cm, 1.15cm);
draw (0,0) grid (12.8cm, 1.15cm);
end{tikzpicture}
end{document}
generates this output:

Where is the margin / extra space on the left side coming from, and how can I remove it? Shouldn't clip take care of that?
tikz-pgf margins standalone
tikz-pgf margins standalone
asked Oct 13 '13 at 18:03
barbaz
64011018
64011018
You don't needgraphicx,colorif you're loading TikZ. You almost certainly shouldn't be loading bothxltxtraandtextcomp. That suggests some level of confusion. Do you really wanttextposfor a standalone TikZ picture?
– cfr
Jun 7 '16 at 22:21
add a comment |
You don't needgraphicx,colorif you're loading TikZ. You almost certainly shouldn't be loading bothxltxtraandtextcomp. That suggests some level of confusion. Do you really wanttextposfor a standalone TikZ picture?
– cfr
Jun 7 '16 at 22:21
You don't need
graphicx,color if you're loading TikZ. You almost certainly shouldn't be loading both xltxtra and textcomp. That suggests some level of confusion. Do you really want textpos for a standalone TikZ picture?– cfr
Jun 7 '16 at 22:21
You don't need
graphicx,color if you're loading TikZ. You almost certainly shouldn't be loading both xltxtra and textcomp. That suggests some level of confusion. Do you really want textpos for a standalone TikZ picture?– cfr
Jun 7 '16 at 22:21
add a comment |
1 Answer
1
active
oldest
votes
up vote
15
down vote
accepted
use
documentclass[
tikz,
%border=1pt
]{standalone}
With the tikz option the standalone class knows that it should crop the
environment(s) tikzpicture and not only the given text box.
With the border option you can better control the result
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:documentclass[border=10pt]{standalone}.
– Rubens
Jul 22 '14 at 21:56
2
@Rubens:border=...doesn't solve the problem with thetikzkey ...
– Herbert
Jul 23 '14 at 4:40
1
Alternatively, one could usemulti=tikzpicture,varwidth=falseinstead. The only difference according to the documentation is that standalone would not load thetikzpackage itself thus one has to do that manually. However, this might help in some situations, e.g., if one usesusepackage[svgnames]{xcolor}which has to be loaded beforetikzor else results inLaTeX Error: Option clash for package xcolor.(which would be impossible if the document class has loadedtikzalready.
– stefanct
Nov 10 '17 at 13:58
|
show 1 more comment
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
});
}
});
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%2f138677%2fwhy-does-standalone-not-detect-the-tikz-crop-correctly%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
up vote
15
down vote
accepted
use
documentclass[
tikz,
%border=1pt
]{standalone}
With the tikz option the standalone class knows that it should crop the
environment(s) tikzpicture and not only the given text box.
With the border option you can better control the result
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:documentclass[border=10pt]{standalone}.
– Rubens
Jul 22 '14 at 21:56
2
@Rubens:border=...doesn't solve the problem with thetikzkey ...
– Herbert
Jul 23 '14 at 4:40
1
Alternatively, one could usemulti=tikzpicture,varwidth=falseinstead. The only difference according to the documentation is that standalone would not load thetikzpackage itself thus one has to do that manually. However, this might help in some situations, e.g., if one usesusepackage[svgnames]{xcolor}which has to be loaded beforetikzor else results inLaTeX Error: Option clash for package xcolor.(which would be impossible if the document class has loadedtikzalready.
– stefanct
Nov 10 '17 at 13:58
|
show 1 more comment
up vote
15
down vote
accepted
use
documentclass[
tikz,
%border=1pt
]{standalone}
With the tikz option the standalone class knows that it should crop the
environment(s) tikzpicture and not only the given text box.
With the border option you can better control the result
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:documentclass[border=10pt]{standalone}.
– Rubens
Jul 22 '14 at 21:56
2
@Rubens:border=...doesn't solve the problem with thetikzkey ...
– Herbert
Jul 23 '14 at 4:40
1
Alternatively, one could usemulti=tikzpicture,varwidth=falseinstead. The only difference according to the documentation is that standalone would not load thetikzpackage itself thus one has to do that manually. However, this might help in some situations, e.g., if one usesusepackage[svgnames]{xcolor}which has to be loaded beforetikzor else results inLaTeX Error: Option clash for package xcolor.(which would be impossible if the document class has loadedtikzalready.
– stefanct
Nov 10 '17 at 13:58
|
show 1 more comment
up vote
15
down vote
accepted
up vote
15
down vote
accepted
use
documentclass[
tikz,
%border=1pt
]{standalone}
With the tikz option the standalone class knows that it should crop the
environment(s) tikzpicture and not only the given text box.
With the border option you can better control the result
use
documentclass[
tikz,
%border=1pt
]{standalone}
With the tikz option the standalone class knows that it should crop the
environment(s) tikzpicture and not only the given text box.
With the border option you can better control the result
edited Dec 6 at 16:11
answered Oct 13 '13 at 18:11
Herbert
267k23407716
267k23407716
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:documentclass[border=10pt]{standalone}.
– Rubens
Jul 22 '14 at 21:56
2
@Rubens:border=...doesn't solve the problem with thetikzkey ...
– Herbert
Jul 23 '14 at 4:40
1
Alternatively, one could usemulti=tikzpicture,varwidth=falseinstead. The only difference according to the documentation is that standalone would not load thetikzpackage itself thus one has to do that manually. However, this might help in some situations, e.g., if one usesusepackage[svgnames]{xcolor}which has to be loaded beforetikzor else results inLaTeX Error: Option clash for package xcolor.(which would be impossible if the document class has loadedtikzalready.
– stefanct
Nov 10 '17 at 13:58
|
show 1 more comment
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:documentclass[border=10pt]{standalone}.
– Rubens
Jul 22 '14 at 21:56
2
@Rubens:border=...doesn't solve the problem with thetikzkey ...
– Herbert
Jul 23 '14 at 4:40
1
Alternatively, one could usemulti=tikzpicture,varwidth=falseinstead. The only difference according to the documentation is that standalone would not load thetikzpackage itself thus one has to do that manually. However, this might help in some situations, e.g., if one usesusepackage[svgnames]{xcolor}which has to be loaded beforetikzor else results inLaTeX Error: Option clash for package xcolor.(which would be impossible if the document class has loadedtikzalready.
– stefanct
Nov 10 '17 at 13:58
2
2
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
– barbaz
Oct 14 '13 at 9:38
1
1
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
see documentation page 7
– Herbert
Oct 14 '13 at 9:41
This reference shows a simple solution:
documentclass[border=10pt]{standalone}.– Rubens
Jul 22 '14 at 21:56
This reference shows a simple solution:
documentclass[border=10pt]{standalone}.– Rubens
Jul 22 '14 at 21:56
2
2
@Rubens:
border=... doesn't solve the problem with the tikz key ...– Herbert
Jul 23 '14 at 4:40
@Rubens:
border=... doesn't solve the problem with the tikz key ...– Herbert
Jul 23 '14 at 4:40
1
1
Alternatively, one could use
multi=tikzpicture,varwidth=false instead. The only difference according to the documentation is that standalone would not load the tikz package itself thus one has to do that manually. However, this might help in some situations, e.g., if one uses usepackage[svgnames]{xcolor} which has to be loaded before tikz or else results in LaTeX Error: Option clash for package xcolor. (which would be impossible if the document class has loaded tikz already.– stefanct
Nov 10 '17 at 13:58
Alternatively, one could use
multi=tikzpicture,varwidth=false instead. The only difference according to the documentation is that standalone would not load the tikz package itself thus one has to do that manually. However, this might help in some situations, e.g., if one uses usepackage[svgnames]{xcolor} which has to be loaded before tikz or else results in LaTeX Error: Option clash for package xcolor. (which would be impossible if the document class has loaded tikz already.– stefanct
Nov 10 '17 at 13:58
|
show 1 more comment
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
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%2f138677%2fwhy-does-standalone-not-detect-the-tikz-crop-correctly%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
You don't need
graphicx,colorif you're loading TikZ. You almost certainly shouldn't be loading bothxltxtraandtextcomp. That suggests some level of confusion. Do you really wanttextposfor a standalone TikZ picture?– cfr
Jun 7 '16 at 22:21