shoosh
shoosh

Reputation: 79021

Inkscape + pdftex?

I have a small drawing in Inkscape and I want to embed it in a LaTeX document which I compile using pdftex. pdftex seem to have an oddity of not accepting .eps. infact if what I understood is correct the only vector graphics format it accepts is pdf. When I save my drawing in Inkscape as pdf then what I get is a pdf with a full page with my drawing in the upper corner.
Is there a way to import an Inkscape drawing to pdftex and ignoring this page size? Or do I need to start fiddling with the page settings to make the page size exactly fit the size of my drawing?

Upvotes: 1

Views: 3391

Answers (5)

Stefan Endrullis
Stefan Endrullis

Reputation: 4208

You can even fully automate the process of converting your svgs into pdfs, since inkscape can be called from command line. For instance, the following makefile code does the job (copping and converting) for me:

# svg -> pdf
$(GRAPHIC_DIR)/%.pdf: $(GRAPHIC_DIR)/%.svg
    cp $(GRAPHIC_DIR)/$*.svg $(GRAPHIC_DIR)/$*-crop.svg
    inkscape --verb=FitCanvasToSelectionOrDrawing --verb=FileSave --verb=FileClose $(GRAPHIC_DIR)/$*-crop.svg
    inkscape -A $(GRAPHIC_DIR)/$*.pdf $(GRAPHIC_DIR)/$*-crop.svg
    rm $(GRAPHIC_DIR)/$*-crop.svg

Moreover, cropping pdf files can be also done using pdfcrop.

Upvotes: 1

shoosh
shoosh

Reputation: 79021

So it turns out that Inkscape has a button on the Document properties titled "Fit page to selection" which makes this easier. Oh well.

Upvotes: 5

janneb
janneb

Reputation: 37248

Yes, pdftex does not accept eps.

I have used inkscape to make figures that I incorporate into .tex documents that I then process with pdflatex. And yes, I set the page size in inkscape so that the figure fits.

You could also try to export to .eps from inkscape, then convert to pdf with the "epstopdf" tool.

Upvotes: 2

Svante
Svante

Reputation: 51541

As far as I know, you have to adjust the bounding box resp. paper size in your PDF. There are tools like eps2pdf to convert EPS to PDF with the same bounding box.

Upvotes: 1

Are you giving the optional scaling parameters to \includegraphics? PDF handles bounding boxes differently from encapsulated postscript, and auto-sizing does not seem to work as well.

Upvotes: 1

Related Questions