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.

6
  • Why //network/... and not just network/...?
    – Werner
    Commented Jan 9, 2014 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
    Commented Jan 9, 2014 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. Commented Jan 9, 2014 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. Commented Jan 9, 2014 at 21:55
  • ...please delete the .aux before generating a new .log.
    – Werner
    Commented Jan 9, 2014 at 21:56

1 Answer 1

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}
1
  • That's exactly what I was looking for. Thanks!
    – user43885
    Commented Jan 10, 2014 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .