# Specifying the size of svg from standalone Tikz figure

I'm currently using Tikz together with the standalone package to generate vector graphics, that I convert from pdf to svg using pdf2sg.

To draw circuits I'm using circuitikz, but the question is about sizing Tikz figures in general. For reference, this is how my figures look:

\documentclass[convert = false]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0, 2) to [battery1] (0, 0);
\draw (0, 2) to[R, l=$R_\mathrm{1}$] (3, 2);
\draw (3, 2) to[D, l=$D_\mathrm{1}$] (3, 0);
\draw (3, 0) -- (0, 0);
\end{circuitikz}
\end{document}


When I open up the resulting .svg file, the dimensions are set to width="127.815pt" and height="77.858pt"

Is there an option within Tex to specify the size of the figure I'm creating with Tikz?

Edit: Changed the word from "determine" to "specify" to clarify my intentions.

You can use the adjustbox to adjust the size of anything, including tikzpictures ans circuitikz.

\documentclass[convert = false]{standalone}
\usepackage[american]{circuitikz}
\begin{document}
\begin{circuitikz}
\draw (0, 2) to [battery1] (0, 0);
\draw (0, 2) to[R, l=$R_\mathrm{1}$] (3, 2);
\draw (3, 2) to[D, l=$D_\mathrm{1}$] (3, 0);
\draw (3, 0) -- (0, 0);
\end{circuitikz}
\end{document}


\documentclass[convert = false]{standalone}
\usepackage[american]{circuitikz}
\usetikzlibrary{calc}
\tikzset{every picture/.append style={execute at end picture={
\path let \p1=($(current bounding box.north east)-(current bounding box.south west)$) in \pgfextra{\message{x dimension=\x1, y dimension=\y1^^J}};}}}
\begin{document}
\begin{circuitikz}
\draw (0, 2) to [battery1] (0, 0);
\draw (0, 2) to[R, l=$R_\mathrm{1}$] (3, 2);
\draw (3, 2) to[D, l=$D_\mathrm{1}$] (3, 0);
\draw (3, 0) -- (0, 0);
\end{circuitikz}
\end{document}


yields the message

x dimension=124.65718pt, y dimension=76.92181pt

• Hi, I think I should've used a different phrasing. Is it possible to specify what dimensions I want the final figure to have? As in, can I set a x and y value that Tikz will then try to follow? Ultimately, I would like be able to scale up the svg by some factor. – Rasmus Källqvist Sep 28 '19 at 23:22
• @RasmusKällqvist You can use the adjustbox package to achieve this, see my update. – user194703 Sep 28 '19 at 23:33
• @SchrödingersCat That package did the trick! The background to the question was that I wanted to use this in web layouting, so this helps tremendously. – Rasmus Källqvist Sep 28 '19 at 23:42