Place Equation: Import and Baseline-Align Math Equations Created With Radical Pie

With this script you can place equations produced by the Radical Pie equation editor.

This script is part of the Type and Text collection. See the full collection here

The script described here can be used to place mathematical equations created with the Radical Pie equation editor. This editor saves equations as PDF or SVG files which, crucially, contain the equation’s baseline. This value, in turn, can be used to align the equation to the text’s baseline. (Radical Pie can save an equation as an EMF file too, but because this type doesn’t contain baseline information it’s of no use to us.)

The script is optimised for Radical Pie equations, but the EPS files created with the MathType/Wiris editor contain baseline information as well, so it would be churlish not to include these EPS files. The styles that the script creates may have to be fine-tuned for EPS though. Details follow.

Use

The script displays the following window. It looks in the active document’s folder for SVG, PDF, and EPS files that are identified as equations. To select a different folder, type the folder’s name in the edit field or click the folder icon to open the OS’s folder-selection tool to select a folder.

The script’s window is a panel, it stays on the screen until you dismiss it. If you add equation files to the folder or remove any, click Refresh to update the file list in the script’s window. (The script doesn’t watch the selected folder, hence the Refresh button.)

Before you begin

Display equations must be in a dedicated paragraph style because they need one or more settings that apply to equations only. Apart from anything else (space before, space after, etc.), the paragraph’s leading must be Auto, so if your style uses fixed leading, change it.

Secondly, if you want to number equations, the numbers probably have to appear at the right, not at the left. You can use InDesign’s paragraph numbering to number the placed equations, but the problem is that these numbers always appear at the start of the paragraph and InDesign’s interface has no provision to place them at the end. However, when you set the paragraph’s direction to right-to-left, the automatic number will appear at the end of the paragraph. This direction setting is available only in the interface of InDesign’s Middle-East version, but is exposed to scripting in every version and the equation placer supports it.

To apply the paragraph direction, place the cursor in a paragraph that has the display-equation style applied and click the ¶ button. Apart from the paragraph direction, the script also applies the World-Ready composer, which is needed to make the paragraph direction work.

You can set paragraph numbering itself in the paragraph style in the usual way.

Place an equation

To place an equation, select it in the list and double-click or click the Place button. With nothing selected, the equation is placed as a floating file at the top–left of the page. With an insertion point selected the equation is placed at that insertion point and it’s aligned to the baseline.

The script creates two object styles (Equation (display) and Equation (in-text)). The relevant object style is applied to the graphic’s frame. The script then retrieves the equation’s baseline from the file and applies it as a local override on the graphic frame’s Y offset to align the equation’s baseline, as shown in the screenshot, above.

In the above example, in both the display and the in-text equation the equation’s baseline is at x. The display equation’s baseline is aligned with (1), the in-text equation baseline, with the line’s baseline.

The two object styles for display and in-text equations differ only in that the display-equation variant uses text wrap, while the in-text variant does not. It is assumed that in-text equations do not change the line height (if they do, they should be presented as display equations).

The script assumes that if the paragraph contains one line, you’re placing a display equation, otherwise it’s an in-text equation.

Showing the baseline value

The script adds the equation’s baseline to the equation frame’s script label. To show it, select the equation’s frame and open the Script Label panel (Window > Utilities > Script Label):

This is useful when you need to fine-tune an equation’s placement and for future reference – for example, if another script is needed for whatever reason. It’s quicker to process the script label than to open and parse the equation file.

Alt text

From version 1.10 Radical Pie includes Latex code in exported SVG files. The script places this code as Alt text:


Version history

30 May 2026: Radical Pie version 1.10 stores the equation’s Latex code in the exported SVG file. The script placed this code as the link’s Alt-text.

15 Apr. 2026: Posted.


Peter Kahrel Script Repository
Hosted as a community service, and with deep appreciation, by CreativePro.com


Scripts by Topic | Script Index
Basic Script Installation and Use
How to Modify or Configure These Scripts
Resources for Scripting and Publishing Automation
About This Repository


Repository Home Page


Contact Peter Kahrel


Note to users: You run scripts at your own risk: CreativePro and the author accept no liability for anything that may be caused by any of these scripts. Always take the necessary precautions. We encourage you to save backups and test scripts on copies of your documents.

Bookmark
Please login to bookmark Close

This article was last modified on August 22, 2026

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...