showpage command in eps files creates blank pages in latex-beamer

Bug #929463 reported by Chris Pickett
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Medium
Unassigned

Bug Description

Under OS X 10.6.8 and Ubuntu something-or-other, inkscape 0.47 and 0.48 create .eps files with a showpage command in them. When including these files in a latex-beamer presentation using \includegraphics, an extra blank page is printed for each figure. Removing the showpage commands manually fixes the problem. Apparently this is due to the new Cairo eps generator in 0.47+ or something (no link anymore, sorry).

Previously I was using up to 0.46 and had no problems including files into latex-beamer presentations for many years. Oddly enough, looking at some old .eps files generated by 0.46, these also have the showpage command, yet they produce no problems. I am confused. The only other thing I've noticed is that the y-coordinate of the bounding box has shifted by -1 in the new files--I don't understand why this would affect things.

Is there a valid use case for the showpage command? If not, can the generated .eps files be filtered to remove it? It seems to me that since an .eps file is meant to fit on a single page, showpage is unnecessary.

Revision history for this message
su_v (suv-lp) wrote :
tags: added: cairo eps exporting
Revision history for this message
su_v (suv-lp) wrote :

Possibly related to upstream issue in cairo (not verified):

43634 - EPS output works poorly with dvips:
«The PostScript surface pushes the userdict onto the dictionary stack in its
setup code when in EPS mode. This (sometimes) causes problems when dvips
includes the EPS image, due to the "showpage" command not being a no-op if it
happens to be in userdict.»
<https://bugs.freedesktop.org/show_bug.cgi?id=43634>

Could you attach a sample test file (SVG), and provide the detailed export options used in your tests (export area drawing, page, non or both checked, or command line options) - I could then attach an EPS file generated with current cairo git master for you to test in latex/beamer.

Revision history for this message
su_v (suv-lp) wrote :

> It seems to me that since an .eps file is meant to fit on a single page, showpage is unnecessary.

According to the EPS specification [1], 'showpage' is allowed in EPS files, and it is up to the application importing the EPS file to handle it properly:

<quote>
Redefine showpage

The showpage operator is permitted in EPS files because it is present in so many PostScript language files. Therefore, it is reasonable for an EPS file to use the showpage operator, although it is not necessary if the EPS file will only be imported into another document. The application importing the EPS file is responsible for redefining showpage. showpage may be redefined using the following code segment:

  /showpage { } def
</quote>

[1] <http://partners.adobe.com/public/developer/en/ps/5002.EPSF_Spec.pdf>

Revision history for this message
Chris Pickett (cpicke) wrote :
Revision history for this message
Chris Pickett (cpicke) wrote :
Revision history for this message
Chris Pickett (cpicke) wrote :
Revision history for this message
Chris Pickett (cpicke) wrote :

Hi, thanks for giving this your attention. So, showpage is in the 0.46 .eps file as well, but for some reason it is not a problem. Removing it from the 0.48 .eps appears to get rid of the problem by not exposing it. It's also debatable in which package the problem lies. Cairo seems to think it's their bug since they expect it to be a no-op. But the EPS documentation you linked to even more specifically says, "The including application must define showpage as null." So I agree latex and/or beamer is supposed to handle this. A pragmatic solution is for Cairo to do it (since the plethora of LaTeX distributions are down the pipe from Cairo), and a quick and dirty solution is for Inkscape to filter it. It would be a problem if something broke by filtering showpage, but straightforward .eps to .pdf conversion works fine for me without it.

I'll attach a Makefile for other users interested in a workaround (it's obvious, but nevertheless).

I had to add the -C (page) option in 0.48 to get a similar bounding box to 0.46:

$ grep -i bound mls.eps # 0.46
%%BoundingBox: 54 423 771 708
%%HiResBoundingBox: 54.653379 423.67329 770.92502 707.18126

$ grep -i bound mls.eps # 0.48
%%BoundingBox: 54 422 596 708
%%PageBoundingBox: 54 422 596 708

$ grep -i bound mls.eps # 0.48 without -C (page); same results with -D (drawing)
%%BoundingBox: 0 -1 717 284
%%PageBoundingBox: 0 -1 717 284

I can't test 0.46 with -C anymore. Sorry for not giving the different .eps files unique names in the attachments.

Revision history for this message
Chris Pickett (cpicke) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Could you test & compare the files from the attached archive in beamer without any edits (i.e. without filtering out 'showpage')?

Exports done with Inkscape 0.48+devel r10955, cairo stable 1.10.2 and cairo git master (1.11.3, last update 2012-02-06)
 inkscape -T -E mls.eps mls.svg
 inkscape -C -T -E mls-C.eps mls.svg
 inkscape -D -T -E mls-D.eps mls.svg

Revision history for this message
Chris Pickett (cpicke) wrote :

Thanks for the test .eps files. It's broken in Cairo 1.10.2 but fixed in Cairo 1.11.3. See slides.pdf in the attachment. Cheers, Chris

Revision history for this message
Chris Pickett (cpicke) wrote :

P.S. For some reason, page 4 doesn't have the title "-r10955 -T -E Cairo 1.10.2", possibly because of manual showpage filtering from figure included on page 3.

Revision history for this message
su_v (suv-lp) wrote :

> It's broken in Cairo 1.10.2 but fixed in Cairo 1.11.3

Thanks for the feedback - it appears that this is indeed an upstream issue in cairo's EPS export, not in Inkscape's code itself.

Proposing to keep the report open ('Triaged') for Inkscape nevertheless until a new stable release of cairo is out which includes the fix for <https://bugs.freedesktop.org/43634> , and is available on most linux distros as well as shipped with the prebuilt Inkscape packages for Windows and Mac OS X.

Changed in inkscape:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Chris Pickett (cpicke) wrote :

Sounds good to me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.