On Mon, Oct 21, 2002 at 03:02:08PM +0200, Andre Poenitz wrote:
> On Mon, Oct 21, 2002 at 02:57:02PM +0200, Dekel Tsur wrote:
> > Note that defining
> >   not                cmsy         54  47 mathrel  x
> > in lib/symbols is not enough, because it doesn't five good alignment.
> > I had to use a macro \def\not{\lyxnot\kern-20mu}.
> > 
> > PS: I could also define \not using a macro for the case that the cmsy
> > font is available. This will allow removing the special code for \not in
> > MathSymbolInset::metrics.
> 
> If you can make that work I believe I'd like the macro sulution best.

Here is the updated patch.
OK to apply ?
Index: lib/symbols
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/symbols,v
retrieving revision 1.32
diff -u -p -r1.32 symbols
--- lib/symbols 17 Oct 2002 13:15:24 -0000      1.32
+++ lib/symbols 21 Oct 2002 13:06:19 -0000
@@ -196,8 +196,13 @@ clubsuit           cmsy        124 167 m
 diamondsuit        cmsy        125 168 mathord  x
 heartsuit          cmsy        126 169 mathord  x
 spadesuit          cmsy        127 170 mathord  x
-# We define \not as mathrel in order to align it properly
-not                cmsy         54   0 mathrel  x 
+# We define lyxnot as mathrel in order to have proper alignment
+lyxnot             cmsy         54  47 mathrel  x
+iffont cmsy
+\def\not{\lyxnot\kern-12mu}
+else
+\def\not{\lyxnot\kern-20mu}
+endif
 coprod             cmex         96   0 mathop   x
 bigvee             cmex         87   0 mathop   x
 bigwedge           cmex         86   0 mathop   x
@@ -779,20 +784,20 @@ iffont cmsy
 \def\mapsto{\mapstochar\kern-12mu\rightarrow}
 \def\longmapsto{\mapstochar\kern-9mu\lyxbar\kern-11mu\rightarrow}
 \def\models{\vert\kern-7.5mu\lyxeq}
-end
+endif
 iffont cmm
 \def\hookrightarrow{\lhook\kern-13mu\rightarrow}
 \def\hookleftarrow{\leftarrow\kern-13mu\rhook}
 \def\bowtie{\triangleright\kern-6mu\triangleleft}
-end
+endif
 iffont msa
 \def\dashrightarrow{\lyxdabar\lyxdabar\lyxright}
 \def\dashleftarrow{\lyxleft\lyxdabar\lyxdabar}
 \def\dasharrow{\dashrightarrow}
-end
+endif
 iffont msb
 \def\Join{\ltimes\kern-12mu\rtimes}
-end
+endif
 \def\mathcircumflex{\mbox{\^{}}}
 
 neq                lyxsymbol             185 0 mathrel  x
Index: src/mathed/math_factory.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_factory.C,v
retrieving revision 1.64
diff -u -p -r1.64 math_factory.C
--- src/mathed/math_factory.C   14 Oct 2002 20:19:32 -0000      1.64
+++ src/mathed/math_factory.C   21 Oct 2002 13:06:20 -0000
@@ -109,7 +109,9 @@ void initSymbols()
                        is >> tmp;
                        skip = !math_font_available(tmp);
                        continue;
-               } else if (line.size() >= 3 && line.substr(0, 3) == "end") {
+               } else if (line.size() >= 4 && line.substr(0, 4) == "else") {
+                       skip = !skip;
+               } else if (line.size() >= 5 && line.substr(0, 5) == "endif") {
                        skip = false;
                        continue;
                } else if (skip)
Index: src/mathed/math_symbolinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_symbolinset.C,v
retrieving revision 1.47
diff -u -p -r1.47 math_symbolinset.C
--- src/mathed/math_symbolinset.C       17 Oct 2002 13:15:25 -0000      1.47
+++ src/mathed/math_symbolinset.C       21 Oct 2002 13:06:20 -0000
@@ -57,12 +57,7 @@ void MathSymbolInset::metrics(MathMetric
                dim_.d -= h_;
        }
        // seperate things a bit
-       int em = mathed_char_width(mi.base.font, 'M');
-       if (name() == "not")
-               // \not is a special case. 
-               // It must have 0 width to align properly with the next symbol.
-               dim_.w = 0;
-       else if (isRelOp())
+       if (isRelOp())
                dim_.w += static_cast<int>(0.5*em+0.5);
        else
                dim_.w += static_cast<int>(0.15*em+0.5);
@@ -81,8 +76,6 @@ void MathSymbolInset::draw(MathPainterIn
        //      << "' drawn as: '" << sym_->draw
        //      << "'\n";
        int em = mathed_char_width(pi.base.font, 'M');
-       // Here we don't need a special case for \not, as it needs the same
-       // increase in x as the next symbol.
        if (isRelOp())
                x += static_cast<int>(0.25*em+0.5);
        else

Reply via email to