4

I'm using Inkscape (and TeX Live 2009/Debian, with MTPro2 fonts installed), and I want to insert LaTeX math code in images created in Inkscape and have the math rendered in the MTPro2 font.

I'm aware of the Inkscape extension Inkscape de LaTeX, but I can't see how to cause that extension to render using MTPro2 fonts.

Any ideas or suggestions? I know I could use PGF/TikZ, but I simply don't have time to use those at present --- especially since I've never used them before.

1

You could try using textext. It allows one to load a "preamble-file", so just use the same preamble as you normally do in your LaTeX file to make use of MTPro2 fonts: probably something like

\usepackage{mtpro2}
  • This solution works like a charm (I added the amsmath package before mtpro2 in my preamble, but that's probably overkill). Moreover, you can include your favorite custom math commands into the preamble to make the Inkscape workflow smoother. You may get an (innocuous) error message, but the formula is renderized as it should. Very nice! – Pedro Lauridsen Ribeiro Sep 18 '17 at 7:09
1

It looks to me that the overpic package should be recommended here. It is more general than embedding the font directly in your schematics. You'll later be able to compile the same document with another font with no extra efforts.

0

You can modify the Python file eqtexsvg.py in Inkscape installation directory. Look for the definition of function create_equation_tex and redefine as follows:

def create_equation_tex(filename, equation, add_header=""):
tex = open(filename, 'w')
tex.write("""%% processed with eqtexsvg.py
  \\documentclass{article}
  %\\usepackage{amsmath}
  %\\usepackage{amssymb}
  %\\usepackage{amsfonts}
  \\input{stuff_for_inkscape}% <===== see: c:\texlive\texmf-local\tex\latex\
""")
tex.write(add_header)
tex.write("""
  \\thispagestyle{empty}
  \\begin{document}
""")
tex.write(equation)
tex.write("\n\\end{document}\n")
tex.close()

Then, you can put the following file stuff_for_inkscape.tex in the TeX search path:

%-----------------------------
% Mathematics and related stuff
\usepackage{mathtools}

%-----------------------------
% Fonts and related stuff
\usepackage[T1]{fontenc}
\usepackage[final]{microtype}
\usepackage{newtxtext}% replaces the txfonts package;
% MathTime Professional 2
\usepackage[subscriptcorrection,slantedGreek,nofontinfo,%
        mtpcal,%
        mtphbi %% mtpbbi
        ]{mtpro2}

% font for Aspect Ratio
\usepackage[TM]{ar}

With these tweaks you can insert LaTeX formulas typeset with MathTimes Pro 2 via the menu Extensions | Render | LaTeX Formula. To work with this feature you'll have to install GhostScript and GhostView, pstoedit, ImageMagick, and GraphicsMagick. Make sure these programs are on the OS search path.

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.