17

I checked the other question similar to this issue yet I could not find a proper solution for the issue I am facing for including an .svg file which is converted using inkscape with pdf+latex option set to ON, and I have also included both the .pdf and .pdf_tex file in the path. Yet I get the above mentioned error.

My code:

\begin{figure}[h!] 
\centering
\def\svgwidth{\columnwidth}
\input{Implementation/Figs/most_changed_from_default_pos_0.pdf_tex}
\end{figure}

Full error description:

!pdfTeX error: pdflatex (file /compile/Implementation/Figs/most_changed_from_default_pos_0.pdf): PDF inclusion: required page does not exist <5>

Any help to solve this issue would be really appreciated. I also downloaded the pdf file to check whether it has 5 pages. I could verify it, there were 5 pages in the pdf file.

The file which I want to convert is Pie chart

I have added the google drive link to the file which I have used for analysis herewith

Files related to the issue

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. A suggestion: Do us a favour and change your username to something more telling than "user1234". – Martin Schröder May 7 '15 at 14:50
18

Edit 2: This bug has been fixed. If you still experience it, please update your Inkscape installation to version 0.92.2 (August 2017) or newer.


Apparently there is a bug in Inkscape at the moment (there is a bug report from February here, however someone there mentioned there only being one page too many requested and for me it's quite a few more).

The problem is that the .pdf_tex file requests more pages of the .pdf to be included than there are. You can manually delete the offending lines. They should look something like

put(0,0){\includegraphics[width=unitlength,page=X]{filename.pdf}}%

where X is a number larger than the number of pages in the .pdf file (which is also given to you by LaTeX, in your case <5>).

You will have to repeat this task every time you edit your .svg, so you might want to avoid unnecessary edits.

This is quite arduous, but until a fix is released, this seems to be the best we can do.


Edit: [outdated and thus deleted]

  • This bug is still happening to me on 0.92.2 (mac) – level1807 Feb 16 at 22:09
  • @level1807, try updating to the current version of Inkscape (0.92.4). If that does not help, could you upload an MWE (.tex and .svg) somewhere for us to examine? – schtandard Feb 18 at 16:51
  • 0.92.4 isn't available on mac as a binary yet, so I'll have to wait until it is. – level1807 Feb 18 at 22:11
  • I do not own a Mac, so I cannot test this on my end. On Windows, however, this bug has been fixed since 0.92.2. If you provide me with the necessary files, I could test them on Windows (with 0.92.2). – schtandard Feb 20 at 20:57
7

Workaround to avoid layers

The basic idea is to move all the text elements (the ones that will be exported separately to latex) to the top layer.

  1. Open the .svg in inkscape and Ungroup all elements (this action has to be repeated until the tiny squares below the text elements appear)

    enter image description here

    As a result all elements should have their separate box:

    enter image description here

  2. Now select all the text elements, e.g. axis labels, axis titles etc.

    enter image description here

    and move these elements to the topmost layer.

    enter image description here

  3. If you now save the file to .pdf_tex

    enter image description here

    the resulting .pdf should only have one page.

3

The error message

!pdfTeX error: pdflatex (file [...]/most_changed_from_default_pos_0.pdf): PDF inclusion: required page does not exist <18>

does not mean the requested page number with the appended <18>. This number is the total number of pages. That means, the file [...]/most_changed_from_default_pos_0.pdf_tex requests a page number that is not in the range 1 to 18.

  • Thanks a lot for your reply. It would be really nice to know if you could suggest what could be the real issue in this problem. – user3012914 May 6 '15 at 17:38
  • @user3012914 For analyzing the problem, it would be helpful to have the related image files, .svg and the files from the conversion. – Heiko Oberdiek May 6 '15 at 17:56
  • I am trying to find a way how to upload the data here. I am very new to this forum, I couldn't find a way I am sorry for this.... – user3012914 May 6 '15 at 18:00
  • @user3012914 For example, dropbox and friends can be used. – Heiko Oberdiek May 6 '15 at 18:04
  • 1
    @user3012914 The line with page=6. – Heiko Oberdiek May 7 '15 at 6:22
1

The bug 1417470 that caused this problem is now fixed in Inkscape.

For Ubuntu, there is an official PPA that has the newest stable: https://launchpad.net/~inkscape.dev/+archive/ubuntu/stable

0

Hey I encountered the same problem. Here's a work around: The different pages Latex want's to include are different layers in inkscape. Try to define everything but your latex commands as one object in inkscape. Then set the text boxes at the correct positions and save as pdf_tex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.