8

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?

lynxoid
  • 203

1 Answers1

13

Have you tried this with

\pagestyle{emtpy}

just below \begin{document}? This may get rid of something in the footer that pdfcrop is having trouble with.

cmhughes
  • 100,947
qubyte
  • 17,299