Jex - a Java Equation Editor for Open Office [OO 1.1x version]
by David K. Levine
Jex is an equation editor designed to insert and edit equations
in Open Office. It is similar to the Design Sciences
Mathtype editor, a version of which also ships as the default
equation
editor with Microsoft Word. Installation
and downloads are below. Jex is
a wysywig editor that supports both TeX and MathML. This
version will only work with openoffice 1.1x and not with 1.0 or 1.9+, and you should
use
at least a 1.4 version of Sun's Java j2sdk or jre. If you want the current version for openoffice 1.9+ click here.
Downloads: Final Public Domain, Openoffice <1.9 version (stable version 9) (Note that the jar files contain the source code
along with the executables.) Installation
instructions are below. Rename the file to jex.jar.
Changelog
Copyright: This version and all earlier versions are placed in the public domain.
Compiling: The source files are
contained in the jar file.
To compile, change the jar extension to zip and unzip the file. The
java files should be in a directory
called jex, the images in a subdirectory of that directory called
images. The support files must be in your
class path. From the superdirectory of the jex directory issue the
command javac jex/Jex.java. You can then run the
program by java jex/Jex and put it in a jar file using
jar jar cvfm jex.jar jex/jmainclass.txt jex. If
you want to make modifications, it would be useful if you changed the
data in ver.txt to show that this is a different version.
Usage: To
insert a new equation in Openoffice, use the keyboard accelerator
ctrl-m. To edit an existing equation, select it, and use the keyboard
accelerator ctrl-m. In both cases a Jex window will open. The first
time Jex runs it will take a while to load, so be patient. However,
even when all Jex windows are closed, Jex will remain running until
Openoffice closes, so subsequent window openings will be reasonably
fast.
Equation
editing uses keystroke bindings similar to Mathtype or Scientific
Workplace; in particular control-j inserts a sub/superscript and
control-g make the next character greek. You
can find a complete list of keyboard accelerators under the help menu.
To insert something into the "User" menu, copy it to the clipboard,
then
click on the target using any mouse button except the usual one. When
you are done editing your equation, save it, or use the ctrl-m
keystroke accelerator from within Jex to save the equation and close
the window.
If you are editing an equation, the "save" operation replaces
the equation in openoffice with your edited equation. Otherwise the new
equation is inserted at the cursor in openoffice. Note that the font
size of the equation inserted into openoffice is determined from the
font size of the text that precedes the equation. If you change font
sizes in the Openoffice document, simply edit your equation and resave
it to get the font size reset.
Jex speaks a dialect of both MathML and of LaTex. LaTex is the
default format. The paste operation will read the clipboard to
determine if it contains TeX or MathML. You can also type TeX directly
into equations by hitting \ in the editor. Be aware that hitting the
space key will insert your TeX and exit TeX mode. Exactly what LaTex is
and is not supported by Jex is documented here.
MathML support is
"more experimental" than TeX support, and is not yet documented. Jex
can be used to convert from
supported TeX to MathML and vice versa.
Jex supports two command line options. You may use the option
--server and also the path to a configuration file. If you specify a
configuration file, the configuration will be loaded from that file,
and configuration changes will be saved to that file (it will be
created if it does not already exist). The default installation uses a
file called conf.jex in the same directory you installed Jex into. The
--server option will try to edit whatever is selected in Openoffice
when Jex first starts up, and will cause Jex to remain resident until
all Jex windows are closed and Openoffice closes. This is the default
option. If you do not use the --server option, Jex will start up
without trying to get an equation from Openoffice, and it will close as
soon as all Jex windows are closed.
Known Limitations:
- In
order to get the correct vertical alignment, equations are padded with
space so that they extend an equal distance from the baseline both
above and below the line. If you use variable spacing this will lead to
strange spacing between the lines. In any case, your document will look
better if you use fixed spacing for your text, and the extra padding
should not pose a problem for displayed equations that use variable
spacing.
- The routine for finding equations that are being edited does
not work properly when the equations are inside of tables or footnotes;
if you have selected the equation you want replaced everything will
work fine; if you have selected something else, that something
else will be replaced rather than the equation in the table or footnote.
- If Jex cannot find the equation you are editing (for example
it is in a table or footnote; you have deleted it; or it is in a
different document) it will insert the equation being saved at the
current cursor (deleting anything that is selected). This is a
workaround for the footnote/table problem, but be careful.
- Jex only looks in the document you are currently editing, so
if you edit an equation and switch documents, then save, the saved
equation will not go into the original document.
- You
can undo equations inserted or edited with Jex using the Openoffice
undo - but Jex inserted the equation in several steps, and it will take
several undoes to get back to where you started, resulting in some
rather strange looking interim results.
- Jex only works with swriter/oowrite - it does not work with
the spreadsheet or drawing program.
- Equations
occasionally disappear while typing - this appears to be an openoffice
bug with the display of graphics. They haven't gone anywhere, they are
just temporarily invisible and will reappear shortly. If you turn the
graphics display off and on again you can force them to reappear.
- Never
put a graphical object, including an equation, at the very beginning of
an openoffice document.
Fonts: Use the
Design Science Euclid
fonts, which you can download here. You
should first read the licensing
agreement.
Installation
Step 1: Install java if you
have not already done so. Install Java2 jdk or jre at least 1.4.
Step 2: Install Openoffice if
you have not already done so. Install at least version 1.1.
It is recommended that you install Java first so that it will be
recognized by openoffice, but this is not mandatory, and it is not
required that java be installed to work with openoffice.
Step 3 [Windows Only]: If you do not have Mathtype installed,
install the Truetype
Euclid fonts from Design Science.
Step 4. Create a directory and put the files jex.jar,
support.zip and
euclid.zip in it. Unzip the support.zip file.
When you unzip the
support.zip file, a file called install.sxw will be created.
Step 5. As root or adminstrator open the install.sxw/.odt file. When the
dialog asks if it is OK to run macros, answer yes. Click on the box "As
root or administrator click here to activate port listening in
Openoffice." Close all running instances of Openoffice - in windows
this includes closing the openoffice quickstarter.
Step 6. As the user who will use Jex, again open install.sxw/.odt, and again
allow macros to run. Click on the box "As an ordinary user
click here to install Jex into Openoffice." Leave Openoffice running.
Step 7. As root or administrator, run Jex. Either double-click the
jar file, or use the command line java -jar jex.jar. Select "Install
Office Fonts" and "Install Java Fonts" from the "Install" submenu of
the "Tools" menu. Close Jex.
Step 8. As the user who will use Jex
again run Jex. Select "Install for Office" from the "Install" submenu
of the "Tools" menu in Jex. Exit Jex and Openoffice - in windows this
includes closing the openoffice quickstarter.
Upgrading
If you upgrade Openoffice or Java you should repeat the
installation routine above, except that you can obviously skip steps
1-3. If you want to change to a different version of Jex, simply
replace the jex.jar file with the jex.jar file of your choice (for
example, to replace the current version with the stable version, or
vice versa). If
you upgrade from oo 1.x to oo 2.0 you should redo the entire
installation and use the current version of Jex.
What the Installation Routines Do
What the port activation routine does
- modifies the share/registry/data/org/openoffice/Setup.xcu file to
open communications with Java on port 8100. It does this by adding
<prop
oor:name="ooSetupConnectionURL"
oor:type="xs:string"><value>socket,host=localhost,port=8100;urp;</value></prop>
immediately following <node oor:name="Office">.
You can also modify this file by hand, or you can
include “-accept=socket,host=localhost,port=8100;urp;”
on the swriter/oowriter command line everytime you run it.
If you have problems, you might want to run netstat
-a to make sure that Openoffice is really listening on port 8100.
What the ordinary user installation routine does
- it writes a file JexMod.xba to the user/basic/Standard directory;
this contains the Jexgrab macro. The Jexgrab macro when executed
attempts to connect to Jex on port 8101. If it fails it runs Jex with
the command line options --server <jexdirectory>/conf.jex.
- it modifies the script.xlb file in that same directory to make
the JexMod module known to openoffice
- it modifies the user/config/soffice.cfg/writerkeybindings.xml
file to assign the Jexgrab macro to the keystroke ctrl-m. You may
change this from the "Configure" submenu of the Openoffice "Tools" menu
if you like.
What “Install Office Fonts” does in Jex
- it unzips and copies the Euclid fonts to the share/font/truetype
directory
What “Install Java Fonts” does in Jex
- it unzips and copies the Euclid fonts to the jre/lib/fonts
directory
What the “Install for Office” does in Jex
- writes a small file, jexpath.txt, to the user/config directory;
this contains a system dependent shell command that the Jexgrab macro
uses to start Jex when it is not already running. You may edit
jexpath.txt by hand if you wish to use different command line options.
What is in the support files?
The support.zip contains the necessary java support
files from
openoffice 1.1 needed to control openoffice from Java. They are
probably already installed on your system but are a pain to locate, so
I
have provided a set of copies and bound the jar file to copies that are
in the same directory as the jar file. The support.zip file also
contains the install.sxw file.