Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

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

1 Answer 1

up vote 5 down vote accepted

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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.