! LaTeX Error: Cannot determine size of graphic in ./queen-diamond-red.svg (no BoundingBox).

How do I put proper bounding boxes into an .SVG file? I tried

viewBox="0 0 156 156"

I attached the files in my test case of SVG include. I get a different answer for no postfix and with prefix. With a .svg postfix the log records "! LaTeX Error: Cannot determine size of graphic in ./queen-diamond-red.svg (no BoundingBox). "

Without the .svg postfix, the log file says it can't find the file with error:

"! LaTeX Error: File `queen-diamond-red.pdf_tex' not found."


  \caption{svg image}



example SVG file with no bounding box?

  • Open it on Inkscape and try to fix the problem. – Sigur Nov 7 '14 at 22:16
  • Tried that first. Latex error: – daemondave Nov 7 '14 at 22:28
  • ! LaTeX Error: Cannot determine size of graphic in ./queen-diamond-red.svg (no BoundingBox). – daemondave Nov 7 '14 at 22:28
  • On Inkscape, save the file as eps or pdf. – Sigur Nov 7 '14 at 22:40
  • no i want it in svg file mode that's the point. – daemondave Nov 7 '14 at 22:50

I think you are using latex you need to use

pdflatex --shell-escape svg-test

and also it seems that you need to not put the extension in the file, and do not use px units, in fact there is no need to specify the height and width at all.


  \caption{svg image}


Unrelated, but I removed [test] as figure does not take an optional argument of that form.

I have checked the above works with the svg file that you posted.

It would be much simpler of course to save the file as pdf from inkscape and use \includegraphics. As it is the original inkscape is being saved as pdf then pdflatex is instructing inkscape to convert it into pdf each time so that it can be included into the document.

  • Thank you, I'm going to use htlatex for the output I just needed to test the svg package. – daemondave Nov 8 '14 at 16:50
  • May I ask why I need to use pdflatex instead of latex? – daemondave Nov 8 '14 at 16:50
  • @daemondave because as far as I can tell the svg package just calls inkscape to convert svg to pdf, and dvips can not include pdf files, (presumably the package could be set up to convert svg to eps to work with latex/dvips but I don't think that it does) – David Carlisle Nov 8 '14 at 16:53

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.