# pdflatex “Command token too long” error

I am getting this error trying to compile a latex document using pdflatex. I've stripped the tex file down to this

\documentclass[letterpaper,oneside,12pt]{article}
\usepackage[letterpaper,textwidth=7.5in,textheight=9.5in]{geometry}
\usepackage{graphicx}

\begin{document}
\begin{figure}[H]
\includegraphics{figures/Jan25/svdDir_svdCompare1.pdf}
\end{figure}

\end{document}


This produces the final output I want but still gives that error which is hugely annoying because I use vim-latex and the error causes it to take me to another window which I then have to close out and switch back to the tex file every time I compile.

The pdf file was generated from a Matlab figure; a process which I do several times per day with no problem. I did try regenerating the file but it still gives that error. I've also tried copying it and renaming but that also doesn't change anything.

-
If the problem is the image, one would have to see (and inspect) it in order to assess what the problem might be. As is, with my own replacement image, your MWE compiles without problem. – Werner Jan 26 '12 at 6:47
Which version of pdfTeX are you using on which OS? And please post the actual lines from the logfile. – Martin Schröder Jan 26 '12 at 13:15
I'm getting this error too, and it is indeed really annoying. It goes to stderr instead of going to the same place all of pdflatex's other error output goes. Not only is that a lame thing for a library like poppler to do, but it also means that I can't tell where the error is occurring. I have several hundred PDFs in my document, and there is no way to tell which of them is causing the error. – Ben Crowell Mar 3 '12 at 16:56
I've filed a bug: sarovar.org/tracker/… – Ben Crowell Mar 3 '12 at 17:14
Ryan0270, can you supply the pdf file that causes the error so we can attach it to the bug report on sarovar.org? In my own case, I can't tell which of the hundreds of figures in my book is the one it's complaining about. – Ben Crowell Mar 3 '12 at 21:55

## migrated from stackoverflow.comJan 26 '12 at 11:57

Most likely your included PDF is broken somehow. The only part in pdftex that throws this error message seems to be the Lexer in poppler when reading PDFs. Can you put up the PDF somewhere online for examination?

-

What size is your image? That PDF file may be bigger than the allowed width. Have you tried resizing image? For instance:

\documentclass[letterpaper,oneside,12pt]{article}
\usepackage[letterpaper,textwidth=7.5in,textheight=9.5in]{geometry}
\usepackage{graphicx}

\begin{document}
\begin{figure}[H]
\includegraphics[width=5in,height=1in]{figures/Jan25/svdDir_svdCompare1.pdf}
\end{figure}

\end{document}

-
 I was originally specifying width=0.45\textwidth when I got the error. It is actually sized to 8in x 6in default anyhow so that shouldn't make a difference. – ryan0270 Jan 26 '12 at 5:11