[OS X TeX] Creating a new composite symbol in LaTeX

Richard Seguin riseguin at earthlink.net
Wed Nov 9 00:40:26 EST 2011


This is a LaTeX trick that I thought I should pass on.

I recently wanted to use the \preccurlyeq symbol, but I also needed a negated version of it, and there is no negated version in the LaTeX or AMS symbol sets. (There are a couple of symbols that mean \preccurlyeq and not =, but that's not a full negation.) I wondered if I could make LaTeX move a / backwards on top of a \preccurlyeq, and so I first created a macro for the symbol I would call \notpre:

\newcommand{\notpre}{\;\preccurlyeq \negthickspace \negthickspace \negmedspace \negthinspace / \mbox{ }\,}

It looked great and it seemed to be absolutely stable with font size changes, but then I ran into a problem. If LaTeX had to significantly compress or expand inter-character spaces to justify a line, the / moved around a little bit on top of the \preccurlyeq, meaning that LaTeX was also compressing or expanding the negative spaces that I defined. So I dug into More Math into LaTeX for a while and discovered that if you wrap something in a math environment with { … }, it "tokenizes" everything within the curly brackets and no compression or expansion will take place on inter-charcter spaces (or negative spaces). So, finally I tried

\newcommand{\notpre}{\;{\preccurlyeq \negthickspace \negthickspace \negmedspace \negthinspace /}\mbox{ }\,}

and it worked perfectly! It is possible that the negative spacing might have to be tweaked a little if you use font symbol sets other than standard CM.

Richard Séguin


More information about the MacOSX-TeX mailing list