# Strange “Too many files” error with pdfTeX

That is the auto-pst-pdf message I get when I compile the MWE below with the pdfTeX engine. I have just (meaning, as of this post's date) reinstalled my entire MikTeX 2.9 system with a complete distribution. My operating system is Windows Xp. I haven't been able to find any useful information on the web about this error message. Am I doing something wrong here? Any help would be appreciated.

\documentclass{memoir}

\usepackage{ifpdf,ifxetex}
\usepackage[pdfcrop = {--hires}]{auto-pst-pdf}
\ifpdf\else\usepackage{pstricks}\fi

\begin{document}
\begin{pspicture}(0,0)(1,1)
\psframe*[linecolor = red](0,0)(1,1)
\end{pspicture}
Hi!
\end{document}


EDIT: The error message seems to be bound to pdfcrop. The moment I delete the pdfcrop = {--hires} option, the problem disappears. But now there is the inconvenience that I do not get a tightly cropped picture.

-
I get no error with pdflatex, xelatex and lualatex. I have TeX Live 2013. But I get no picture with pdflatex and lualatex –  egreg Apr 6 '14 at 19:38
@egreg: Right. In my system the error is somewhat concealed within the scope for the auto-pst-pdf messages. The document is compiled and the auto-pst-pdf files are created until pdfcrop is to come in. The error appears at that stage. There is no final pdf file with the cropped picture and the latter is not embedded in the document. That's what I get. I have just installed an updated version of Ghostscript but the problem remains the same. –  Marcos Apr 6 '14 at 19:43
@egreg: Thus, I guess what you get is actually a replication of the issue I depict in my post. –  Marcos Apr 6 '14 at 19:49
What I found out is that pdfcrop=--hires works; when you type pdfcrop={--hires} the program is illegally called as pdfcrop hires--hires –  egreg Apr 6 '14 at 20:03
@egreg: Fine! The weird thing is that I had not had such a problem in the past. Could you possibly turn your comment into an answer? –  Marcos Apr 6 '14 at 20:14

This seems to be a issue more about xkeyval than auto-pst-pdf: when you type the option as

pdfcrop = {--hires}


for some reasons the program gets called as

pdfcrop hires--hires "<filename>-autopp.pdf" "<filename>-pics.pdf"


which is incorrect. If braces are omitted

pdfcrop = --hires


or the space following = is omitted

pdfcrop ={--hires}


all should go well.

-