LaTeX2AI is a plugin for Adobe Illustrator that enables the use of text labels typeset in LaTeX inside an Illustrator document. Currently LaTeX2AI supports:
Currently LaTeX2AI only works on Adobe Illustrator for Microsoft Windows. The following software dependencies are required:
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:
C:\Program Files\Adobe\Adobe Illustrator <YOUR VERSION>\Plug-ins
, preferably into a subdirectory LaTeX2AI
(for this method administrator privileges are required).Edit/Preferences/Plug-ins & Scratch Disks.../Additional Plug-ins Folder
.The additional requirements to build LaTeX2AI from source are:
python3
and git
have to be available on the system.PYTHON_EXE
has to points to a valid python3
executable on the system.ILLUSTRATOR_EXE
has to point to the illustrator executable on the system (this path is used for debugging).Adobe Illustrator <YOUR VERSION> SDK/sample code
and run
git clone https://github.com/isteinbrecher/latex2ai.git
Adobe Illustrator <YOUR VERSION> SDK/sample code/LaTeX2AI
and run
git submodule update --init
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 for LaTeX2AI
and the .NET Framework version for LaTeX2AIForms
to match the ones available on your system.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 are LaTeX2AI.aip
and LaTeX2AIForms.exe
.
The executable LaTeX2AIForms.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:
.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:
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:
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:
./l2a/src/tests
).python3
script check_license.py
to ensure that all added source files have the correct license header.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).system
calls.ILLUSTRATOR_PATH
to ILLUSTRATOR_EXE
.\input
commands in LaTeX headers.PYTHON_EXE
.ILLUSTRATOR_PATH
.