Comment 17 for bug 1417470

Revision history for this message
Hobbyblobby (hobbyblobby) wrote :

I have the same problem here with Ubunut 12.04.5 and self-compiled inkscape 0.91.

Since I compile my LaTeX stuff with a Makefile, I used the following workaround:
graphics: $(SLIDE_DIR)/*.svg
 for i in $?; do\
  inkscape -z -f "$$i" --export-latex -A "$$(dirname $$i)/$$(basename $$i .svg).pdf" -C; \
  PAGES=$$(pdfinfo "$$(dirname $$i)/$$(basename $$i .svg).pdf" | grep Pages | cut -d" " -f11); \
  for j in $$(egrep "includegraphics.*page=" "$$(dirname $$i)/$$(basename $$i .svg).pdf_tex"); do\
   CHECKPAGE="$$(echo $$j | sed 's/^.*page=\([0-9]*\).*$$/\1/g')";\
   if [ $$CHECKPAGE -gt $$PAGES ]; then\
    sed -i 's/^.*includegraphics.*page='$$CHECKPAGE'.*$$//g' "$$(dirname $$i)/$$(basename $$i .svg).pdf_tex";\
   fi;\
  done;\
 done

Maybe it is not so elegant, but for it works. What does this target do? At first it loops over all .svg files in my "$SLIDE_DIR" directory and converts the files with inkscape. Then it look how much pages the resulting pdf file has. Then it loops over all includegraphics in the coresponding pdf_svg file to find entries where "page=X" has a X greater then the pages in the pdf. If this is the case, the line is deleted with sed. I guess there is a shorter solution with awk, but I am not so familiar with awk.