User-Defined Operators

Robert Ennals Robert.Ennals@cl.cam.ac.uk
Thu, 17 Jul 2003 15:07:22 +0100


> Well, for the most part, LaTeX only provides common operators. One problem, I 
> came across some weeks ago, is that it is *not* possible to define his/her own 
> operators (or, at least, that Lamport's "LaTeX - A Document Preparation 
> System" doesn't tell you how you can define them).

It's actually fairly easy. There are several ways to do it. A simple hacky way 
to do it is the following:


* Draw a little picture of your operator in your favorite drawing package.

* Save this picture as an EPS drawing

* define a new command that inserts this eps drawing, possibly scaling it 
appropriately. E.g.
	
\newcommand{\myop}{\scalebox{0.1}{operators/myop.eps}}

* Then just use \myop like any other operator in math mode.


What this hack won't do is automatically change the size of the operator if 
the maths is in a subscript. There is probably an easy way to do this, but I 
haven't worked it out.


A more elegant way to do it is to define a new postscript font (not hard if 
you have the correct software) and then define your operator macro to insert 
the relevant character.


Hope this is useful to someone.


-Rob