0

I am new in Inkscape/SVG world and I encountered some problems when I insert an SVG file created with Inkscape in my LaTeX document. LaTeX font size is the default one, say 13pt, and I wrote some 22pt text in my SVG file, when I insert this file in my LaTeX document (\includesvg{}), the text is reduced at 13pt, obviously I wanted it in 22pt. Where can I set this LaTeX settings? I am working in Overleaf.

Adoptable solutions:

  1. I write the text in Inkscape the way I wanted to see it in the pdf (font, size, everything), then I convert the text from object to path (top menu -> path -> from object to path), it won't be a simple text in LaTeX anymore;
  2. @mrpiggi solution in the comments.
1
  • It is preferable to include a minimal example, so that we can replicate your steps exactly. Either way, the method I use to include SVG in my papers is described here: tex.stackexchange.com/a/2107/133684 The idea is not to use the SVG as is, but rely on Inkscape's PDFLatex feature.
    – ralien
    Jan 20, 2023 at 11:47

1 Answer 1

0

Package svg provides the key pretex for \includesvg[pretex=...]{...} which is executed right before the actual inclusion of the generated pdf graphic file. You could use this to adapt either relative to the font size used in the document itself with something like \includesvg[pretex=\huge]{...} or set it absolutely with \includesvg[pretex=\fontsize{22pt}{26pt}]{...}.

Edit: There has been a similar question, the given answer should neatly sum up the whole thing.

5
  • Great tip! But it is a problem when I want two text of different size in my Inkscape work, i.e. the first one is Xpt and the second one is Ypt (while i have Zpt on LaTeX...). Anyway, to do this, I think you have to perform something on Inkscape, and not on LaTeX, there are some Inkscape plugins, but I still didn't find the correct way. Indeed I already "solved" all the situation by making the text become a path in Inkscape. LaTeX won't recognize it like a text, and will leave it as I wrote on Inkscape (font, size, ...). This should neither give me pdf/printing problems... Jan 25, 2023 at 15:46
  • Well, there are two different approaches you could take. Either, you would disable LaTeX for processing text in the SVG file by using \includesvg[inkscapelatex=false]{...} and do all the font related stuff directly in Inkscape, maybe with the need to adjust font face, type etc. according to your document if desired. Or you would let LaTeX make it's job and only do relative font size adjustments by using \small, \huge etc. directly in the SVG file. Regardless, I recommend you to create the SVG graphic preferably in the same size as it should appear in the final output.
    – mrpiggi
    Jan 25, 2023 at 17:27
  • This also works, confirmed. You gave me so valid and easy options! Jan 25, 2023 at 18:30
  • @mrpiggi It would be nice if the svg package handled differences in font size within the SVG without burdening the user.
    – user32882
    Mar 7, 2023 at 3:36
  • @user32882 I am not quite sure what exactly you're expecting. As described in the linked answer, package svg is "just" a convenient wrapper around the functionalities provided by Inkscape. If you have some issues with font sizes, you should consider to create your SVG files in the same size as desired for output.
    – mrpiggi
    Mar 7, 2023 at 9:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .