3

I'm trying to include a .png picture into my LaTeX .dvi file. I use Emacs on Debian, if that is of any importance.

I do this by

\usepackage{graphicx}
\graphicspath{{./dia/}}

and then

\includegraphics[bb = 0 0 100 100]{student.png}

Then I process with C-c C-f (see below) and do not (what I can see) run into any problems. For some reason the [2] is shown in red -- if this is an indication of an error, it is probably unrelated as the png image should appear later on.

Then I view with C-c C-v. xdvi displays the document with no errors. But, when I browse down to the page where the image should appear, ghostscript gives the error below, and the image is not shown.

As ghostscript is probably what causes the error, this is the ghostscript stuff I have according to aptitude search ghostscript. (What does A mean?)

i A ghostscript
i A ghostscript-cups
i   ghostscript-doc
i   ghostscript-x

What do you think?

[?17;0;127cincal@VLAN-3434:~/dvk/x/first_try$latex \\nonstopmode\\input first.tex
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, swedish, loaded.

(./first.tex (/usr/share/texmf-texlive/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texmf-texlive/tex/latex/base/size12.clo))
(/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
(/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty)
(/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
(/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
(/etc/texmf/tex/latex/config/graphics.cfg)
(/usr/share/texmf-texlive/tex/latex/graphics/dvips.def)))
(/usr/share/texmf-texlive/tex/generic/babel/babel.sty
(/usr/share/texmf-texlive/tex/generic/babel/swedish.ldf
(/usr/share/texmf-texlive/tex/generic/babel/babel.def)))
(/usr/share/texmf-texlive/tex/latex/base/fontenc.sty
(/usr/share/texmf-texlive/tex/latex/base/t1enc.def))
(/usr/share/texmf-texlive/tex/latex/base/inputenc.sty
(/usr/share/texmf-texlive/tex/latex/base/utf8.def
(/usr/share/texmf-texlive/tex/latex/base/t1enc.dfu)
(/usr/share/texmf-texlive/tex/latex/base/ot1enc.dfu)
(/usr/share/texmf-texlive/tex/latex/base/omsenc.dfu))) (./first.aux) [1]
[2] [3] [4] [5] [6] <./dia/student.png> [7] [8] (./first.aux) )
Output written on first.dvi (8 pages, 20016 bytes).
Transcript written on first.log.
[?17;0;127cincal@VLAN-3434:~/dvk/x/first_try$xdvi /home/incal/dvk/x/first_try/first.dvi&
[1] 3936
[?17;0;127cincal@VLAN-3434:~/dvk/x/first_try$gs: Error: /syntaxerror in (binary token, type=137)
gs: Operand stack:
gs: 
gs: Execution stack:
gs:    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--
gs:    2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fals
gs: e   1   %stopped_push   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop
gs:    1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   
gs: %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval-- 
gs:   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nost
gs: ringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1769 
gs:   1   3   %oparray_pop   --nostringval--   --nostringval--   false   1   %stopped
gs: _push   --nostringval--   1878   1   5   %oparray_pop   1877   1   5   %oparray_p
gs: op   1861   1   5   %oparray_pop   1755   1   5   %oparray_pop   --nostringval-- 
gs:   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval-
gs: -   2   %stopped_push
gs: Dictionary stack:
gs:    --dict:1157/1684(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--   --dict:23/
gs: 250(L)--   --dict:42/200(L)--
gs: Current allocation mode is local

Alright, thanks for you answers. I saved the file as .eps with no problems from Dia.

I didn't have auctex, so C-c C-t C-p didn't do anything, so I downloaded auctex and got it to work. I noticed there were different effects when editing, e.g. subsection captions were in big yellow letters. Also, flyspell-mode was suddenly on by default.

The checker gave more detailed information, although I miss the old C-c C-f shortcut. There is no shortcut stated in the menu - do you know the name of that command, so I can at least run it with M-x (and bind it to C-c C-f)?

But there were no new errors on the graphics stuff.

In the default mode, the view command is:

xdvi first.dvi

This works, but the picture is still not visible.

In PDF mode, the view command is:

xpdf -remote first -raise first.pdf

This does not do anything when run from Emacs. When I run it from bash, it says there is no first.pdf. (The LaTeX file is first.tex)

However, this works (views the file including the EPS image)

pdflatex first.tex; evince first.pdf

I guess I could run it from Emacs every time and simply ignore the view stuff.

New edit:

Ok, it worked yesterday, but for some reason it stopped to. That's what you get when you "solve" problems without knowing why or how...

The pdflatex would give me a new error message every time, and, as I googled them, I had to add a lot of stuff, so now it looks like:

\usepackage{graphicx}
\usepackage{epstopdf}
\graphicspath{{./dia/}}
\epstopdfsetup{suffix=}
...
\includegraphics{student}

The command I use now is

pdflatex --shell-escape first.tex

I added the flag because it complains that it wasn't enabled.

The file is first.tex and the eps file is ./dia/student.eps

This is the relevant part of compilation output. Yes, I googled the error messages. If you would help me on this, I would be very happy.

[Loading MPS to PDF converter (version 2006.09.02).]
)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   1878   1   3   %oparray_pop   1877   1   3   %oparray_pop   1861   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push
Dictionary stack:
   --dict:1160/1684(ro)(G)--   --dict:0/20(G)--   --dict:70/200(L)--
Current allocation mode is local
GPL Ghostscript 8.71: Unrecoverable error, exit code 1
epstopdf ($Id: epstopdf.pl 17496 2010-03-18 17:57:31Z karl $) 2.15
!!! Error: Writing to gs failed, error code 1
Emanuel Berg
  • 1,827

0 Answers0