I want to compile a pseudocode for an algorithm into a separate pdf and then include it into my main document as a figure. However, the compiled pseudocode gets compiled into a pdf with margins and I have not been able to crop it (other than manually) to fit into a tighter box. I used pdfcrop to try to get rid of the white space, but it only removes white space at the top, left, and right, but not the bottom. I would like to be able to compile it so that it has no margins and not to have to do it manually every time I change a comma in the pseudocode.
Here is an example:
\documentclass[10pt]{article}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}[h!]
\begin{algorithmic}
\caption{Precomputing densities}
\label{alg:densities}
\FOR{$i = 1 \to n$}
\STATE $\mathrm{sums}[i][i] \gets 0$
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}
Any advice?
pdfcropprobably includes the page number. Use\pagestyle{empty}for such stand-alone instances. – Werner Nov 03 '11 at 15:53standalonebut when I try it I get "LaTeX Error: Not in outer par mode." – N.N. Nov 03 '11 at 16:00algorithmenvironment being a float, see http://tex.stackexchange.com/questions/33566/how-to-compile-pseudocode-into-pdf-without-margins – N.N. Nov 03 '11 at 16:06algorithmenvironment you can compile it. You lose the caption though. – qubyte Nov 18 '11 at 02:56