User-Defined Operators

Wolfgang Jeltsch wolfgang@jeltsch.net
Thu, 17 Jul 2003 16:28:34 +0200


On Thursday, 2003-07-17, 16:07, CEST, Robert Ennals wrote:
> > 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.

Hello,

I think, in both cases you don't define an *operator*. LaTeX probably won't 
use the correct spacing around the symbol.

A related problem is that I cannot see a way to define a new "log-like 
function" (as Lamport names them), i.e., a function with a name consisting of 
several letters which have to be set in upright font with no spaces between 
them. Examples are log, min, max, sin, cos and tan.

> [...]

Wolfgang