Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This is the reciprocal to How can I create a pdf document exactly as big as my tikz picture?. My understanding of all the answers there is that they extract a picture from a TeX document and strip away all the unnecessary space around the edges. My situation is that the picture I'm drawing is bigger than the usual page and I want to resize the page to be big enough to fit it.

More specifically, I'm drawing a picture using TikZ (though that's not important, I guess) and the document consists only of that picture. As I draw more and more, it gets bigger and bigger (current size is about 80cm square). I use the geometry package to keep enlarging the paper size, but it would be nice if TeX could handle that automatically.

(It is possible that one of the answers to How can I create a pdf document exactly as big as my tikz picture? can do this, but it wasn't obvious from reading them.)

share|improve this question

1 Answer 1

up vote 8 down vote accepted

Your approach seems the right one for me. Just set the paper size to \maxdimen and let preview or standalone scale it down:

\documentclass{standalone}
\usepackage[paperwidth=\maxdimen,paperheight=\maxdimen]{geometry}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
 \draw (0,0) rectangle (100cm,100cm);
 \draw (0,0) -- (100cm,100cm);
\end{tikzpicture}
\end{document}

Make sure it is really just the tikzpicture no empty lines around it. This isn't required when using preview directly:

\documentclass{article}
\usepackage[paperwidth=\maxdimen,paperheight=\maxdimen]{geometry}
\usepackage{tikz}
\usepackage[tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}
 \draw (0,0) rectangle (100cm,100cm);
 \draw (0,0) -- (100cm,100cm);
\end{tikzpicture}
\end{document}
share|improve this answer
    
So \maxdimen is some internal constant that determines just how big dimensions can be, is that right? ... ah, yes, I see it in latex.ltx: \newdimen\maxdimen .... % the largest legal <dimen>. Useful to know about. –  Loop Space Mar 11 '11 at 9:50
    
@Andrew: TeX seems to use 31-bit signed integers for dimensions. The lower 16 bits are for the fractional part. No idea what happens with the 32nd bit. It's a pity that eTeX isn't expanding it to 64 bit :-) –  Martin Scharrer Mar 11 '11 at 10:19
1  
I just wanted to see what that length translated to in "normal" units, so searched for "tex length conversion". The first hit offered to convert TeX points to ... wait for it ... arms lengths! (There are about 1991 TeX points in an arm.) –  Loop Space Mar 11 '11 at 10:35
    
Okay \maxdimen turns out to be just under 6m. I think that that's big enough for now. –  Loop Space Mar 11 '11 at 10:40
    
@Andrew: Anything larger than 5.758x5.758m must be done using scaling. –  Martin Scharrer Mar 11 '11 at 10:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.