# How to export vector images from TeXworks

I use TeXworks to write pseudo-codes. How can I export the codes into a vector image such as in .emf? The image should have a size fit for the codes. For example, if the codes only takes half page, the image should be half-page large instead of a whole page with half page blank space.

-
find a essentially the same question here: tex.stackexchange.com/questions/18836/export-algorithm-as-pdf – pegausbupt Jul 5 '12 at 1:18

You can use the standalone documentclass to create a pdf exactly the size of your pseudocode example. Then you can either include the pdf directly into another tex document via \includegraphics{}. Or you can open the pdf in a vector graphics software, like Adobe Illustrator, Corel Draw or Inkscape. Inkscape can open pdf and export to emf.

A MWE for a pseudocode standalone document could look like this:

\documentclass{standalone}
\usepackage{listings}
% ==== ==== ==== ====
\begin{document}
\begin{lstlisting}
If a=true then
x=5;
elseif b=true then
x=7;
end if;
\end{lstlisting}
\end{document}

-