14

I've seen somebody asked this question a year ago, but no answers given so I'm hoping this might attract some more/new/different attention.

Simple question. I want to use LaTeX with Inkscape on mac. I already use a tex editor so I should have most of the LaTeX stuff I need. However when I go to "Extensions>Render>", there's not a LaTeX option there as other online sources suggest.

As a fudge I tried using the application Latexit to generate SVG/EPS images to import but I can't seem to get import of those to work either.

12
  • 1
    Welcome to TeX.SX! You should know that this site is considered a Q&A, not a discussion forum, which (somehow) implies that duplicates aren't allowed. I will start a poll to close this question, though I hope that the original question will get enough attention now. You should also know that you can share questions on other places to draw more attention to it.
    – Ruben
    Jul 26, 2015 at 21:36
  • Fair enough, I looked to meta first. The jury seems to be out but some people seem to suggest just re-asking an old unanswered question.
    – Tom
    Jul 26, 2015 at 21:41
  • Ok, I looked meta afterwards... Let's leave your question open then and link the other question as a dupe to yours if you get an answer.
    – Ruben
    Jul 26, 2015 at 21:45
  • Sure, whatever is best. It just seems like the question could do with more attention. It has 1000 views but no real answers.
    – Tom
    Jul 26, 2015 at 21:47
  • 3
    Inkscape works fine on mac: all you do is write latex inside $ $ in text boxes in your image, and then export to pdf with the latex option as explained in this answer. When you export you get a pdf (with no latex in it) and .pdf_tex file which you can open and copy the contents of inside your main latex file. Making sure directories match, you will get your image with the overlaid math text. There is no need for a "Extensions>Render>" option, as explained here at the very bottom Sep 29, 2015 at 21:43

6 Answers 6

19

I encountered this problem coming from linux, where you could just easily go to Extension->Render->LaTex and type your latex formula. This is what I did (finding every piece from different sources) to fix this problem.

The general solution is that you have to add the PATH for latex, dvips, and pstoedit to the paths in the app. To do this follow the instructions below:

  1. Find the PATH to latex and dvips by typing the following in a terminal: which <app.name>, and the write down the paths. These two apps are usually installed with the MacTex installation, so there shouldn't be any need for installation here.
    For example here I get for both of them: /Library/TeX/texbin.
  2. pstoedit does not exist by default in the MacTex, so you have to install it. However, I tried installing it from a tar ball and it didn't work (probably cause I didn't have all the dependencies).
    I used macports here to to install this, and it worked for me. Now similarly find the PATH for pstoedit. For example I had: /opt/local/bin/.
  3. With your desired editor, open (with sudo) the following file: /Applications/Inkscape.app/Contents/Resources/script. Now at the end of this file, right above the last line exec "$CWD/bin/inkscape" "$@" add the paths that you extracted from step 1 and 2.
    For example I should add the line: PATH=$PATH:/Library/TeX/texbin:/opt/local/bin

Alternatively - especially if your installation doesn't have the script file - simply open Inkscape from the terminal: open -a /Applications/Inkscape.app/. Assuming the required LaTeX programs are already in your terminal's path (check with echo $PATH), this should work.

You should then be able to open Inkscape and type latex formulas by going to Extension->Render->Mathematics->LaTex.

2
  • 2
    This worked for me. I had to add the PATH command before the line that starts exec.
    – borticus
    Sep 27, 2016 at 17:00
  • 2
    On my installation, the /Applications/Inkscape.app/Contents/Resources/script does not exist, nor does any other file called script. I am on a Apple Silicon MacBook Air. Do you know what changed here or what the problem might be?
    – McLawrence
    Feb 25, 2021 at 20:07
7

I have a solution that I hope future viewers will find useful. It's not perfect but it's a quick and easy enough workflow for me.

I use the application Latexit to generate the Latex image. It's really easy to install and use.

Then I save as PDF vector format

enter image description here

Then from Inkscape select File>Import, select the PDF file, hit open and you're presented with this option box

For some reason it doesn't seem to work unless you tick "Clip to media box" and "Import via Poppler". Voila it's in Inkscape.

Remark: I think you can also save as SVG format from Latexit which might be better, but you need something extra called PDF2SVG which I'm not sure how to install.

1
  • 3
    For anyone that missed it: "Clip to media box" and "Import via Poppler" is crucial part of the answer! Thanks so much. :) Oct 19, 2016 at 23:30
3

I stumbled upon this in Jan 2022. The current version of Inkscape for Mac has an option for LaTeX rendering but it is disabled by default. But, if you run

alias inkscape="/Applications/Inkscape.app/Contents/MacOS/Inkscape"

in a terminal and then launch

inkscape

the option magically starts working! 😇 There is some issue with how paths are handled when the app is launched using the GUI.

Source: https://gitlab.com/inkscape/inbox/-/issues/1221

The menu

Options

The LaTeX

1
  • In my case the path was /Applications/Inkscape.app/Contents/MacOS/inkscape (The i in inkscape was lower case). However, you can also launch this without the terminal involved just by right clicking on the 'Inkscape' app in the Application folder and select Show Package Content and then look for /MacOS/inkscape and launch it (double click). Nov 26, 2022 at 23:22
2

Sad to see Inkscape on mac OS is lagging behind and we yet to see a stable native implementation. Many features present on Windows and Linux, including the LaTeX equation import, is missing. But even if it was there, there is other solution which IMHO is better. textext extension has been around for a while, and now other people have taken over the development. how to install it on mac OS?

  1. go to this repository and download the latest stable version and unzip
  2. go to this address:

~/.config/inkscape/extensions/

  1. copy the contents of extension folder from the download into this folder
  2. as this page has explained:

    • find the address of pdflatex

which pdflatex

  • open the file below in an editor:

~/.config/inkscape/extensions/textext.py

  • change the line

out = exec_command(['pdflatex', self.tmp('tex')] + latex_opts)

to

out = exec_command(['/Library/TeX/texbin/pdflatex', self.tmp('tex')] + latex_opts)

do not forget to install other dependencies mentioned in the readme of the mentioned repository. I know it it is not that straight forwards but it works at the end.

2
  • I don't think this solution works anymore. There's note a file called 'textext.py' in 'textext/extension'.
    – Tom
    Mar 25, 2019 at 12:47
  • @Tom please read my other post here
    – Foad
    Mar 25, 2019 at 13:40
0

If you install inkscape from the dmg file offered by inkscape.org you won't have latex rendering.

You can have latex rendering similar to the linux version by building it via macports:

1- install macports

2- install pstoedit from the terminal

sudo port install pstoedit

3- install inkscape from the terminal

sudo port install inkscape

note: I am not sure if step 2 is necessary, but that is how I did it and it worked.

0

I just tested to run the following code in terminal on Mac OS Ventura using inkscape version 1.3.

open -a /Applications/inkscape.app/

The LaTeX rendering and function plot rendering all worked as intended.

If you use inkscape frequently, you can save time by creating the alias for the command above in terminal.


Step 1: Determine which shell you are using. Common ones are bash and zsh. You can check by running:

echo $SHELL

Step 2: Open appropriate shell configuration.

For bash, enter nano ~/.bashrc.

For zsh, enter nano ~/.zshrc.


Step 3: Create the alias.

alias inkscape="open -a /Applications/inkscape.app"

To save the alias, you can press Ctrl + X, then Y to save the changes.


Step 4: To apply the changes to your current terminal session, run the following command.

For bash, source ~/.bashrc.

For zsh, source ~/.zshrc.


Finally, you can open the inkscape with pdflatex and function plotting functioning well in terminal by just type the key word alias inkscape to open the inkscape application.

You must log in to answer this question.

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