Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to use epstopdf to convert EPS files to PDF on the fly, yet I can't get it to work with the tabularx package.

In summary, can anyone tell my why the following example works?

\documentclass[pdftex,10pt,a4paper]{article}
\usepackage[pdftex]{graphicx}
\def\pdfshellescape{1}
\usepackage{epstopdf}
\usepackage{amssymb,amsmath, amsfonts}
\usepackage{longtable}
\usepackage{ltablex}
\usepackage{tabularx}


\def\pth{X:/Results/results/pictures}
\def\ig{\includegraphics[scale=0.8,keepaspectratio]}


\begin{document}

\begin{longtable}{|c|}
\ig{\pth/result5}\\
\end{longtable}

\end{document}

And when I replace:

\begin{longtable}{|c|}
\ig{\pth/result5}\\
\end{longtable}

with:

\begin{tabularx}{\linewidth}{X}
\ig{\pth/result5}\\
\end{tabularx}

It no longer compiles?

I receive the following error:

! Package pdftex.def Error: File
`X:/Research/Results/lung_project_results/pict
ures/result5-eps-converted-to.pdf' not found.

I'm using Miktex 2.9.4476

When I add \listfiles, the log file outputs the following:

*File List*  
 article.cls    2007/10/19 v1.4h Standard LaTeX document class  
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)  
graphicx.sty    1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)  
  keyval.sty    1999/03/16 v1.13 key=value parser (DPC)  
graphics.sty    2009/02/05 v1.0o Standard LaTeX Graphics (DPC,SPQR)  
    trig.sty    1999/03/16 v1.09 sin cos tan (DPC)  
graphics.cfg    2007/01/18 v1.5 graphics configuration of teTeX/TeXLive  
  pdftex.def    2011/05/27 v0.06d Graphics/color for pdfTeX  
infwarerr.sty    2010/04/08 v1.3 Providing info/warning/error messages (HO)  
 ltxcmds.sty    2011/11/09 v1.22 LaTeX kernel commands for general use (HO)  
epstopdf.sty    2010/02/09 v2.5 Conversion with epstopdf on the fly (HO)  
epstopdf-base.sty    2010/02/09 v2.5 Base part for package epstopdf  
  grfext.sty    2010/08/19 v1.1 Manage graphics extensions (HO)  
kvdefinekeys.sty    2011/04/07 v1.3 Define keys (HO)  
kvoptions.sty    2011/06/30 v3.11 Key value format for package options (HO)  
kvsetkeys.sty    2012/04/25 v1.16 Key value parser (HO)  
etexcmds.sty    2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)  
ifluatex.sty    2010/03/01 v1.3 Provides the ifluatex switch (HO)  
pdftexcmds.sty    2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)  
   ifpdf.sty    2011/01/30 v2.3 Provides the ifpdf switch (HO)  
 amssymb.sty    2009/06/22 v3.00  
amsfonts.sty    2009/06/22 v3.00 Basic AMSFonts support  
 amsmath.sty    2000/07/18 v2.13 AMS math features  
 amstext.sty    2000/06/29 v2.01  
  amsgen.sty    1999/11/30 v2.0  
  amsbsy.sty    1999/11/29 v1.2d    
  amsopn.sty    1999/12/14 v2.01 operator names  
 ltablex.sty    1995/11/06 v1.0 Modified tabularx  
longtable.sty    2004/02/01 v4.11 Multi-page Table package (DPC)  
tabularx.sty    1999/01/07 v2.07 `tabularx' package (DPC)  
   array.sty    2008/09/09 v2.4c Tabular extension package (FMi)  
share|improve this question
    
It compiles for me. I have put the .eps figure in the same directory as the .tex file. –  Harish Kumar Jan 22 '13 at 2:16
1  
Which tex distribution do you use? Is it up to date? Add \listfiles as first line in your MWE and check the log file for the versions of the used packages ... –  Kurt Jan 22 '13 at 3:41
    
While \def\pdfshellescape{1} may not be the cause for the problem, it's a very bad idea nonetheless. –  egreg Jan 22 '13 at 7:48
    
@ Harish Kumar: Putting them in the same directory still doesn't work for me. But in any case, I would prefer not to do this. –  Neil Jan 22 '13 at 18:38

1 Answer 1

up vote 3 down vote accepted

Despite comments saying it works, it doesn't:-) (I suspect that they had a converted pdf file available from the successful run with longtable.)

tabularx disables \write during its trial runs (otherwise labels and index entries etc would be written out multiple times and cause havoc) however that means that the \write18 to trigger the conversion is disabled until the final run.

If you ignore the error and just hit <return> to carry on you will see that on the final run the image does get converted and included, however this is not ideal it is annoying and it means that during the trial runs the image width is not available so the width calculations may go wrong.

You could enable \write again or just enable it for \write18 but I think the safest thing to do is not touch tabularx and just do an initial setting of the image in a throw away box register, so that the image gets converted before the table.

\documentclass[pdftex,10pt,a4paper]{article}
\usepackage[pdftex]{graphicx}

\usepackage{epstopdf}
\usepackage{amssymb,amsmath, amsfonts}
\usepackage{longtable}
\usepackage{ltablex}
\usepackage{tabularx}



\def\ig{\includegraphics[scale=0.8,keepaspectratio]}


\begin{document}

%\begin{longtable}{|c|}
\sbox0{\ig{result5}}
\begin{tabularx}{.5\textwidth}{X}
\ig{result5}\\
%\end{longtable}
\end{tabularx}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.