11

How te remove the white space on the right side of the figure? I need to crop the figure and control the padding around it..

Ex: How to generate a series of \paused stand-alone TikZ images?

  • 2
    Welcome to TeX.SX! Remove the white space from which figure? Normally TikZ does not add white space around its pictures. In the link you posted there is no extra white space, the picture is being drawn in the slide, so the "extra white space" is actually the beamer slide. Could you be more specific? – Guilherme Zanotelli Dec 08 '16 at 07:45
  • Thanks :).. actually what i need is to resize the slide size to take the exact size of the tikzfigure. Originally that is why I used beamer with standalone class. – Ahmed Hawary Dec 08 '16 at 09:42

1 Answers1

20

The standalone package by default crops the page to its contents. There is also a border option (also called margin, which I think is a better name) that allows you to put a white space margin around it. You can even specify all four margins differently. Here is an example:

\documentclass[tikz, margin=5mm]{standalone}

\begin{document}
\tikz \draw[thick,rounded corners=8pt]
(0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0);
\end{document}

enter image description here

N.B. The gray border is not part of the file. It is the background of the viewer, included to show the size of the resulting output.

  • Great. I am trying to use the same solution to create a beamer presentation showing that shape being drawn step by step, I need to get the same output without the beamer standard slide size and still I need the to fix the shape position over all slides. – Ahmed Hawary Dec 12 '16 at 09:54
  • \documentclass[beamer, margin=5mm]{standalone} \usepackage{tikz}

    \begin{document} \begin{standaloneframe} \begin{tikzpicture} \tikz \draw[thick,rounded corners=8pt] (0,0) -- (0,2) -- (1,3.25); \end{tikzpicture} \end{standaloneframe}

    \begin{standaloneframe} \begin{tikzpicture} \tikz \draw[thick,rounded corners=8pt] (0,0) -- (0,2) -- (1,3.25) -- (2,2) -- (2,0) -- (0,2) -- (2,2) -- (0,0) -- (2,0); \end{tikzpicture} \end{standaloneframe}

    \end{document}

    – Ahmed Hawary Dec 12 '16 at 09:55