Uunderdelimiter & friends and mathstyles
Hi, I noticed some odd behavior about \U{under,over}delimiter/\Udelimiter{under,over} related to the applied mathstyles for the nucleus: Take the following example \input luaotfload.sty \font\lmmath"Latin Modern Math:script=math,mode=base" \font\scriptlmmath"Latin Modern Math:script=math,mode=base" at 7pt \font\scriptscriptlmmath"Latin Modern Math:script=math,mode=base" at 5pt \textfont42=\lmmath \scriptfont42=\scriptlmmath \scriptscriptfont42=\scriptscriptlmmath $$ \Udelimiterunder42 "2192{\mathstyle x^L} \Udelimiterover42 "2192{\mathstyle x^L} \Uunderdelimiter42 "2192{\mathstyle x^L} \Uoverdelimiter42 "2192{\mathstyle x^L} $$ \bye In all four situations \mathstyle shows 1, but neither of the four x^L are actually set in \mathstyle 1 (crampeddisplay): \Udelimiterunder sets it's argument in the outer mathstyle. IMO this is the expected behavior but should be reflected in \mathstyle. \Udelimiterover sets it's argument in the outer mathstyle. IMO it should be cramped instead. \Uoverdelimiter sets it's argument in subscript style (cramped and one size smaller) Since there's nothing printed on top of it' argument, I think that superscript style would be better. (aka not cramped) In any case it should be reflected in \mathstyle. \Uunderdelimiter sets it's argument in superscript style (one size smaller) Since the delimiter is printed on top of it I think that subscript style would be better (aka cramped). In any case it should be reflected in \mathstyle. The patch at the end adapts both \mathstyle and changes the actually used styles. Best regards, Marcel diff --git a/source/texk/web2c/luatexdir/tex/mlist.c b/source/texk/web2c/luatexdir/tex/mlist.c index 2ac631ea3..71e7c88ea 100644 --- a/source/texk/web2c/luatexdir/tex/mlist.c +++ b/source/texk/web2c/luatexdir/tex/mlist.c @@ -2385,7 +2385,7 @@ static void make_over_delimiter(pointer q, int cur_style) pointer x, y, v; scaled shift_up, shift_down, clr, delta, wd; boolean stack; - x = clean_box(nucleus(q), sub_style(cur_style), cur_style, math_nucleus_list); + x = clean_box(nucleus(q), sup_style(cur_style), cur_style, math_nucleus_list); check_widths(q,x); y = do_delimiter(q, left_delimiter(q), cur_size, wd, true, cur_style, true, &stack, NULL, NULL); left_delimiter(q) = null; @@ -2416,7 +2416,7 @@ static void make_under_delimiter(pointer q, int cur_style) pointer x, y, v; scaled shift_up, shift_down, clr, delta, wd; boolean stack; - y = clean_box(nucleus(q), sup_style(cur_style), cur_style, math_nucleus_list); + y = clean_box(nucleus(q), sub_style(cur_style), cur_style, math_nucleus_list); check_widths(q,y); x = do_delimiter(q, left_delimiter(q), cur_size, wd, true, cur_style, true, &stack, NULL, NULL); left_delimiter(q) = null; @@ -2447,7 +2447,7 @@ static void make_delimiter_over(pointer q, int cur_style) pointer x, y, v; scaled shift_up, shift_down, clr, actual, wd; boolean stack; - y = clean_box(nucleus(q), cur_style, cur_style, math_nucleus_list); + y = clean_box(nucleus(q), cramped_style(cur_style), cur_style, math_nucleus_list); check_widths(q,y); x = do_delimiter(q, left_delimiter(q), cur_size + (cur_size == script_script_size ? 0 : 1), wd, true, cur_style, true, &stack, NULL, NULL); left_delimiter(q) = null; diff --git a/source/texk/web2c/luatexdir/tex/texmath.c b/source/texk/web2c/luatexdir/tex/texmath.c index 461a51578..0c0e8a9cc 100644 --- a/source/texk/web2c/luatexdir/tex/texmath.c +++ b/source/texk/web2c/luatexdir/tex/texmath.c @@ -1580,6 +1580,7 @@ static void scan_delimiter(pointer p, int r) void math_radical(void) { halfword q; + int new_mstyle; int chr_code = cur_chr; halfword options = 0; tail_append(new_node(radical_noad, chr_code)); @@ -1600,28 +1601,35 @@ void math_radical(void) } } radicaloptions(tail) = options; - if (chr_code == 0) + if (chr_code == 0) { /*tex \.{\\radical} */ scan_delimiter(left_delimiter(tail), tex_mathcode); - else if (chr_code == 1) + new_mstyle = cramped_style(m_style); + } else if (chr_code == 1) { /*tex \.{\\Uradical} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 2) + new_mstyle = cramped_style(m_style); + } else if (chr_code == 2) { /*tex \.{\\Uroot} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 3) + new_mstyle = cramped_style(m_style); + } else if (chr_code == 3) { /*tex \.{\\Uunderdelimiter} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 4) + new_mstyle = sub_style(m_style); + } else if (chr_code == 4) { /*tex \.{\\Uoverdelimiter} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 5) + new_mstyle = sup_style(m_style); + } else if (chr_code == 5) { /*tex \.{\\Udelimiterunder} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 6) + new_mstyle = m_style; + } else if (chr_code == 6) { /*tex \.{\\Udelimiterover} */ scan_delimiter(left_delimiter(tail), umath_mathcode); - else if (chr_code == 7) + new_mstyle = cramped_style(m_style); + } else if (chr_code == 7) /*tex \.{\\Uhextensible} */ scan_delimiter(left_delimiter(tail), umath_mathcode); else @@ -1645,12 +1653,12 @@ void math_radical(void) vlink(degree(tail)) = null; q = new_node(math_char_node, 0); nucleus(tail) = q; - (void) scan_math(nucleus(tail), cramped_style(m_style)); + (void) scan_math(nucleus(tail), new_mstyle); } } else { q = new_node(math_char_node, 0); nucleus(tail) = q; - (void) scan_math(nucleus(tail), cramped_style(m_style)); + (void) scan_math(nucleus(tail), new_mstyle); } }
On Sun, Apr 18, 2021 at 11:15 PM Marcel Fabian Krüger
Hi,
I noticed some odd behavior about \U{under,over}delimiter/\Udelimiter{under,over} related to the applied mathstyles for the nucleus: Take the following example
\input luaotfload.sty \font\lmmath"Latin Modern Math:script=math,mode=base" \font\scriptlmmath"Latin Modern Math:script=math,mode=base" at 7pt \font\scriptscriptlmmath"Latin Modern Math:script=math,mode=base" at 5pt \textfont42=\lmmath \scriptfont42=\scriptlmmath \scriptscriptfont42=\scriptscriptlmmath $$ \Udelimiterunder42 "2192{\mathstyle x^L} \Udelimiterover42 "2192{\mathstyle x^L} \Uunderdelimiter42 "2192{\mathstyle x^L} \Uoverdelimiter42 "2192{\mathstyle x^L} $$ \bye
In all four situations \mathstyle shows 1, but neither of the four x^L are actually set in \mathstyle 1 (crampeddisplay):
\Udelimiterunder sets it's argument in the outer mathstyle. IMO this is the expected behavior but should be reflected in \mathstyle.
\Udelimiterover sets it's argument in the outer mathstyle. IMO it should be cramped instead.
\Uoverdelimiter sets it's argument in subscript style (cramped and one size smaller) Since there's nothing printed on top of it' argument, I think that superscript style would be better. (aka not cramped) In any case it should be reflected in \mathstyle.
\Uunderdelimiter sets it's argument in superscript style (one size smaller) Since the delimiter is printed on top of it I think that subscript style would be better (aka cramped). In any case it should be reflected in \mathstyle.
The patch at the end adapts both \mathstyle and changes the actually used styles.
hm, changing these math stuff probably breaks backward compatibility --- better if can be implemented as an option. Can you send the two patches as separated files taking the latest commit from experimental as reference ? -- luigi
On Mon, Apr 19, 2021 at 11:57:23PM +0200, luigi scarso wrote:
On Sun, Apr 18, 2021 at 11:15 PM Marcel Fabian Krüger
wrote: Hi,
I noticed some odd behavior about \U{under,over}delimiter/\Udelimiter{under,over} related to the applied mathstyles for the nucleus: Take the following example
\input luaotfload.sty \font\lmmath"Latin Modern Math:script=math,mode=base" \font\scriptlmmath"Latin Modern Math:script=math,mode=base" at 7pt \font\scriptscriptlmmath"Latin Modern Math:script=math,mode=base" at 5pt \textfont42=\lmmath \scriptfont42=\scriptlmmath \scriptscriptfont42=\scriptscriptlmmath $$ \Udelimiterunder42 "2192{\mathstyle x^L} \Udelimiterover42 "2192{\mathstyle x^L} \Uunderdelimiter42 "2192{\mathstyle x^L} \Uoverdelimiter42 "2192{\mathstyle x^L} $$ \bye
In all four situations \mathstyle shows 1, but neither of the four x^L are actually set in \mathstyle 1 (crampeddisplay):
\Udelimiterunder sets it's argument in the outer mathstyle. IMO this is the expected behavior but should be reflected in \mathstyle.
\Udelimiterover sets it's argument in the outer mathstyle. IMO it should be cramped instead.
\Uoverdelimiter sets it's argument in subscript style (cramped and one size smaller) Since there's nothing printed on top of it' argument, I think that superscript style would be better. (aka not cramped) In any case it should be reflected in \mathstyle.
\Uunderdelimiter sets it's argument in superscript style (one size smaller) Since the delimiter is printed on top of it I think that subscript style would be better (aka cramped). In any case it should be reflected in \mathstyle.
The patch at the end adapts both \mathstyle and changes the actually used styles.
hm, changing these math stuff probably breaks backward compatibility --- better if can be implemented as an option. Can you send the two patches as separated files taking the latest commit from experimental as reference ?
The two diffs are attached. Marcel
On Mon, Apr 19, 2021 at 11:57 PM luigi scarso
On Sun, Apr 18, 2021 at 11:15 PM Marcel Fabian Krüger
wrote: Hi,
I noticed some odd behavior about \U{under,over}delimiter/\Udelimiter{under,over} related to the applied mathstyles for the nucleus: Take the following example
\input luaotfload.sty \font\lmmath"Latin Modern Math:script=math,mode=base" \font\scriptlmmath"Latin Modern Math:script=math,mode=base" at 7pt \font\scriptscriptlmmath"Latin Modern Math:script=math,mode=base" at 5pt \textfont42=\lmmath \scriptfont42=\scriptlmmath \scriptscriptfont42=\scriptscriptlmmath $$ \Udelimiterunder42 "2192{\mathstyle x^L} \Udelimiterover42 "2192{\mathstyle x^L} \Uunderdelimiter42 "2192{\mathstyle x^L} \Uoverdelimiter42 "2192{\mathstyle x^L} $$ \bye
In all four situations \mathstyle shows 1, but neither of the four x^L are actually set in \mathstyle 1 (crampeddisplay):
\Udelimiterunder sets it's argument in the outer mathstyle. IMO this is the expected behavior but should be reflected in \mathstyle.
\Udelimiterover sets it's argument in the outer mathstyle. IMO it should be cramped instead.
\Uoverdelimiter sets it's argument in subscript style (cramped and one size smaller) Since there's nothing printed on top of it' argument, I think that superscript style would be better. (aka not cramped) In any case it should be reflected in \mathstyle.
\Uunderdelimiter sets it's argument in superscript style (one size smaller) Since the delimiter is printed on top of it I think that subscript style would be better (aka cramped). In any case it should be reflected in \mathstyle.
The patch at the end adapts both \mathstyle and changes the actually used styles.
hm, changing these math stuff probably breaks backward compatibility --- better if can be implemented as an option. Can you send the two patches as separated files taking the latest commit from experimental as reference ?
-- luigi
------------------------------------------------------------------------ r7435 | luigi.scarso@gmail.com | 2021-04-20 14:27:58 +0200 (Tue, 20 Apr 2021) | 1 line \mathdefaultsmode: different radical style defaults (HH) ------------------------------------------------------------------------ -- luigi
participants (3)
-
luigi scarso
-
Marcel Fabian Krüger
-
Marcel Krüger