According to this: https://tex.stackexchange.com/a/2107/41370 I have to use inkscape to generate a PDF file and a corresponding .pdf_tex file.

Since my original SVG file contains a class diagram it has many identifiers like "size_t" with underscores I get many errors.

When using the proposed statement to include the graphics it says: Missing $ .... for the line:

    \put(0.00768156,0.29678743){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{+ prepareSpawns(parent : Task*, count : std::size_t)}}}%

How can the underscores in the generated file be replaced?

edit: Using Inkscape 0.48.4 r9939

  • Hi. Do you want the text to read size_t or size underscore t. For the first you need to use size\_t, while the second should be size$_{\text{t}}$ in the Inkscape string. – Dolphin Apr 9 '15 at 11:21
  • The first version but if I would edit it manually it wouldn't make sense since the file is generated as well as the UML diagram from which the SVG file comes from. – user2656284 Apr 9 '15 at 11:39
  • Sounds like a find all _ in inkscape of type text and the Extensions->Text->Replace text... with _ and \_ should fix it. – Dolphin Apr 9 '15 at 11:48
  • where is the definition of \put located? it might be possible to redefine _ within that definition to be just an ordinary character, if no other use of _ will be made in an argument to \put. – barbara beeton Apr 9 '15 at 12:47

I tried to fix this myself, but ended up needing some help over on: svg package \includesvg with underscores in sgv, which allows me to provide you this solution:

  1. Define a custom macro called \escapeus (from Define an "escape underscore" environment)
  2. Wrap your \includesvg command in the \escapeus command


% The custom \escapeus macro to escape underscores:
        \lowercase{\endgroup\def\@activeus{\catcode`\_=\active \let~\_}}

    \centering % Make it look nice in the center
    % Wrap your \includesvg in the custom macro to escape the underscores
| improve this answer | |

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.