# User:Egm6341.s10.team3.heejun/Inkscape

The installation problems of Inkscape and TexText under Windows 7 and Windows XP, and their solutions, are documented here.

# Install Inkscape

Update on 2012.12.30: The installation of Inkscape (e.g., under Windows 7) is very easy. Just download Inkscape version 0.48.4 for Windows 32 bit and install. The installation will take a few minutes, be patient... That's it. On the other hand, this installation does not have TexText (latex equation fragments in svg figures) yet; see further below.

## What is Inkscape?

Inkscape is a vector graphics editor application.

## What is the SVG format ?

Scalable Vector Graphics (SVG) is a family of specifications of an XML-based file format for describing two-dimensional vector graphics.

# Install Textext

To use textext on Inkscape, some Latex programs are needed. Just follow directions on the below tutorial webpage.

http://pav.iki.fi/software/textext/

https://bitbucket.org/pitgarbe/textext

These instructions have been tested for the installation of Inkscape 0.48 (current stable version as of Jan. 2011) with MikTex 2.9 and Textext on a Windows XP OS, and work beautifully.

For an installation of Inkscape and Textext using Windows 7, see below.

Note

A Latex program is already installed?

Any Latex program can work with Inkscape. (2012.12.30: Need to check this statement; we only tested with MikTeX 2.8 and 2.9)

A different version of the Inkscape?

There is NO big difference for textext between textext version 0.4.4 and the previous version of textext, see the textext webpage.

# Known working versions under Windows XP

Below is a known working combination of versions of Inkscape and Textext under Windows XP.

# Install Inkscape 0.48.1-2 and Textext 0.4.4 under Windows 7/XP (Jun 2011)

Update on 2012.12.30: See also the installation guide textext.pdf, which can be accessed through the web site Designing Attractive Presentations by James Davis.

Under Windows 7/XP, after a "regular" installation of Inkscape and Textext as shown above, you may encounter the following error message:

textext.py:55: DeprecationWarning: the md5 module is deprecated; use hashlib instead

import os, sys, tempfile, traceback, glob, re, md5, copy
Traceback (most recent call last):
File "textext.py", line 306, in <module>
raise RuntimeError("Neither pygtk nor Tkinter is available!")
RuntimeError: Neither pygtk nor Tkinter is available!

From the info in the Textext discussion on "textext.py:55:", the above warning message is usually found in Windows 7 environment. The same error also occurred under Windows XP for Inkscape 0.48.1-2 and Textext 0.4.4.

If you want to use Inkscape 0.48.1-2 and Textext 0.4.4 together in Windows 7/XP, you need to go through a few more steps to install Textext 0.4.4 than with older versions of Inkscape (e.g., 0.46, 0.47) under Windows XP.

The 11 steps below are recommended as a solution; follow the steps in numerical order (the first 10 steps were originally published in the Textext discussion on "textext.py:55:"); you need to have Administrator privilege.

• 1. Install the Latex distribution for Windows MiKTeX 2.8 or 2.9. Sometimes, it is better to install MiKTeX 2.8, instead of the newer version 2.9, so that other software that works with MiKTeX 2.8, but not with 2.9, can be used (e.g. latexeqedit-0.4 worked with MikTeX 2.8, but not MikTeX 2.9, even though more recent version of this software may work with MikTeX 2.9) .

Selected components:

basic pstoedit
.h and .lib files for using the pstoedit.dll in other programs
Some PostScript examples
plugins SVG, MIF, EMF, CGM format (shareware)
importps - for MS Office integration
plugin for interface towards GraphicsMagick/Magic++ - needs GraphicsMagick to be installed - otherwise you will get messages about missing DLLs

Note that if you installed pstoedit in a drive different from the default drive C:, you need to include the path to pstoedit in the PATH environment varialble; see further below.
• 4. Install GPL Ghostscript for 32-bit machine, i.e., gs900w32.exe, for pstoedit to find this binary automatically without having to change the PATH environment. With the version for 64-bit machine, you may need to change the PATH environment for pstoedit to find the binary. This advice / warning was given in TeXPPT.
Note that if you installed the 32-bit version of gs9.02 in a drive different from the default drive C:, you need to include the path to gs9.02 in the PATH environment varialble; see further below.
• 6. Download the zip file libxml2-2.7.7.win32.zip, extract (right click on zip file, select "Extract All...", the folder C:\Users\your_username\Downloads\libxml2-2.7.7.win32\ will be created), and copy the contents to the folder C:\Program Files (x86)\Inkscape\libxml2-2.7.7.win32\. Another way without extracting the zip file is to double click at the zip file to enter the contents of the zip file to copy the folfer libxml2-2.7.7.win32\ to copy to C:\Program Files (x86)\Inkscape\libxml2-2.7.7.win32\.
• 7. Go to Fixing textext on Inkscape for Windows to download the zip file site-packages.zip - THIS LINK DOES NOT WORK!. Extract the folder site-packages\ from the zip file site-packages.zip (right-click on the zip file, select "Extract All..."), then copy the contents of the folder site-packages\ to the folder C:\Program Files (x86)\Inkscape\python\Lib\ (it is fine if some files were overwritten -> OK!). If there is the folder C:\Program Files (x86)\Inkscape\python\Lib\site-packages\, then just copy the contents of the new folder site-packages\ into this existing folder. Under Windows 7, if the folder C:\Program Files (x86)\Inkscape\python\Lib\site-packages\ does not exist, it is possible to create this folder by moving the new folder site-packages\ into C:\Program Files (x86)\Inkscape\python\Lib\; it is also possible to copy the contents of the new folder site-packages\ to the folder C:\Program Files\Inkscape\python\Lib\. Alternatively, if one does not have access to the zip file site-packages.zip, as mentioned at the beginning of this paragraph, one can perform the following steps ("dirty fix"):
• 7.2. Rename C:\Program Files\Inkscape\python to C:\Program Files\Inkscape\python_backup
• 7.3. Copy your C:\Python26 to C:\Program Files\Inkscape
• 7.4. Rename C:\Program Files\Inkscape\Python26 to C:\Program Files\Inkscape\python
• 7.5. Restart Inkscape
This is a very dirty fix, though, and is the same as Solution 2 in Step 11 below.
• 8. Install GraphicsMagick-1.3.12-Q8-windows-dll.exe. Search and copy the files CORE_RL_magick_.dll and CORE_RL_Magick++_.dll files (in the folder C:\Program Files (x86)\GraphicsMagick-1.3.12-Q8\) into your pstoedit folder C:\Program Files (x86)\pstoedit\.
• 9. Edit the file C:\Program Files (x86)\Inkscape\share\extensions\textext.py.
-> It is much easier to use an editor with syntax highlighting and with line numbers listed; go to the Notepad2 web page to download notepad2 4.2.25 (x86) editor for editing *.py file.
-> Change line 55 to "import os, sys, tempfile, traceback, glob, re, copy" without the quotes, i.e., remove "md5" between "re" and "copy".
-> Add line 56 "import hashlib" without the quotes
• 10. Ensure that the PATH environment variable contains the following paths:
C:\Program Files\Inkscape\libxml2-2.7.7.win32;C:\program files\GraphicsMagick-1.3.12-Q8;C:\Program Files\MiKTeX 2.9\miktex\bin
Under Windows 7, there are two ways to access and edit the PATH environment variable. The simplest way is to click Start, then type "environment variable" in the search box, then select "Edit the system environment variables" to bring up the "System Properties" window. Another way to access the "System Properties" window is click at Start, then right click at the link "Computer" on the right column, then select "Properties" to bring up the Control Panel, "System and Security", and "System"; click at the link "Advanced system settings" on the left column to bring up the "System Properties" window. To access the environment variables, select the "Advanced" tab (which shows up by default), click at the button "Environment Variables" (at the bottom) to bring up the "Environment variables" window; there are two subwindows, one for the user, and one for the "System variables". In the "System variables" subwindow, scroll down to find the "PATH" or "path" environment variable; click to highlight the PATH environment variable, then click Edit to begin to edit this environment variable.
In my Windows 7 installation, the PATH environment variable looks as follows:
C:\Program Files\Inkscape\libxml2-2.7.7.win32;C:\program files (x86)\graphicsmagick-1.3.12-q8;C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\Program Files (x86)\Common Files\ArcSoft\Bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\
Under Windows XP, open the Control Panel, click Performance and Maintenance, then System to bring up the System Properties window; click at the Advanced tab, then click at the "Environment Variables" at the bottom; in the "System Variables" box, highlight the variable "Path", then click Edit.
In my Windows XP installation, the PATH environment variable looks as follows:
F:\Program Files\pstoedit;F:\Program Files\gs\gs9.02\bin;F:\Program Files\Inkscape\libxml2-2.7.7.win32;f:\program files\graphicsmagick-1.3.12-q8;F:\Program Files\MiKTeX 2.8\miktex\bin;C:\Program Files\Common Files\ArcSoft\Bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared;F:\Program Files\MATLAB\R2009a\bin;F:\Program Files\MATLAB\R2009a\bin\win32
Note that I installed all additional programs (Inkscape, pstoedit, gs, GraphicsMagick, MiKTeX) in drive F:, instead of in drive C:, and thus I needed to add to the PATH environment variable the paths to these programs, in particular the paths to pstoedit and to gs. Without adding the paths to pstoedit and to gs as done above, I got the following error message:

Traceback (most recent call last):

File "F:\Program Files\Inkscape\share\extensions\textext.py", line 933, in <module>
e.affect()
File "F:\Program Files\Inkscape\share\extensions\inkex.py", line 207, in affect
self.effect()
File "F:\Program Files\Inkscape\share\extensions\textext.py", line 348, in effect
% ';\n'.join(converter_errors))
RuntimeError: No Latex -> SVG converter available:
Pdf2Svg: Command pdf2svg failed: [Error 2] The system cannot find the file specified;
PstoeditPlotSvg: Command pstoedit -help failed: [Error 2] The system cannot find the file specified;
SkConvert: Command pstoedit failed: [Error 2] The system cannot find the file specified

• 11.In Inkscape, to have latex formulas, invoke the TeX text feature by clicking at the link "Extensions" in the top taskbar, then select "Tex Text".
-> You may then see the error message below:

?push_back@?$list@VVPath@Magick@@V?$allocator
@VVPath@Magick@@@std@@@std@@QAEXABVVPath@Magick@@@Z could not be located
in the dynamic link library CORE_RL_Magick++_.dll

Even though there may pop up this error message, you still can see the typed formula shown in your Inkscape edit area.
In order to get rid of this problem, there exists two solutions:
Solution 1: Simpler than Solution 2 below. Found this solution in this web page as follows:

-> Remove the drvmagick.dll file from the pstoedit directory, i.e.,C:\Program Files (x86)\pstoedit\

Solution 2: See the "dirty fix" in Step 7 above.

-> Download the setup binary for python version 2.6 (python-2.6.msi), and execute this setup binary to install python 2.6 in the default folder C:\Python26\.
-> next, copy all files from the folder C:\Python26\ to the folder C:\Program Files (x86)\Inkscape\python\ (overwrite existing files).

# Install Inkscape 0.48.1-2 and Textext 0.4.4 under Windows 8/7/XP (Jan 2016)

These instructions have been tested with Inkscape 0.48 for Windows. Install every program either in 32 bit version or 64 bit.

1. Install a Latex distribution, eg. MikTex

2. Install Pstoedit. Remove or rename the drvmagick.dll file from the pstoedit directory.

3. Install Ghostscript

4. Download and run GraphicsMagick installer, try Q16 version, if doesn't work then Q8.

5. Download and run Textext installer v0.4.4. The installer will install necessary library files from PyGTK in addition to the Inkscape extension. The library files go under python\Lib\site-packages in the Inkscape directory.

6. The TexText inkscape extension has to be updated manually by a fixed version because of a library issue. Go to "C:\Program Files\Inkscape\share\extensions" and change the textext.py file according to these instructions.

7. Check also that you can run pdflatex.exe (from Miktex) and pstoedit.exe on the command prompt (cmd.exe). If not, add the directories where these files reside to your PATH environment variable.

8. If so far you used a 32 bit version of all software, then download and install PyGTK (like pygtk-all-in-one-2.24.2.win32-py2.7.msi).

9. If so far you used a 64 bit version of all software, there is no pre-built pygtk 64 bit package. The simplest solution is to replace the python installation used by Inkscape with another more complete one like Anaconda Python. Download it and install it in C:\ . Then go to your Inkscape installation folder and change "C:\...\Inkscape\python" to "C:\...\Inkscape\python_bak" . The last step, it to make in the command line (cmd.exe called with the administrator privileges) a hard link to your python installation with the MKLINK command. Example: mklink /h /j "C:\Program Files\Inkscape\python" C:\Anaconda

# Install Inkscape 0.91 and Textext 0.5 under Windows 8/7/XP (Jan 2016)

These instructions have been tested with Inkscape 0.91 for Windows. Install every program either in 32 bit version or 64 bit.

1. Install a Latex distribution, eg. MikTex

2. Install Pstoedit. Remove or rename the drvmagick.dll file from the pstoedit directory.

3. Install Ghostscript

4. Download and run GraphicsMagick installer, try Q16 version, if doesn't work then Q8.

5. Download and run Textext installer v0.5. The installer will install necessary library files from PyGTK in addition to the Inkscape extension. The library files go under python\Lib\site-packages in the Inkscape directory.

6. The TexText inkscape extension has to be updated manually because of a library issue. Go to "C:\Program Files\Inkscape\share\extensions" and update the code of textext.py to handle the change introduced in Inkscape 0.91. According to this note, replace the call to inkex.unittouu() with self.unittouu() . This affects lines 299 and 300 of the source code, as described here. Then it works for inkscape 0.91, even 64 bit.

7. Check also that you can run pdflatex.exe (from Miktex) and pstoedit.exe on the command prompt (cmd.exe). If not, add the directories where these files reside to your PATH environment variable.

8. If so far you used a 32 bit version of all software, then download and install PyGTK (like pygtk-all-in-one-2.24.2.win32-py2.7.msi)

9. If so far you used a 64 bit version of all software, there is no pre-built 64 bit pygtk package. The simplest solution is to replace the python installation used by Inkscape with another more complete one like Anaconda Python. Download it and install it in C:\ . Then go to your Inkscape installation folder and change "C:\...\Inkscape\python" to "C:\...\Inkscape\python_bak". The last step is to make in the command line (cmd.exe called with the administrator privileges) a hard link to your python installation with the MKLINK command. Example: mklink /h /j "C:\Program Files\Inkscape\python" C:\Anaconda

# Drawing with Inkscape

In this class, we don't need many complexed skills. Just simple skills for drawing will be asked. The below tutorial videos can help to draw.

• Basic Tutorial
• Creating Stick Figure
• Drawing with a given source
• Others

I wrote a personal inkscape manual when I started to learn inkscape back in Jan 2008; some of the procedures documented there may be no longer valid, e.g., the use of textext.

## Tips on using Inkscape

${\displaystyle \Rightarrow }$ Change the color of different features:
Use arrow tool on the left tool bar to select the feature you want the color of which to be change,using shortcut"Shift+Ctrl+F" or in the "Object" menu choose the "Fill and Stroke", then a user interface will pop out on the right of text area in Inkscape. You can change the color of filling and stroke or the stroke style.

${\displaystyle \Rightarrow }$ Change the size of the drawing canvas:
In the "File" menu, select the "Document Properties" or use shortcut "Shift+Ctrl+D", then a user interface will pop out. You can modify the page size by selecting the default size, A1, A4 etc., or inputting the width and height by yourself.

${\displaystyle \Rightarrow }$ Use grid to help you draw:
While drawing, you can turn on the "Grid" in the "Edit" menu to help you manage the scale of different features.

${\displaystyle \Rightarrow }$ Use snap to assist you to select input point:
While drawing, you can turn on the "Snap" in the "Edit" menu to assist you to choose input point.

For more tips, you also can see Basic Tutorial or Advanced Tutorial.

# Using textext within Inkscape

If textext was installed well, Tex Text menu item is on the Inkscape

Input statements are the same with Wiki. Only difference is math and /math comments. \$ is using instead of math and /math comments on the Inkscape

## Setting the preamble file for textext

In the above figure, you see that there was no preamble file. What is the preamble, and what is it used for ?

For example, if you want to have the boldface Greek symbol omega, e.g., in this figure, you would use the following latex code

\boldsymbol \omega


and the command \boldsymbol requires the latex package amssymb to be loaded into latex via the preamble.

To create the preamble file, e.g., named "textext.preamble.tex", you can use a text editor (e.g. notepad++, gvim) to create a text file with that name, and containing the following lines:

\usepackage{amsmath}
\usepackage{amssymb}


When the textext window pops up (as shown in the previous section), click at the "Preamble file" bar to search for the path to the preamble file "textext.preamble.tex".

After the above, the boldface Greek symbol omega should come out correctly in inkscape.

Using the above method, you can add more packages into the preamble file for textext, depending on your need.

Actually, in the figure mentioned above, I also used the txfonts package in addition to the above two packages so to create a slightly different font (darker, with thicker lines) than the default latex Computer Modern font:

\usepackage{txfonts}


# Useful Websites

Official Manual and Unofficial Inkscape Forum

• Official Manual
http://inkscape.org/doc/
• Unofficial Inkscape Forum
http://www.inkscapeforum.com/index.php

# More on SVG file

Import "SVG" file into Word2007 document
(The quote sign means the file isn't svg file anymore after you insert it into Word document)

In Microsoft Office Word, we can insert pictures of varies kind of format, like jpeg, bmp, jif, png, etc. Unfortunately, the SVG file can't be directly imported into Word document. There are two ways we can manage this issue.

Solution 1: Drag and Drop

Firstly, Open the SVG file in Internet Explorer (I also have tried Firefox, it doesn't work as in Internet Explorer), and the Word document which you want to add this SVG file to. Drag the SVG file and drop it at the location where you want to put this file in the Word document. Then everything is done. You can modify the "inserted" figure as what you can do for other normally inserted files.
The picture may be changed to some other acceptable format after the drag and drop, since the picture isn't scalable anymore.

This method is only tested on the 2007 version of Word. For older or newer version, you may also try this method to see whether it works.

Solution 2: Converting file format

Method 1: Open svg file in Inkscape, use "Save as..." in the "File" to save the picture in png format. You also can save it as .ps, .emf, .wmf formats that the Word document accepts.

Method 2: Open svg file in Inkscape, use "Export Bitmap" in the "File" to store the picture in bmp format.

After converting the svg format into any format that Word can accept directly, you can follow the routine we usually do to insert pictures into Word document.

Export SVG file in MATLAB

Usually, we can export the plot in MATLAB by using "Save..." or "Save as..." command into varies kind of picture format, like jpeg, bmp, jif, png, etc, but not SVG. How can we save the image drawn in MATLAB as SVG file?

Solution:

Go to this website SVG Export of Figures, and download the plot2svg.m file first on the right column. (You also can download other related files on this page which are unnecessary here.) Put this plot2svg.m file into the folder where you installed MATLAB, like C:\Program Files\MATLAB\ in my computer. Or, you can save this .m file wherever you want, then in the MATLAB interface select "File"${\displaystyle \rightarrow }$ "Set Path" ${\displaystyle \rightarrow }$ "Add Folder" ${\displaystyle \rightarrow }$ (Select the folder where you have put your downloaded plot2svg.m file) ${\displaystyle \rightarrow }$ "Save" ${\displaystyle \rightarrow }$ (the folder containing the .m file is added to the MATLAB path) ${\displaystyle \rightarrow }$ "Close".

Every time you want to save your figure as SVG file, you need to use plot2svg function at the end of your plot function. The format is as following:

Figure(...);
title('...');
xlable('...');
.
.
.
plot(...);
plot2svg('put the name of the svg file here');


After running the MATLAB code, the svg file is automatically saved in the default MATLAB directory in the "Documentation" folder if you have never changed the "Start in" path. On windows system, you can find your "start in" path of your MATLAB by right click the MATLAB icon, select "Properties" (Last one), then the property interface will pop out, and you can find the "start in" path. Follow this start in path, you can find where the svg file is stored.

SVG Export of Figures by Juerg Schwizer.

# Contributors

hjchung2 = Egm6341.s10.team3.heejun - started this page back on 19 Aug 2010.
Egm6321.f10.team4.Yoon - Author of the 7: Installation Inkscape with Textext under Windows7 Environment.