2

I have an old workflow that uses LaTeX itself to process diagrams and plots. I've used this generate hundreds of figures over the years. This has suddenly started producing invalid pdf figure files: they won't open in Acrobat (though they do open in SumatraPDF); including them in a document causes luatex to output several warning messages (invalid compressed object) and a corrupt final file. Strangely, they do seem to work with pdftex.

Compiling this document with lualatex is enough to trigger the problem on my machine.

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=\textwidth]{embed.pdf}
\end{document}

Here is embed.pdf

The figure was initially generated by gnuplot, using the following:

set term postscript eps mono
set output "fig.eps"
plot x**2 title "AAA"

I then created a version with a Greek letter by compiling this document (embed.tex) using latex+dvips

\documentclass{article}
\usepackage{graphicx}
\usepackage{psfrag}
\pagestyle{empty}
\begin{document}
\psfrag{AAA}{\(\alpha\)}
\includegraphics{fig.eps}
\end{document}

Finally, I did

ps2eps --ignoreBB embed.ps
epstopdf embed.eps

to create the pdf figure. Converting embed.eps to pdf using cloudconvert.com does seem to work, so I think the problem is caused by either epstopdf or ghostscript. What's going on here?

I think this old question is probably related, but there is no example pdf file so it's impossible to be sure.

EDIT

It seems increasingly likely that something is going wrong at the very last step (eps2pdf conversion). Here is the eps file that is being converted: embed.eps. What's not clear is whether the issue is limited to my own machine (running texlive 2025 under cygwin).

7
  • 1
    Your initial "embed.pdf" file does not load correctly in Firefox's built-in PDF viewer, and Evince/Papers will not load it at all. If I ignore that file and instead follow your workflow to re-create the embed.pdf from Gnuplot, it works fine in both LuaLaTeX and in PDFLaTeX. (Note: I am using TeX Live 2023, if that ends up being important.) Commented 15 hours ago
  • 4
    well the embed.pdf is clearly broken, both luatex and qpdf reports warnings. Commented 15 hours ago
  • @karlh --- Thanks for trying that. It's looking increasingly likely that something goes wrong at the very last step (epstopdf) on my machine (running texlive 2025 under cygwin). Commented 14 hours ago
  • The specific errors in embed.pdf: $ qpdf --qdf embed.pdf - > /dev/null WARNING: embed.pdf: object 6/0: error reading object: integer out of range converting 30064771072 from a 8-byte signed type to a 4-byte signed type WARNING: embed.pdf (object 8 0, offset 235): stream dictionary lacks /Length key WARNING: embed.pdf (object 8 0, offset 281): attempting to recover stream length WARNING: embed.pdf (object 8 0, offset 281): recovered stream length: 1210 Commented 14 hours ago
  • 1
    Note that if the goal is just to include a Greek letter in gnuplot then you can do that using set termoption enhanced and then using either {/Symbol a} or utf8 α in the title of the plot. Then you can export from gnuplot to pdf directly without the route through eps-psfrag-ps2pdf-epstopdf which could lead to errors as you have experienced now. Commented 10 hours ago

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.