I have been using psfrag to add latex to figures for a while. I make my figures in Inkscape and compile in MikTex using texniccenter. I switched laptops and installed the latest Inkscape and MikTex and then psfrag stopped working. I then downgraded Inkscape to this: Inkscape 0.48.0 r9654. To no avail. Has anyone had problems like this with psfrag? What is the standard way to add latex to our figures?

Here is the code I use to swap latex into my diagrams. Am I doing anything wrong?



% [font=small,labelfont=bf] Required for specifying captions to tables and figures



\psfrag{1}{\Huge $hasA$}
\includegraphics[height= 3cm]{images/HasaConstruction.eps}
\caption{something something}
  • 3
    Why do you need psfrag if you are doing your figures in inkscape? I would either save them as pdf+latex or export them as tikzpicture from inkscape. Jan 11, 2019 at 19:33
  • 2
    Additionally to what @samcarter wrote, you can call LaTeX from within Inkscape if its only small portions of text.
    – Skillmon
    Jan 11, 2019 at 19:34
  • @samcarter I don't know what you mean. ARe you saying I can type $\mathcal{X}$ in my figure and then save as pdf+latex and then MikTex will build the diagram and produce the latex? (likewise with tikzpicture?)
    – user442920
    Jan 11, 2019 at 19:41
  • 1
    @user442920 Yes. If you want I can write an answer to show you a short example how this is done. Jan 11, 2019 at 19:46
  • 2
    Yes, you can insert the result of a small LaTeX run. If you go into "Extensions -> Render -> LaTeX..." you can insert the document and specify packages to be loaded.
    – Skillmon
    Jan 11, 2019 at 20:16

1 Answer 1


Instead of using psfrag I would simply export the image as pdf+tex from inkscape.

For example if your image looks like this in inkscape:

enter image description here

you can save it as .pdf and select the option "omit text in pdf and create latex file" during the export:

enter image description here

This will produce two files: a pdf with just the red ellipse but without the text and a .pdf_tex file that contains the following code:

%% Creator: Inkscape inkscape 0.92.2, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'drawing.pdf' (pdf, eps, ps)
%% To include the image in your LaTeX document, write
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics{<filename>.pdf}
%% To scale the image, write
%%   \def\svgwidth{<desired width>}
%%   \input{<filename>.pdf_tex}
%%  instead of
%%   \includegraphics[width=<desired width>]{<filename>.pdf}
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%%   \usepackage{import}
%% in the preamble, and then including the image with
%%   \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%%   \graphicspath{{<path to file>/}}
%% For more information, please see info/svg-inkscape on CTAN:
%%   http://tug.ctan.org/tex-archive/info/svg-inkscape
    \errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
    \errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
      \setlength{\unitlength}{\unitlength * \real{\svgscale}}%

(if you need to adjust the colour or position of the text, you can simply edit this file, just make sure you are not overwriting the adjusted file in case you export again from inkscape)

This file can now easily be included in your latex document




\caption{something something}


After compiling with pdflatex (or xe/lualtex) the result looks like this:

enter image description here


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.