guide latex
Written by Daniel Herber.
(last updated on March 28, 2018)
---
### Installation Steps ###
**Note**: This guide assumes you are running a recent version of 64-bit Windows. More instructions are available in the [Tex Text readme](https://bitbucket.org/pitgarbe/textext#markdown-header-installation-for-windows).
#### Install the Required Software ####
The current working versions of the software are listed.
1. [Inkscape](https://inkscape.org/en/download/windows) (64-bit, 0.92.3)
- Alternatively, ```choco install inkscape``` using [chocolatey](https://chocolatey.org/)
2. [Tex Text](https://github.com/textext/textext) (0.7.1)
3. [PyGTK](https://github.com/textext/textext/releases/download/0.7/Install-PyGTK-2.24-Inkscape-0.92.2-64bit.exe) (64-bit, PyGTK-2.24-Inkscape-0.92.2, custom version for TexText only)
4. [pstoedit](https://sourceforge.net/projects/pstoedit/files/pstoedit/3.70) (64-bit, 3.70 only)
5. [Ghostscript](https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/gs920w64.exe) (64-bit, 9.20 only)
6. [ImageMagick](ftp://ftp.imagemagick.org/pub/ImageMagick/binaries) (64-bit, Q16, static, 6.9.9 only)
#### Update PATH Variable ####
If you are unsure what the `PATH` variable is in windows or how to change it, see the following [video](https://www.youtube.com/watch?v=W9pg2FHeoq8).
1. Ensure that Inkscape is in your path
- Run the command `inkscape` in the Command Prompt and see if it is recognized
- If it isn't add the Inkscape folder to your path
- Typically is something like `C:\Program Files\Inkscape`
2. Ensure that pstoedit is in your path
- Run the command `pstoedit` in the Command Prompt and see if it is recognized
- If it isn't add the pstoedit folder to your path
- Typically is something like `C:\Program Files\pstoedit`
3. Ensure that Ghostscript is in your path
- Run the command `gswin64c` in the Command Prompt and see if it is recognized
- If it isn't add the `bin` folder for Ghostscript to your path
- Typically is something like `C:\Program Files\gs\gs9.20\bin`
4. Ensure that ImageMagick is in your path
- Run the command `convert` in the Command Prompt and see if it is recognized
- If it isn't add the main folder for ImageMagick to your path
- Typically is something like `C:\Program Files\ImageMagick-6.9.9-Q16`
#### Install LaTeX Fonts ####
1. Download the complete Latin Modern collection at [link](http://www.gust.org.pl/projects/e-foundry/latin-modern/download)
2. Unzip the zip folder
3. Navigate to `\fonts\type1\public\lm`
4. Install all `.pfm` font files (there are about 92 of them)
5. The fonts are now available and you can delete the downloaded files
#### Create a Test Image ####
1. Open Inkscape
- NOTE: you should initially save your document before using TexText to avoid this [bug](https://github.com/textext/textext/issues/10)
2. Add a LaTeX equation
- Go to `Extensions` -> `Tex Text`
- Add your equation code into the GUI. For example:
```
\begin{align*}
\pi = \frac{3}{4} \sqrt{3} + 24 \int_{0}^{1/4} \sqrt{x - x^2} dx
\end{align*}
```
- Press `Save` when you are done
- You can edit the Tex Text object again by selecting it and going to `Extensions` -> `Tex Text`
3. Add some LaTeX text based on the Latin Modern font
- Create a text object by selecting the appropriate icon or pressing `F8`
- Type some text such as `This is some text.`
- Go to the `Text and Font` menu (`Shift + Ctrl + T` is the shortcut)
- Change the font family to a Latin Modern font such as:
- LMRoman12-Regular
- LMRoman12-Bold
- LMRoman12-Italic
- LMRoman17-Regular
- Be sure to press `apply` when you are done
4. Save the file. It will be a `.svg` file by default.
- Keep the .svg file around for easier editing of the figure
5. Create a pdf version by going to `File` -> `Save a Copy` and then selecting PDF
6. Create a png version by going to `Export PNG Image` menu (`Shift + Ctrl + E` is the shortcut)
- Change the export path to the desired location
- Change the image size to the desired sized
- The PNG may look like:

---
### Additional Tips and Tricks ###
- Inkscape basics
- [Basic Inkscape Tutorial](https://inkscape.org/en/doc/basic/tutorial-basic.html)
- [Inkscape Videos by Nick Saporito](https://www.youtube.com/channel/UCEQXp_fcqwPcqrzNtWJ1w9w/playlists)
- [Shortcuts](https://inkscape.org/en/doc/keys091.html)
- You can change the preamble the Tex Text uses
- The `.tex` file is typically located at `$USER\AppData\Roaming\inkscape\extensions\default_packages.tex`
- Current preamble that I use:
```
\usepackage{amsmath,amsthm,amssymb,amsfonts}
\usepackage{bm}
\usepackage{tikz}
\usetikzlibrary{calc,patterns,decorations.pathmorphing,decorations.markings}
```
- Use the same font (or a limited number of fonts) throughout the file to reduce the file size
- You can natively embed pdfs into your Inkscape drawings. See animation below.
- You can use the `internal import` option, but fonts may not be rendered correctly.
- You can use the `embed fonts` option, but the file size may be larger and other issues can occur
[](blogs/guides/latex-inkscape/inkscape-pdf-import.gif){data-lightbox="blog_imgs" data-title=""}