0

This question already has an answer here:

For a long time I used to losslessly convert muliple PNGs to a single PDF using the following template:

\documentclass[a4paper]{article}
\usepackage{pdfpages}
\usepackage[margin=0pt]{geometry}
\begin{document}
\pagestyle{empty}
\enlargethispage*{0cm}
%
%
\centering{
\includegraphics[width=.99\paperwidth,totalheight=.99\paperheight,keepaspectratio]{img1.png}
\clearpage
\includegraphics[width=.99\paperwidth,totalheight=.99\paperheight,keepaspectratio]{img2.png}
\clearpage
}
\end{document}

Lately, I've been getting (on Ubuntu 12.04)

! Missing $ inserted.
<inserted text> 
                $
l.10 ...ht,keepaspectratio]{img1.png}

What's wrong, what's changed? Alternatives?

Update: turns out this only happens with filenames with spaces (so "img 1.pdf", not img1.pdf). How can this be avoided?

marked as duplicate by texenthusiast, Przemysław Scherwentke, Tom Bombadil, Robert, Stefan Kottwitz Nov 22 '13 at 7:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I don't see any reason why this should fail. Is this really the document you tried? Can you show the log-file? – Ulrike Fischer Nov 21 '13 at 11:27
  • Your code compiles with any problems. – Chris Nov 21 '13 at 11:38
  • Did you add any package by hand, recently? – egreg Nov 21 '13 at 11:39
  • 1
    Isn't the grffile package the normal fix to this? But in general, don;t use spaces in file or folder names. – daleif Nov 21 '13 at 13:08
  • 1
    \usepackage{graphicx} \usepackage[space]{grffile} solves the spaces-in-filenames issue. I did not realize this was the problem... – dan3 Nov 21 '13 at 17:59

Browse other questions tagged or ask your own question.