I'm compiling the following file hello.tex, which contains a picture:
\documentclass[12pt]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=5cm, natwidth=1079, natheight=377]{x.png}
\end{document}
This produces the correct output with xelatex hello.tex. However, for various reasons I need to use latex+dvips+ps2pdf:
latex hello.tex
dvips hello.dvi
ps2pdf hello.ps
However, the last step produces an error:
C:\Users\Bai\Desktop>ps2pdf hello.ps
Error: /syntaxerror in (binary token, type=137)
Operand stack:
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1967 1 3 %oparray_pop 1966 1 3 %oparray_pop 1950 1 3 %oparray_pop 1836 1 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval--
Dictionary stack:
--dict:1197/1684(ro)(G)-- --dict:0/20(G)-- --dict:79/200(L)-- --dict:102/300(L)-- --dict:43/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 22237
MiKTeX GPL Ghostscript 9.19: Unrecoverable error, exit code 1
Any idea what could be causing this?
.pngwithdvips, you'll need to convert to EPS. – Joseph Wright Sep 25 '17 at 16:05pdflatex? It understands the .png and .jpeg formats natively. – Bernard Sep 25 '17 at 16:08