TransWikia.com

sharelatex: PDF inclusion: required page does not exist

TeX - LaTeX Asked by user3012914 on February 2, 2021

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
defsvgwidth{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

6 Answers

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.

Answered by Heiko Oberdiek on February 2, 2021

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]

Answered by schtandard on February 2, 2021

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.

Answered by Tom on February 2, 2021

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.

Answered by samcarter_is_at_topanswers.xyz on February 2, 2021

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

Answered by Laurenz on February 2, 2021

I did not experience a fix in the latest Inkscape release which is 1.0.1!

The workarounds provided in this thread are not complete but work sometimes. I can always fix the pdf and the related crash when I move all objects, not only the text, to the first layer and remove all other layers, then tex compiles and the input of the image works. As others metnioned before the layers cause this error but for me it only happens sometimes. Even if I add empty layers or move specific objects to other layers, I cannot reproduce the error. For some reasons the structure of some svg gets buggy.

It is a bit annoying since further edits are somewhat restricted or you have to additionally use the layered version as a backupcopy but finally I can work without this stupid bug.

Answered by Miau on February 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP