# epstopdf does not find figure within tabularx environment

I am using MiKTeX and running into a very strange issue when using EPS figures within a tabularx environment. Consider the following example:

\documentclass{beamer}

\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{epstopdf}

\graphicspath{{../Icons_Cisco/}}
\epstopdfsetup{outdir=./} %Required since more recent MiKTeX versions - the converted figure is not found otherwise
\begin{document}

\begin{frame}
\frametitle{Test}

\begin{figure}
%\includegraphics{cloud}
\end{figure}

\begin{table}
\begin{tabularx}{\textwidth}{m{0.4\textwidth}m{0.4\textwidth}}
\begin{figure}
\includegraphics{cloud}
\end{figure} & Picture of a cloud\\
\end{tabularx}
\end{table}
\end{frame}

\end{document}


This should produce a beamer slide with a cloud icon (when using the icons from http://www.cisco.com/c/dam/en_us/about/ac50/ac47/3015_eps.zip) and the text "Picture of a cloud". However, it fails to generate an output file with the following error message:

! Package pdftex.def Error: File ./cloud-eps-converted-to.pdf' not found.

The weird thing is, though, when uncommenting the commented line which includes the cloud icon outside the tabularx environment, I get a slide with two cloud icons. I presume that the EPS to PDF conversion is run only once per file, but I cannot find an explanation why it does not work inside the tabularx environment.

Is this a known issue or am I missing something obvious? Adding extra figures to my presentations is not really an option.

• Why not converting the files before compilation? – user31729 Feb 5 '17 at 10:49
• There are a lot of files and it is more convenient to have them converted on the fly. Besides, I am curious why the tabularx environment makes the conversion fail. – Andreas Unterweger Feb 5 '17 at 10:51
• FWIW, I can replicate the issue you're reporting when compiling your code with pdfLaTeX, but not with LuaLaTeX. – Mico Feb 5 '17 at 10:51
• @AndreasUnterweger: Does it work with a non-beamer class? – user31729 Feb 5 '17 at 10:52
• @Mico yes that's because newer luatex don't use \write to implement shell-escape. – David Carlisle Feb 5 '17 at 11:01

tabularx disables \writes during trials so you can do

\documentclass{beamer}

\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{epstopdf}

\graphicspath{{../Icons_Cisco/}}
\epstopdfsetup{outdir=./} %Required since more recent MiKTeX versions - the converted figure is not found otherwise
\begin{document}

\begin{frame}
\frametitle{Test}

\begin{figure}
%\includegraphics{cloud}
\end{figure}

\let\savedwrite\write
\begin{table}
\begin{tabularx}{\textwidth}{m{0.4\textwidth}m{0.4\textwidth}}
\ifx\savedwrite\write\includegraphics[width=\linewidth]{cloud}\fi
& Picture of a cloud\\
\end{tabularx}
\end{table}
\end{frame}

\end{document}


So that it only does the image on the last run, but really doing the conversion on the fly is an unnecessary complication, I'd just convert the EPS file to PDF once on the commandline before running pdftex, then \includegraphics{cloud}` would use the PDF not the EPS.

• Thanks a lot. This explains the behavior and offers a practical solution. – Andreas Unterweger Feb 5 '17 at 11:03