I have EPS image files (with spaces in their names) in a directory ../../Images space bla bla bla/. The following MWE simulates the real scenario in a simplified way.
\documentclass{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.list}
a space.eps
b space.png
\end{filecontents*}
\usepackage{grffile}
\parindent=0pt
\usepackage{graphicx}
\newread\reader
\begin{document}
\def\stripend#1 \stop{\unexpanded{#1}}
\openin\reader=\jobname.list\relax
\loop
\read\reader to \x
\unless\ifeof\reader
\section{\x}
\edef\x{%
\unexpanded{%
\includegraphics[width=\textwidth,height=\textheight,keepaspectratio]%
}%
{../../Images space bla bla bla/\expandafter\stripend\x \stop}%
}%
\x
\repeat
\closein\reader
\end{document}
Because I want to import all image formats and manipulate them with PSTricks, I have to use latex-dvips-ps2pdf sequence. xelatex is not my option because it runs much slower. Shortly speaking, the compilation fails. How to solve it?
Note that the available questions and the corresponding answers in this site do not help. I have read all, none works.
"to quote filenames more completely. – David Carlisle Sep 27 '12 at 09:20grffilepackage. I suspect that also your current code will work with that package. – egreg Sep 27 '12 at 10:20latex-dvips-ps2pdf. – kiss my armpit Sep 29 '12 at 17:16dvipsaccepts file names with spaces? I'm not. – egreg Sep 29 '12 at 17:41dvips. Don't use spaces for any reason. – egreg Sep 29 '12 at 17:49