# Create macro for insertion of inkscape figure with width as a variable

To input figures directly from Inkscape I write this in a figure environment

\centering
\def\svgwidth{0.5\columnwidth}
\input{name.pdf_tex}


However, I would like to be able to just use a macro instead where the desired width is a variable, but I'm not sure how to do this?

-

## 1 Answer

\newcommand\myimg[2]{%
\centering
\def\svgwidth{#1}%
\input{#2}}

\myimg{0.5\columnwidth}{name.pdf_tex}

-
Thanks, exactly what I was looking for. –  Anders Oct 17 '12 at 14:38