isteinbrecher / latex2ai

LaTeX Plugin for Adobe Illustrator
MIT License
168 stars 5 forks source link
adobe-illustrator latex

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.

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 :star: on GitHub. You can also add your work to Work that uses LaTeX2AI.

Installation

Requirements

The following software dependencies are required to run LaTeX2AI:

Install LaTeX2AI

  1. Download LaTeX2AI from the GitHub release page

  2. Unzip the file

  3. Copy the user interface folder

    • macOS:
      • LaTeX2AI only for current user:
        • Copy com.isteinbrecher.latex2ai to ~/Library/Application Support/Adobe/CEP/extensions/
      • LaTeX2AI for all users (requires administrator privileges):
        • Copy com.isteinbrecher.latex2ai to /Library/Application Support/Adobe/CEP/extensions/
    • Windows:
      • LaTeX2AI only for current user:
        • Copy com.isteinbrecher.latex2ai to C:\Users\<USERNAME>\AppData\Roaming\Adobe\CEP\extensions (the directory might have to be created by the user)
      • LaTeX2AI for all users (requires administrator privileges):
        • Copy com.isteinbrecher.latex2ai to C:\Program Files\Common Files\Adobe\CEP\extensions\
  4. Copy the native plugin

    • macOS:
      • LaTeX2AI only for current user:
        • Copy macOS/LaTeX2AI.aip to an arbitrary directory. This directory has to be set as the Adobe Illustrator Plugin directory via Edit/Preferences/Plug-ins & Scratch Disks.../Additional Plug-ins Folder/
      • LaTeX2AI for all users (requires administrator privileges):
        • Copy macOS/LaTeX2AI.aip to /Applications/Adobe Illustrator <YOUR VERSION>/Plug-ins/
    • Windows:
      • LaTeX2AI only for current user:
        • Copy WIN/LaTeX2AI.aip to an arbitrary directory. This directory has to be set as the Adobe Illustrator Plugin directory via Edit/Preferences/Plug-ins & Scratch Disks.../Additional Plug-ins Folder/
      • LaTeX2AI for all users (requires administrator privileges):
        • Copy WIN/LaTeX2AI.aip to C:\Program Files\Adobe\Adobe Illustrator <YOUR VERSION>\Plug-ins\
  5. After a restart of Adobe Illustrator, you can display the LaTeX2AI tools with Window/Toolbars/Advanced.

To uninstall LaTeX2AI, delete the files you copied.

How to use LaTeX2AI

LaTeX2AI adds four buttons to the main toolbar:

These buttons are the main way of interacting with LaTeX2AI. Additionally, double clicking on a LaTeX2AI label will enable the edit mode for that label.

Create / Edit a LaTeX2AI label

The following form appears when creating or editing LaTeX2AI labels:

Create / Edit

Placement

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:

Placement small

The green box indicates the size of the LaTeX2I label and the dot describes the placement of the label. If the size changes due to a change in the LaTeX code, 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:

Placement large

The size of the label changed due to a change in the underlying LaTeX code, but the position (the indicated dot) stayed the same.

Baseline placement

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. This label can now be easily adjusted and snapped to align with another baseline label or Illustrator text:

Placement baseline

Item scaling behavior

Per default, LaTeX2AI places the LaTeX labels inside Illustrator with a scale of 1:1, i.e., 1pt in the LaTeX label is 1pt in the Illustrator document. For example, if the LaTeX item is created with a font size of 12pt the font will match Illustrator text with 12pt. The user can resize the labels like any other Illustrator object, however, be aware that every time the LaTeX code of a label changes, the scale is reset to 1:1.

The recommended way of using LaTeX2AI is to always have items at a scale of 1:1. By doing so, the exported Illustrator document can be simply included into a LaTeX document with the \includegraphics option scale=1, and the font size of the labels in the figures will exactly match the font size of the document (assuming that the header options are the same). With the LaTeX2AI tool Redo items, one can easily reset the scaling of all LaTeX2AI items in the document.

LaTeX header

LaTeX2AI 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.

File structure

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.

Known issues

Non ASCII characters in the document name or path

LaTeX2AI currently does not work if there are non ASCII characters in the document name or full document path.

Creative Cloud documents

LaTeX2AI currently does not work with Creative Cloud documents. However, if the document is stored in the Creative Cloud Files folder on the disk, LaTeX2AI should work as expected.

Work that uses LaTeX2AI

Contributing

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:

Build LaTeX2AI from source

Instructions on how to build LaTeX2AI from source can be found here

Changelog

A detailed changelog can be found here