1

I'm using the tikz2pdf script, which I think internally uses the standalone class, to compile my tikz and pgfplots figures.

Say, I have this simple example:

\begin{tikzpicture}
\begin{scope}

\begin{axis}[
  clip=true,
  axis x line=middle, % use middle to have x-axis at y=0! (bottom is at ymin!)
  axis y line=middle, % also use middle here (left rotates the label || y-axis!)
  grid = major,
    grid style={dashed},
]
\addplot[blue,domain=0:3.1] {sin(deg(x))};
\end{axis}
\end{scope}
\end{tikzpicture}

Here is the image of the PDF generated by tikz2pdf:

test_pdf

Now, the pdf reports this size:

$ pdfinfo test.pdf  | grep 'Page size'
Page size:      217.165 x 184.36 pts

(.. or from evince: 77 × 65 mm) - what I don't understand is:

Where is this default size set? Is there a command/length I could \typeout to terminal, maybe after the \end{axis}, which will tell me what is the current page (or tikzpicture, or pgfplot graphic) size (width and/or height)?


The thing is - in the above image, I would like to keep y-axis as is (so, 65mm), and I'd like to "stretch" the x-axis to some 1.5 times the original (so, to 115.5mm); with otherwise the same ranges as shown on the image above. I'm aware I could use the key width to set a width (e.g. Formatting a pgfplot graph. Thicker bars and total width - TeX - LaTeX Stack Exchange), but I don't know what the initial/default width of the plot is (and the manual doesn't seem to mention that either).

Since I cannot see what is the default width - I'd either have to rely on a different program, say, evince to give me that number; or I'd have to blindly enter values until I see something that I like - both being approaches which I dislike. (I'd rather obtain the actual length that Latex/Tikz/Pgfplots see as width and \typeout it to terminal/log - and then specify the width key based on that value).

sdaau
  • 17,079
  • 1
    See http://tex.stackexchange.com/questions/137356/how-can-i-access-the-size-of-a-tikzpictures-bounding-box-outside-the-tikzpictur but the solution I use now is to put the tikzpicture into a \savebox and use \settoheight and \settowidth. – John Kormylo Feb 16 '14 at 15:16
  • Many thanks for that, @JohnKormylo - the answer in that question seems to work fine for me... I guess I should somehow mark this question as a duplicate, then. Thanks again - cheers! – sdaau Feb 16 '14 at 15:33

0 Answers0