From ad7e2435cfdb3eb7ac3ed4e7c3e2db804c3c2ff9 Mon Sep 17 00:00:00 2001 From: Guillaume Munch Date: Fri, 11 Nov 2016 20:52:03 +0100 Subject: [PATCH] Fix display of some math symbols * Fix spacing in lib/symbols after recent commits about math spacing, as well as older spacing issues (e.g. \Join). * InsetMathKern now uses the same em value as other math length commands. What is nice is that the kerning amount now matches the ones found in the packages definition (modulo 10mu that lyx currently adds between relations). Testcase: $\CheckedBox\LEFTcircle\RIGHTcircle\photon\gluon\vcentcolon\dblcolon\Coloneqq\eqcolon\models\hookrightarrow\bowtie\hookleftarrow\Join\APLinv\neq$ --- lib/symbols | 57 ++++++++++++++++++------------------ src/mathed/InsetMathKern.cpp | 4 +++ 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/lib/symbols b/lib/symbols index f6611142a3..1905888887 100644 --- a/lib/symbols +++ b/lib/symbols @@ -300,8 +300,8 @@ spadesuit cmsy 127 170 mathord ♠ # We define lyxnot as mathrel in order to have proper alignment lyxnot cmsy 54 47 mathrel / iffont cmsy -# 9mu = 0.5em which is the extra space added to relation operators -\def\not{\lyxnot\kern-9mu} +# 10mu is the extra space added to relation operators +\def\not{\lyxnot\kern-20mu} else \def\not{\kern4mu\lyxnot\kern-19mu} endif @@ -692,7 +692,7 @@ AC wasy 58 0 textmode ∿ wasysym,amstext,lyxmath \def\HF{\approx} wasysym VHF wasy 64 0 x ≋ # triple tilde Square wasy 50 0 x □ -\def\CheckedBox{\Square\kern-0.8em\checked} wasysym +\def\CheckedBox{\Square\kern-13.4mu\checked} wasysym XBox wasy 52 0 x ⊠ hexagon wasy 55 0 x ⬡ pentagon wasy 68 0 x ⬠ @@ -726,8 +726,8 @@ Leftcircle wasy 73 0 x x LEFTCIRCLE wasy 71 0 x ◖ Rightcircle wasy 74 0 x x RIGHTCIRCLE wasy 72 0 x ◗ -\def\LEFTcircle{\LEFTCIRCLE\kern-1em\Circle} wasysym -\def\RIGHTcircle{\RIGHTCIRCLE\kern-1em\Circle} wasysym +\def\LEFTcircle{\LEFTCIRCLE\kern-13.4mu\Circle} wasysym +\def\RIGHTcircle{\RIGHTCIRCLE\kern-13.4mu\Circle} wasysym # Defined by amsmath.sty @@ -790,7 +790,7 @@ APLup wasy 0 0 x x APLdown wasy 70 0 x x APLinput wasy 125 0 x x APLcomment wasy 127 0 x x -\def\APLinv{\div\kern-17mu\APLbox} wasysym +\def\APLinv{\div\kern-17.9mu\APLbox} wasysym APLuparrowbox wasy 110 0 x ⍐ APLdownarrowbox wasy 111 0 x ⍗ APLleftarrowbox wasy 112 0 x ⍇ @@ -801,11 +801,11 @@ Bowtie wasy 49 0 x ⋈ leftturn wasy 34 0 x ⟲ rightturn wasy 33 0 x ⟳ # diagrams -\def\photon{\AC\kern-3mu\AC\kern-3mu\AC\kern-3mu\AC} wasysym -lyxgluonelement wasy 80 0 x x notexisting -lyxgluonbelement wasy 81 0 x x notexisting -lyxgluoneelement wasy 82 0 x x notexisting -\def\gluon{\lyxgluonbelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluonelement\kern-3mu\lyxgluoneelement} wasysym +\def\photon{\AC\AC\AC\AC} wasysym +lyxgluonelement wasy 80 0 x x hiddensymbol +lyxgluonbelement wasy 81 0 x x hiddensymbol +lyxgluoneelement wasy 82 0 x x hiddensymbol +\def\gluon{\lyxgluonbelement\lyxgluonelement\lyxgluonelement\lyxgluonelement\lyxgluonelement\lyxgluonelement\lyxgluonelement\lyxgluoneelement} wasysym # special characters cent wasy 103 0 x �A2; permil wasy 104 0 x ‰ @@ -1110,20 +1110,21 @@ pod lyxblacktext 0 0 func x amsmath # mathtools.sty -\def\vcentcolon{:} mathrel : mathtools -\def\dblcolon{\vcentcolon\kern-8mu\vcentcolon} mathrel :: mathtools -\def\coloneqq{\vcentcolon\kern-7mu=} mathrel ≔ mathtools -\def\Coloneqq{\dblcolon\kern-7mu=} mathrel ::= mathtools -\def\coloneq{\vcentcolon\kern-7mu-} mathrel :- mathtools -\def\Coloneq{\dblcolon\kern-7mu-} mathrel ::- mathtools -\def\eqqcolon{=\kern-8mu\vcentcolon} mathrel ≕ mathtools -\def\Eqqcolon{=\kern-8mu\dblcolon} mathrel =:: mathtools -\def\eqcolon{-\kern-8mu\vcentcolon} mathrel -: mathtools -\def\Eqcolon{-\kern-8mu\dblcolon} mathrel -:: mathtools -\def\colonapprox{\vcentcolon\kern-7mu\approx} mathrel :≈ mathtools -\def\Colonapprox{\dblcolon\kern-7mu\approx} mathrel ::≈ mathtools -\def\colonsim{\vcentcolon\kern-7mu\sim} mathrel :∼ mathtools -\def\Colonsim{\dblcolon\kern-7mu\sim} mathrel ::∼ mathtools +vcentcolon cmr 58 58 mathrel : mathtools +ordinarycolon cmr 58 58 mathrel : mathtools +\def\dblcolon{\vcentcolon\kern-10.9mu\vcentcolon} mathrel :: mathtools +\def\coloneqq{\vcentcolon\kern-11.2mu=} mathrel ≔ mathtools +\def\Coloneqq{\dblcolon\kern-11.2mu=} mathrel ::= mathtools +\def\coloneq{\vcentcolon\kern-11.2mu-} mathrel :- mathtools +\def\Coloneq{\dblcolon\kern-11.2mu-} mathrel ::- mathtools +\def\eqqcolon{=\kern-11.2mu\vcentcolon} mathrel ≕ mathtools +\def\Eqqcolon{=\kern-11.2mu\dblcolon} mathrel =:: mathtools +\def\eqcolon{-\kern-11.2mu\vcentcolon} mathrel -: mathtools +\def\Eqcolon{-\kern-11.2mu\dblcolon} mathrel -:: mathtools +\def\colonapprox{\vcentcolon\kern-11.2mu\approx} mathrel :≈ mathtools +\def\Colonapprox{\dblcolon\kern-11.2mu\approx} mathrel ::≈ mathtools +\def\colonsim{\vcentcolon\kern-11.2mu\sim} mathrel :∼ mathtools +\def\Colonsim{\dblcolon\kern-11.2mu\sim} mathrel ::∼ mathtools # @@ -1152,7 +1153,7 @@ iffont cmsy \def\impliedby{\Longleftarrow} mathrel ⟸ amsmath \def\mapsto{\mapstochar\kern-9mu\rightarrow} mathrel ↤ \def\longmapsto{\mapstochar\kern-6mu\lyxbar\kern-11mu\rightarrow} mathrel ⟻ -\def\models{\vert\kern-7mu\lyxeq} mathrel ⊨ +\def\models{\vert\kern-3mu\lyxeq} mathrel ⊨ else \def\implies{=>} mathrel ⟹ amsmath \def\impliedby{<=} mathrel ⟸ amsmath @@ -1160,7 +1161,7 @@ endif iffont cmm \def\hookrightarrow{\lhook\kern-12mu\rightarrow} mathrel ↪ \def\hookleftarrow{\leftarrow\kern-12mu\rhook} mathrel ↩ -\def\bowtie{\triangleright\kern-6mu\triangleleft} mathrel ⋈ +\def\bowtie{\triangleright\kern-10mu\triangleleft} mathrel ⋈ endif iffont msa \def\dashrightarrow{\lyxdabar\lyxdabar\lyxright} mathrel ⤏ amssymb @@ -1171,7 +1172,7 @@ else endif \def\dasharrow{\dashrightarrow} mathrel ⤏ amssymb iffont msb -\def\Join{\ltimes\kern-18.5mu\rtimes} amssymb +\def\Join{\ltimes\kern-22mu\rtimes} amssymb else \def\Join{|x|} amssymb endif diff --git a/src/mathed/InsetMathKern.cpp b/src/mathed/InsetMathKern.cpp index 71723b9956..eb445c382b 100644 --- a/src/mathed/InsetMathKern.cpp +++ b/src/mathed/InsetMathKern.cpp @@ -49,7 +49,11 @@ void InsetMathKern::metrics(MetricsInfo & mi, Dimension & dim) const { dim.asc = 0; dim.des = 0; + // match em value used in mathed_*muskip + FontInfo const oldfont = mi.base.font; + mi.base.font.setFamily(SYMBOL_FAMILY); dim.wid = wid_.inPixels(mi.base); + mi.base.font = oldfont; } -- 2.39.2