LaTeX2AI is a plugin for Adobe Illustrator that enables the use of text labels typeset in LaTeX inside an Illustrator document. Currently LaTeX2AI supports:
- Illustrator CS6 (tested)
- Illustrator CC 2017
- Illustrator CC 2018
- Illustrator 2021
- Illustrator 2022 (tested)
Currently LaTeX2AI only works on Adobe Illustrator for Microsoft Windows. The following software dependencies are required:
- A LaTeX compiler such as TeX Live or MiKTeX
- Ghost script
Install LaTeX2AI from rebuild binaries can be downloaded from the GitHub release page.
They consist of two files LaTeX2AI.aip
and LaTeX2AIForms.exe
.
There are two ways to add LaTeX2AI to Illustrator:
- Both files can be copied to the default plug-in directory
C:\Program Files\Adobe\Adobe Illustrator <YOUR VERSION>\Plug-ins
, preferably into a subdirectoryLaTeX2AI
(for this method administrator privileges are required). - Both files can be copied into an arbitrary directory and this directory has to be set as the Adobe Illustrator Plugin directory via
Edit/Preferences/Plug-ins & Scratch Disks.../Additional Plug-ins Folder
.
The additional requirements to build LaTeX2AI from source are:
- A C++ compiler has to be available on the system. This repository includes a Visual Studio 2017 solution for Windows.
python3
andgit
have to be available on the system.- Environment variables:
PYTHON_EXE
has to points to a validpython3
executable on the system.ILLUSTRATOR_EXE
has to point to the illustrator executable on the system (this path is used for debugging).
- Download and unpack the SDK depending on your Illustrator version:
- Go to the sample code folder
Adobe Illustrator <YOUR VERSION> SDK/sample code
and rungit clone https://github.com/isteinbrecher/latex2ai.git
- Go to
Adobe Illustrator <YOUR VERSION> SDK/sample code/LaTeX2AI
and rungit submodule update --init
- Open
Adobe Illustrator <YOUR VERSION> SDK/sample code/latex2ai/LaTeX2AI.sln
with Visual Studio, select the build type (Release or Debug) and the target (x64
) and compile the solution. It might be necessary to change the Windows SDK version forLaTeX2AI
and the .NET Framework version forLaTeX2AIForms
to match the ones available on your system. - The compiled binaries are located at
Adobe Illustrator <YOUR VERSION> SDK/sample code/output/win/x64/<Debug/Release>
. This directory has to be set as the Plugin directory in Illustrator. The relevant files created, i.e. the ones needed to run LaTeX2AI areLaTeX2AI.aip
andLaTeX2AIForms.exe
. The executableLaTeX2AIForms.exe
contains the UI for LaTeX2AI and should only be called from within the plugin itself.
LaTeX2AI uses the Placed Art feature of Illustrator to embed LaTeX labels (compiled to .pdf
) inside an Illustrator document.
The plugin adds four buttons to the main toolbar:
- Create / Edit: Either create a new LaTeX2AI label or edit an existing one in the document.
- Redo LaTeX2AI labels: This allows for the LaTeX recompilation and / or boundary box reset of all existing LaTeX2AI labels.
- LaTeX2AI options: Open a form where the global LaTeX2AI options can be set. Also the LaTeX header can be opened in an external application.
- Save as PDF: Save the current
.ai
document as a.pdf
document with the same name. The LaTeX2AI labels are included into the created.pdf
document.
Additionally, double clicking on a LaTeX2AI label enabled the editing mode.
The following form appears when creating or editing LaTeX2AI labels:
This option defines how a label behaves when it its size changes.
Take for example the well-known formula $\sum_{k=0}^{\infty}\frac{x^k}{k!}$
which is placed inside a rectangle:
The green box indicates the boundary box of the LaTeX2I label and the dot describes the placement of the label, i.e. if the size changes the position of this dot relative to the label will stay the same.
If the previous label is now changed to \displaystyle
we get the following result:
The size of the label changed due to a change in the underlying LaTeX code, but the position (the indicated dot) stayed the same.
Additionally there is the possibility of a baseline placement. This will result in a label where the baseline is exactly in the vertical center of the label. The resulting label can now be easily adjusted and snapped to align with another baseline label or Illustrator text:
This option controls how a LaTeX2AI text label behaves when the size of the boundary box changes in Illustrator:
- stretch (default): The label always stretches to the boundary box dimensions.
- remain original size: Only the boundary box stretches, the label will remain in the correct size.
The following Figure illustrates the different options:
Please note that the remain original size option leads to issues if the item is bend (see the red boxes in the previous Figure).
Every time a label changes the boundary box is reset so that it matches the size of the actual places PDF file. With the Redo items button the boundary box of all labels can be redone. It is generally advisable to redo all boundary boxes before exporting the Illustrator document, to ensure that the font size will be correct for each label.
It is assumed that all Illustrator files in the same directory use the same LaTeX header LaTeX2AI_header.tex
(if no one exits in the directory, it will be created the first time it is needed).
This header can be edited to include packages and macros needed for the labels (LaTeX2AI supports \input
commands in the header, also recursively).
The .pdf
files for the LaTeX labels are stored in the links
subfolder of the document directory.
It is not required to keep track of the files in the links
folder, LaTeX2AI manages and deletes unused label files.
When opening a document after it is moved / copied it can happen that Illustrator can not find the .pdf
files for the labels.
In that case the following warning message appears:
The missing labels can be ignored by selecting Apply to All
and Ignore
.
After the document is loaded, LaTeX2AI automatically restores the missing items.
Redoing an item by double clicking on it will not trigger an individual undo entry. The changes made in the redo process will be appended to the last undo entry.
LaTeX2AI does not work if there are non ASCII characters in the document name or full document path.
LaTeX2AI is under the MIT license, see ./LICENSE. If you use LaTeX2AI to create figures for your work, please acknowledge it with a link to the GitHub repository. For example:
- Sketches in this work have been created using the Adobe Illustrator plug-in LaTeX2AI (https://github.com/isteinbrecher/latex2ai).
- F. Toenniessen, Die Homotopie der Sphären, eine Einführung in die Technik der Faserungen, Spektralsequenzen und Kohomologie-Operationen, Springer Verlag Heidelberg (to appear in 2022).
- Steinbrecher, I., Popp, A., Meier, C.: Consistent coupling of positions and rotations for embedding 1D Cosserat beams into 3D solid volumes. Comput Mech (2021), Open Access
- Steinbrecher, I., Mayr, M., Grill, M.J., Kremheller, J., Meier, C., Popp, A.: A mortar-type finite element approach for embedding 1D beams into 3D solid volumes, Comput Mech (2020), 66(6):1377-1398, Open Access
- Steinbrecher, I., Humer, A., Vu-Quoc, L.: On the numerical modeling of sliding beams: A comparison of different approaches, Journal of Sound and Vibration, 408:270-290, Open Access (LaTeX2AI not credited)
If you are interested in contributing to LaTeX2AI, we welcome your collaboration. For general questions, feature request and bug reports please open an issue.
If you contribute actual code, fork the repository and make the changes in a feature branch.
Depending on the topic and amount of changes you also might want to open an issue.
To merge your changes into the main LaTeX2AI repository, create a pull request to the develop
branch (this branch will be merged into main
with the next release).
A few things to keep in mind:
- Compile a debug build and run the framework tests in Illustrator .
You might also consider adding tests for your changes (
./l2a/src/tests
). - Run the
python3
scriptcheck_license.py
to ensure that all added source files have the correct license header. - LaTeX2AI uses
clang-format
to format the C++ code. Make sure to apply clang format to the changed source files (with the Visual Studio solution in the repository this should happen automatically). - Add a short description of your changes to the Changelog in ./README.md.
- Feel free to add yourself to the ./CONTRIBUTORS file.
- v0.0.10
- Features:
- Add optional warnings when saving as PDF.
- Other:
- Add warning that LaTeX2AI is not compatible with non ASCII characters in the document path.
- Support Illustrator 2022
- Improve drawing of borders in preview mode.
- Features:
- v0.0.9
- Features:
- Add storage of labels inside Illustrator.
- Add undo and redo text.
- Features:
- v0.0.8
- Bug fixes:
- Fix bug in header include function.
- Fix a bug when using MikTeX.
- Other:
- Deactivate possible externalization in TikZ constructs.
- Bug fixes:
- v0.0.7
- Bug fixes:
- Fix bug in check version.
- Other:
- Improve path finding at startup.
- Bug fixes:
- v0.0.6
- Bug fixes:
- Fix bug when saving a PDF for an unsaved AI document.
- Other:
- LaTeX2AI now checks on startup if new releases are published on GitHub.
- Improve output message for Illustrator errors.
- Multiple images are now split with a single call to ghostscript.
- Add logo.
- Bug fixes:
- v0.0.5
- Other:
- Support Illustrator 2017
- Other:
- v0.0.4
- Bug fixes:
- Fix error when editing item with missing PDF file.
- Fix error with included headers containing relative paths.
- Clean temp directory at startup.
- Fix bugs when working with locked and or hidden layers / groups.
- Other:
- Create automated build script.
- Support Illustrator CC 2018.
- Bug fixes:
- v0.0.3
- New features:
- Allow to redo boundary box from the create / edit form.
- Allow to redo the latex label from the create / edit form.
- Bug fixes:
- Fix bug with whitespaces in
system
calls.
- Fix bug with whitespaces in
- Other:
- Add contributing guidelines.
- Change the default placement options.
- Rename environment variable
ILLUSTRATOR_PATH
toILLUSTRATOR_EXE
.
- New features:
- v0.0.2
- New features:
- Allow for
\input
commands in LaTeX headers. - Add option to edit LaTeX header in the settings form.
- Allow for
- Bug fixes:
- Replace hardcoded path to python executable with environment variable
PYTHON_EXE
. - Replace hardcoded path to Illustrator executable with environment variable
ILLUSTRATOR_PATH
.
- Replace hardcoded path to python executable with environment variable
- Other:
- Add information how to cite.
- Forms and the plugin are now compiled in the same directory; also add more detailed build information.
- LaTeX2AI can now also be installed in the default Illustrator plug-in directory.
- Support Illustrator 2021.
- New features:
- v0.0.1: Initial release