0

I'd like to create a PDF file which, for now, contains only the image output I've generated in stata.

The images are all located in a folder called \network\location and all follow a common naming convention, file1,file2,...,filen.

The latex engine i want to use is pdfLaTex within Teworks.

I've written the following code to generate the file via pdflatex, but the process bombs before completion. The specific error message is "Missing $ inserted, $

Any input would be greatly appreciated.

\documentclass{article}
\usepackage{graphicx}
\usepackage{pgffor}
\begin{document}
\begin{figure}
  \foreach\x in {1,2,...,10}{%
    \includegraphics[height=5.4cm]{//network/location/file\x}
  }
\end{figure}  
\end{document}

Thanks for any help.

  • Why //network/... and not just network/...? – Werner Jan 09 '14 at 21:34
  • You should run latex > dvips > ps2pdf as the compilation sequence, not pdflatex. The latter cannot include EPS images. Or you could convert the images from EPS to PDF first, then run with pdflatex, or convert on-the-fly using the epstopdf package (\usepackage{epstopdf}, EPS figures with pdflatex). – Werner Jan 09 '14 at 21:38
  • @Werner that's true but does not explain the error described. I get no error (other than missing file 10 times) if I run the supplied example document. – David Carlisle Jan 09 '14 at 21:54
  • do you get the described error if you run the exact tex file posted? (I do not) if you do can you add the log file to your question. – David Carlisle Jan 09 '14 at 21:55
  • ...please delete the .aux before generating a new .log. – Werner Jan 09 '14 at 21:56
  • I figured out the issue -- for now. i had to include ".eps" at the end of the filename. I assumed it would pic up any and all images. My new issue is how to have each image show up on a new page. Completely green to latex. Thanks for any help.

    I solved the eps issue by using the epstopdf package

    – user43885 Jan 09 '14 at 21:57

1 Answers1

1

To answer your comment query, do you want something like this (plus the epstopdf package etc.):

\documentclass{article}
\usepackage{graphicx}
\usepackage{pgffor}
\begin{document}
  \foreach\x in {1,2,...,10}{%
  \begin{figure}
      \includegraphics[height=5.4cm]{//network/location/file\x}
      \caption{file\x}
   \end{figure}\clearpage}
\end{document}
cfr
  • 198,882