Bug 342735

Summary: when viewing .dvi with included .eps files, these .eps figures are shown in wrong places
Product: [Applications] okular Reporter: Andrey Grozin <A.G.Grozin>
Component: DVI backendAssignee: Okular developers <okular-devel>
Status: CONFIRMED ---    
Severity: normal CC: kensington, luigi.toscano, mark.vanrossum, martin.sandsmark
Priority: NOR    
Version: 0.20.2   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: bug.tex
a.eps
bug.dvi in okular
bug.ps in okular
bug.pdf in okular
bug.dvi in xdvi

Description Andrey Grozin 2015-01-11 16:11:47 UTC
latex bug.tex
okular bug.dvi

The first a.eps is shown at the correct place;
the second one is shifted to the left;
the thirs one is shifted to the left more;
the fourth one is shifted to the left still more.

xdvi bug.dvi

All .eps figures are positioned correctly

dvips bug.dvi
dvipdfm bug.dvi

convert bug.dvi to bug.ps, bug.pdf which are shown (by okular and by other viewers) correctly. Only bug.dvi is affected.

I am sure that earlier versions of okular displayed such .dvi files correctly. Unfortunately, I don't know starting from which version the problem appeared.

Reproducible: Always




bug.tex
================
\documentclass{article}
\usepackage{graphics}
\setlength{\unitlength}{1mm}

\begin{document}

\begin{equation}
\raisebox{-10mm}{\begin{picture}(22,22)
\put(11,11){\makebox(0,0){\includegraphics{a.eps}}}
\put(11,11){\makebox(0,0){$\times$}}
\end{picture}}
+
\raisebox{-10mm}{\begin{picture}(22,22)
\put(11,11){\makebox(0,0){\includegraphics{a.eps}}}
\put(11,11){\makebox(0,0){$\times$}}
\end{picture}}
+
\raisebox{-10mm}{\begin{picture}(22,22)
\put(11,11){\makebox(0,0){\includegraphics{a.eps}}}
\put(11,11){\makebox(0,0){$\times$}}
\end{picture}}
+
\raisebox{-10mm}{\begin{picture}(22,22)
\put(11,11){\makebox(0,0){\includegraphics{a.eps}}}
\put(11,11){\makebox(0,0){$\times$}}
\end{picture}}
\end{equation}

\end{document}
================

a.eps
================
%!PS-Adobe-2.0 EPSF-2.0
%%Creator: GLE 4.2.4c <www.gle-graphics.org>
%%CreationDate: Sun Jan 11 00:59:03 2015
%%Title: a.gle
%%BoundingBox: 0 0 65 65
%%HiResBoundingBox: 0 0 64.3622 64.3622
%%EndComments
%%EndProlog
gsave
/f {findfont exch scalefont setfont} bind def
/s {show} bind def
/ps {true charpath} bind def
/l {lineto} bind def
/m {newpath moveto} bind def
matrix currentmatrix /originmat exch def
/umatrix {originmat matrix concatmatrix setmatrix} def
[28.3465 0 0 28.3465 0 0] umatrix
[28.3465 0 0 28.3465 1 1] umatrix
[] 0 setdash
0.02 setlinewidth
0 setgray
0 0 m
0.03 setlinewidth
1 setlinecap
1 setlinejoin
0 0 m
0 0 m
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 0 m
-1 1 m
[28.3465 0 0 28.3465 3.83465 60.5276] umatrix
0 0 m
0 0 m
2 0 l
stroke
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 1 m
-1 0.5 m
[28.3465 0 0 28.3465 3.83465 46.3543] umatrix
0 0 m
0 0 m
2 0 l
stroke
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 0.5 m
-1 0 m
[28.3465 0 0 28.3465 3.83465 32.1811] umatrix
0 0 m
0 0 m
2 0 l
stroke
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 0 m
-1 -0.5 m
[28.3465 0 0 28.3465 3.83465 18.0079] umatrix
0 0 m
0 0 m
2 0 l
stroke
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 -0.5 m
-1 -1 m
[28.3465 0 0 28.3465 3.83465 3.83465] umatrix
0 0 m
0 0 m
2 0 l
stroke
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 -1 m
1 1 m
[28.3465 0 0 28.3465 60.5276 60.5276] umatrix
0 0 m
[28.3465 0 0 28.3465 7.10543e-15 7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 7.10543e-15 -7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 60.5276 60.5276] umatrix
0 0 m
2 0 l
stroke
[28.3465 0 0 28.3465 60.5276 60.5276] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
1 -1 m
0.5 1 m
[28.3465 0 0 28.3465 46.3543 60.5276] umatrix
0 0 m
[28.3465 0 0 28.3465 7.10543e-15 7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 7.10543e-15 -7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 46.3543 60.5276] umatrix
0 0 m
2 0 l
stroke
[28.3465 0 0 28.3465 46.3543 60.5276] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
0.5 -1 m
0 1 m
[28.3465 0 0 28.3465 32.1811 60.5276] umatrix
0 0 m
[28.3465 0 0 28.3465 0 7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 7.10543e-15 -1.30525e-30] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 32.1811 60.5276] umatrix
0 0 m
2 0 l
stroke
[28.3465 0 0 28.3465 32.1811 60.5276] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
0 -1 m
-0.5 1 m
[28.3465 0 0 28.3465 18.0079 60.5276] umatrix
0 0 m
[28.3465 0 0 28.3465 0 7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 7.10543e-15 -1.30525e-30] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 18.0079 60.5276] umatrix
0 0 m
2 0 l
stroke
[28.3465 0 0 28.3465 18.0079 60.5276] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
-0.5 -1 m
-1 1 m
[28.3465 0 0 28.3465 3.83465 60.5276] umatrix
0 0 m
[28.3465 0 0 28.3465 0 7.10543e-15] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 7.10543e-15 -1.30525e-30] umatrix
[-5.20716e-15 -28.3465 28.3465 -5.20716e-15 3.83465 60.5276] umatrix
0 0 m
2 0 l
stroke
[28.3465 0 0 28.3465 3.83465 60.5276] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
[28.3465 0 0 28.3465 32.1811 32.1811] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
-1 -1 m
[28.3465 0 0 28.3465 1 1] umatrix
0 setgray
0.03 setlinewidth
[] 0 setdash
showpage
grestore
%%Trailer
================
Comment 1 Andrey Grozin 2015-01-11 16:13:53 UTC
Created attachment 90351 [details]
bug.tex
Comment 2 Andrey Grozin 2015-01-11 16:14:37 UTC
Created attachment 90352 [details]
a.eps
Comment 3 Luigi Toscano 2015-02-26 01:04:58 UTC
Test case checked on current Debian testing-almost-stable 8 Jessie, Okular 0.20.2 with KDE Platform 4.14.2.
I checked the test case on Okular 0.14.3 (shipped with KDE SC 4.8.4, on Debian 7.8 Wheezy), and indeed the rendering was the same on the DVI, PS and PDF versions. There haven't been many changes to the DVI backend, quite strange. Anyway, there is a regression somewhere.
Comment 4 Andrey Grozin 2016-05-04 20:16:52 UTC
This bug still exists in the current kde5 version from git (in Gentoo it is called okular-5.9999, don't know exactly to which branch it corresponds). Extremely annoying for everybody, who (like me) wants to insert pictures (e.g., Feynman diagrams) into formulas.
Is there any hope that somebody could do bisection and find which commit has introduced this bug?
Comment 5 Luigi Toscano 2016-05-04 20:20:39 UTC
The Frameworks version is unofficiale ("frameworks" branch) and that code was basically not touched. If you have some resources (which I don't right now), you may want to try the versions (kdelibs4-based) between 0.14.3 and 0.20.2, were the issue appeared.
Comment 6 Martin Sandsmark 2016-07-13 02:19:32 UTC
What versions of ghostscript do you have?
Comment 7 Andrey Grozin 2016-07-13 12:14:54 UTC
Currently 9.19. When I filed this bug, surely, I had an older version.

I tried to do bisection. Compiled okular-0.14.3 (which was in KDE SC 4.8.4) which was mentioned in comment #3.  But the bug was already present. I have not compiled the whole KDE SC 4.8.4 together with all libraries and programs on which okular depends. So, it seems that the bug is *not* in okular itself. Behaviour of some external library or program has changed some time ago, and induced the buggy behaviour in okular.

I'll try to compile some old version of ghostscript. Does anybody know what version of ghostscript was in Debian 7.8?
Comment 8 Martin Sandsmark 2016-07-13 14:30:22 UTC
I'm fairly certain that ghostscript either has a regression or somehow changed behavior. Okular doesn't render the EPS files itself, it just calls ghostscript: https://github.com/KDE/okular/blob/master/generators/dvi/psgs.cpp#L147-L292
Comment 9 Andrey Grozin 2023-03-30 13:09:40 UTC
Created attachment 157720 [details]
bug.dvi in okular
Comment 10 Andrey Grozin 2023-03-30 13:10:44 UTC
Created attachment 157721 [details]
bug.ps in okular
Comment 11 Andrey Grozin 2023-03-30 13:11:24 UTC
Created attachment 157722 [details]
bug.pdf in okular
Comment 12 Andrey Grozin 2023-03-30 13:12:04 UTC
Created attachment 157723 [details]
bug.dvi in xdvi
Comment 13 Andrey Grozin 2023-03-30 13:13:06 UTC
The bug still exists in okular-22.12.3 (my current ghostscript is 10.01.0).