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

Richard Seguin riseguin at earthlink.net
Thu Nov 10 04:33:28 CET 2011


On Nov 9, 2011, at 7:35 AM, Nestor Aguilera wrote:

> 
> On 9 Nov 2011, at 02:40, Richard Seguin wrote:
> 
>> 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
> 
> There is also the package "centernot". Have you tried it?
> 

Nestor,

Thanks! I just set up the macro \newcommand{\notpre}{\centernot{\preccurlyeq}}, and it works perfectly! I consider this to be a better solution for this case. Still, I merely commented out my old macro to save it as an example in case I want to attempt combining other symbols in the future.

Richard




More information about the macostex-archives mailing list