Skip to content

isteinbrecher/LaTeX2AI

Repository files navigation

LaTeX2AI

LaTeX2AI is a plugin for Adobe Illustrator (macOS and Windows) that enables the use of editable text labels typeset in LaTeX inside an Illustrator document.

Overview

License & How to Cite

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:

Feel free to leave a ⭐ on GitHub. You can also add your work to Work that uses LaTeX2AI.

Installation

Requirements

The following software dependencies are required to run LaTeX2AI:

Windows

  1. Download LaTeX2AI for your Illustrator version from the GitHub release page.

  2. Unzip the .zip file.

  3. Copy the user interface folder com.isteinbrecher.latex2ai:

    • Installation for current user:
      • Copy com.isteinbrecher.latex2ai to C:\Users\<USERNAME>\AppData\Roaming\Adobe\CEP\extensions (you may need to create this directory).
    • Installation for all users (requires administrator privileges):
      • Copy com.isteinbrecher.latex2ai to C:\Program Files\Common Files\Adobe\CEP\extensions\
  4. Copy the plugin:

    • Installation for current user:
      • Copy LaTeX2AI.aip to any directory. Set this as the Adobe Illustrator plugin directory via Edit > Preferences > Plug-ins & Scratch Disks... > Additional Plug-ins Folder.
    • Installation for all users (requires administrator privileges):
      • Copy LaTeX2AI.aip to C:\Program Files\Adobe\Adobe Illustrator <YOUR VERSION>\Plug-ins\
  5. Restart Adobe Illustrator. Display the LaTeX2AI tools via Window > Toolbars > Advanced.

To uninstall LaTeX2AI, delete the files you copied.

macOS

  1. Download LaTeX2AI for your Illustrator version from the GitHub release page.

  2. Unzip the file.

  3. Copy the user interface folder com.isteinbrecher.latex2ai:

    • Installation for current user:
      • Copy com.isteinbrecher.latex2ai to ~/Library/Application Support/Adobe/CEP/extensions/
    • Installation for all users (requires administrator privileges):
      • Copy com.isteinbrecher.latex2ai to /Library/Application Support/Adobe/CEP/extensions/
  4. Copy the plugin:

    • Installation for current user:
      • Copy LaTeX2AI.aip to any directory. Set this as the Adobe Illustrator plugin directory via Edit > Preferences > Plug-ins & Scratch Disks... > Additional Plug-ins Folder.
    • Installation for all users (requires administrator privileges):
      • Copy LaTeX2AI.aip to /Applications/Adobe Illustrator <YOUR VERSION>/Plug-ins/
  5. Restart Adobe Illustrator. Display the LaTeX2AI tools via Window > Toolbars > Advanced.

Depending on your system settings, you might get the following error message when starting Illustrator:

macOS permission error

This can be resolved by explicitly allowing the gatekeeper to run LaTeX2AI (see also this thread). To do so, open the terminal and type:

xattr -d com.apple.quarantine <PATH TO LaTeX2AI.aip>

If you have installed LaTeX2AI for all users, you need to run this command with administrator privileges:

sudo xattr -d com.apple.quarantine <PATH TO LaTeX2AI.aip>

To uninstall LaTeX2AI, delete the files you copied.

How to Use LaTeX2AI

LaTeX2AI adds four buttons to the main toolbar:

  • Create / Edit Create / Edit: Edit an existing label by clicking on it, or create a new one by clicking somewhere in the document.
  • Redo items Redo LaTeX2AI labels: Recompile or reset the scale of all existing LaTeX2AI labels.
  • LaTeX2AI options LaTeX2AI options: Open a form to set global LaTeX2AI options and edit the LaTeX header in an external application.
  • Save document as PDF Save as PDF: Save the current .ai document as a .pdf with the same name. The LaTeX2AI labels are included.

You can also double-click on a LaTeX2AI label to enter edit mode.

Create / Edit a LaTeX2AI Label

This form appears when creating or editing labels:

Create / Edit

Placement

This option defines how a label behaves when its size changes.

Take for example the well-known formula $\sum_{k=0}^{\infty}\frac{x^k}{k!}$ placed inside a rectangle:

Placement small

The green box shows the size of the label, and the dot marks the placement anchor. When the LaTeX code changes and affects the label size, this anchor point stays in the same position relative to the rectangle.

If the label is changed to \displaystyle:

Placement large

The size changes, but the anchor position remains fixed.

Baseline Placement

An additional placement option is baseline, which centers the label's baseline vertically. This allows for an easy alignment with other baseline LaTeX2AI labels or Illustrator text:

Placement baseline

Item Scaling Behavior

By default, LaTeX2AI inserts labels with a 1:1 scale: 1pt in LaTeX equals 1pt in Illustrator. For example, LaTeX labels with 12pt font match Illustrator text set to 12pt.

Labels can be resized like other Illustrator objects, but modifying the LaTeX code resets them to 1:1 scale.

The recommended approach is to keep items at 1:1 scale. This ensures consistent font sizes when exporting and including the artwork in LaTeX documents with \includegraphics[scale=1].

Use the Redo items tool to reset the scale of all LaTeX2AI items.

LaTeX Header

LaTeX2AI assumes that all Illustrator files in the same folder share the same LaTeX header: LaTeX2AI_header.tex.

If this file doesn't exist, it is created when needed. You can edit this file to add packages or macros.

Label Storage Strategy

Each LaTeX2AI label is an individual .pdf file linked to the Illustrator document. LaTeX2AI allows you to choose where these LaTeX-generated .pdf label files are stored. You can configure this setting in the LaTeX2AI Options panel.

  • Temporary directory (default):

    • Label .pdf files are stored in a global temporary folder and are managed automatically by LaTeX2AI.
    • This is the recommended option for most users.
  • Local links directory (legacy option):

    • This was the default behavior prior to LaTeX2AI v1.1.
    • Label .pdf files are stored in a links/ subfolder next to your Illustrator document and are managed automatically by LaTeX2AI.
    • This option is useful if you plan to move your .ai document to a different system where LaTeX2AI is not installed: simply copy the links/ folder alongside your document, and Illustrator will still be able to locate and display the labels.

Known Issues

Creative Cloud Documents

LaTeX2AI does not currently support Creative Cloud documents.

Work That Uses LaTeX2AI

An incomplete list of work that uses LaTeX2AI:

  • Toenniessen, F.: Die Homotopie der Sphären - Eine Einführung in Spektralsequenzen, Lokalisierungen und Kohomologie-Operationen, Springer Verlag Heidelberg, 2023.
  • 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

Contributing

We welcome contributions to LaTeX2AI.

For general questions, feature requests, or bug reports, please open an issue.

To contribute code:

  1. Fork the repository and work in a feature branch.
  2. Consider opening an issue for discussion if your changes are substantial.
  3. When ready, create a pull request to the develop branch.

To maintain code quality, LaTeX2AI uses a number of different pre-commit hooks to check committed code. Make sure to set up the pre-commit hooks before committing your changes

pre-commit install

Please also:

  • Compile a debug build and run framework tests in Illustrator Framework tests.
  • Consider adding tests in ./src/tests.
  • Add a description of your changes to the Changelog.
  • Feel free to add yourself to the ./CONTRIBUTORS file.

Build LaTeX2AI from Source

Instructions are available here.

Changelog

See the detailed changelog.