4

When using the includesvg macro that is provided by the svg package to include an svg image, all "text components" of the image (see the manual) are separated into a pdf_tex file (which is basically a tex file), while the rest of the image is converted into a pdf file.

Then the includesvg macro somehow merges the pdf file and the pdf_tex file at the place where the svg is included in the document, but the result of this isn't always that great, since when the text components are extracted from the svg files, the different font sizes of the different text components are lost and they will all get the same font size in the document they are included in.

So my question is: Is there any way when using the includesvg macro not to extract the text components into a pdf_tex file, but put it in the pdf file that is generated, in order to preserve the original appearance of the text?

I do realize that it is possible to manually open the svg file in Inkscape and save it as a pdf without using the PDF+LaTeX option and then include the pdf using the graphicx package, but I was looking for a way in which includesvg could do this work for you.

  • 1
    What do you mean by "text"? Does the svg have a <text> element? Or a <foreignObject> with a text element? Or do you perhaps mean the svg file itself? svg files are made of text... – morbusg Nov 22 '14 at 16:38
  • 1
    The svg package manual speaks about a text component, this is what I mean. I will update my question. – StrawberryFieldsForever Nov 22 '14 at 18:13
  • I found: "Only PDFLaTeX supports importing a single page of a graphics file, so only PDF backend gets interleaved text/graphics". So maybe try with EPS? – morbusg Nov 22 '14 at 19:37
  • 1
    Why the package svg extracts and the re-embeds the text really baffles me. This "feature" means that the text almost never works right. I'd love to know a solution to this. – Heisenberg Sep 29 '15 at 19:45
2

I had similar problem. In inkscape I've opened svg graphic and changed text object(s) to paths. After that everything was in a place.

  • 1
    The question stated that he or she knows that it would be possible to open the file and save it as pdf, but wants a solution not involving changing the file. This solution would change the file. This should possibly be just a comment. – Runar May 30 '16 at 6:33
2

Use the inkscapelatex=false option.

Behind the scenes, includesvg uses Inkscape's --export-latex option, which causes inkscape to generate a PDF without texts, and a LaTex snippet containing all texts, to be included in the document. This allows to put formulae in the SVG, and have them rendered by LaTex on top of the graphics. inkscapelatex=false disables this, causing the texts (and fonts, if i remember correctly) to be included int the PDF export.

  • 3
    Could you please elaborate on the reasons this solves the problem? – TeXnician Jun 22 '18 at 8:38
  • Even though the elaboration is lacking, this solved the problem. – Theolodis Oct 23 '18 at 7:23
  • @TeXnician Behind the scenes, includesvg uses inkscape's --export-latex option, which causes inkscape to generate a PDF without texts, and a latex snippet containing all texts, to be included in the document. This allows to put formulas in the svg, and have them rendered by latex on top of the graphics. inkscapelatex=false disables this, causing the texts (and fonts, if i remember correctly) to be included int the PDF export – NicolaF_ Oct 24 '18 at 8:36
  • Thanks, that is a good explanation. Please use the edit button to add it to the answer. – TeXnician Oct 24 '18 at 9:00

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.