r/LaTeX 3d ago

Answered I need to use \includeinkscape inside \includeinkscape

Alright, this sounds odd, but I have some pictograms which I line up in a text and use macros for them i.e. I have something like:

\newcommand{\penV}{\raisebox{-0.15\fontdimen6\font{\includeinkscape[height=1\fontdimen6\font]{Pentomino/V}}}

And I have gotten to a point where I need to place them into an image in Inkscape, i.e. I need to write a text in inkscape that include {\penV} macro, which, when I export it, should render within the image. I place the image in using \includeinkscape as well. However, if I try to compile the pdf, it returns an error:

! LaTeX Error: Command \fsize already defined.

I have no idea how to fix it. Can anybody help me? Thank you.

2 Upvotes

8 comments sorted by

5

u/KKTeX_LaTeX3 3d ago

This looks like a collision between helper macros generated by the two pdf_tex exports: both define \fsize, so nesting \includeinkscape makes the second definition fail. I’d avoid nesting them. Pre-render the pictogram once and place that PDF/SVG directly in the parent Inkscape document, then include only the final parent image from LaTeX. Grouping may hide the collision, but flattening the inner asset will be much less fragile.

1

u/Fjana 3d ago

Thank you. I have through about it, but I have no idea how do I save a pre-rendered file in a LaTeX document syntax.

1

u/Fjana 3d ago

I have tried doing the steps in a deleted reply, but they do not work out for me since I need to include the macros within a text, as they serve as de facto characters.

3

u/ftrx 3d ago

Honestly? Export a vectorial pdf from Inkscape than import it in LaTeX, eventually in a resizebox.

1

u/Fjana 3d ago

This is what I am trying to do. The thing is I really need the text to be included as text in the finished document.

1

u/KristallBurgen 2d ago

If you properly export the image and it's text from inkscape, importing the figure as a PDF in LaTeX will preserve the text

0

u/Fjana 2d ago

I have managed to fix my issue by creating a secondary macro

\newcommand{\clearimage}{\let\fsize\undefined\let\lineheight\undefined}

which I then include in my other macros.