6

When drawing with standalone document class, the output image will automatically centered. for example, if I draw a circle with 5cm, then the image output will be 5cm. How can I keep 5cm circle in the center but output image size keep to 10cm? I know the border=5cm option but I wish to use some command to define the picture dimension then I can always get the exact size, say 10cmx10cm.

4
  • 1
    What do you mean by picture dimension? Do you want the paper size? You can use geometry package to control everything, paper size, margins, and so on.
    – Sigur
    Dec 5, 2018 at 19:31
  • I mean use fixed picture size to draw something on it.
    – lucky1928
    Dec 5, 2018 at 19:33
  • So, you want to draw any picture on a page sized 10x10?
    – Sigur
    Dec 5, 2018 at 19:34
  • yes, use specific size then draw on it.
    – lucky1928
    Dec 5, 2018 at 19:36

3 Answers 3

8

Add a bounding box to the tikzpicture. Then you can freely arrange objects therein.

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
  \useasboundingbox (-5,-5) rectangle (5,5);
  \filldraw (-5,-5) rectangle ++(1,1);
  \draw(0,0)circle(2.5);
\end{tikzpicture}
\end{document}
3

How about this?

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\node[rectangle,minimum size=20cm]{};
\draw(0,0)circle(5cm);
\end{tikzpicture}
\end{document}

enter image description here

1
  • @lucky1928 This comment was for my answer?
    – nidhin
    Dec 5, 2018 at 19:36
3

Add a 2.5 cm border on each side with the standalone option border=2.5cm, since 2.5cm+5cm+2.5 cm=10cm.

\documentclass[tikz,border=2.5cm]{standalone}
\begin{document}
\tikz\draw(0,0)circle(2.5cm);
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .