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.
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
A MWE for a pseudocode standalone document could look like this: