ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] How hard should something get \smash-ed ?
@ 2025-01-13  0:40 Jim
  2025-01-13  6:44 ` [NTG-context] " Mikael Sundqvist
  0 siblings, 1 reply; 7+ messages in thread
From: Jim @ 2025-01-13  0:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

In plain TeX,

$$\smash{\sum_0^n}$$

is set in \displaystyle, just like

$$\smash{\sum_0^n}$$


However, ConTeXt

\starttext
$$\smash{\sum^0_n}$$
\stoptext

outputs the above in \textstyle, whereas

\starttext
$$\sum^0_n$$
\stoptext

is in (of course(?)) \displaystyle.

Is this difference intentional?

Thanks.

                                Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13  0:40 [NTG-context] How hard should something get \smash-ed ? Jim
@ 2025-01-13  6:44 ` Mikael Sundqvist
  2025-01-13  7:49   ` Hans Hagen via ntg-context
  2025-01-13 14:58   ` Jim
  0 siblings, 2 replies; 7+ messages in thread
From: Mikael Sundqvist @ 2025-01-13  6:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 834 bytes --]

Hi,

On Mon, Jan 13, 2025 at 1:43 AM Jim <zlists+context@jdvb.ca> wrote:

> Hi,
>
> In plain TeX,
>
> $$\smash{\sum_0^n}$$
>
> is set in \displaystyle, just like
>
> $$\smash{\sum_0^n}$$
>
>
> However, ConTeXt
>
> \starttext
> $$\smash{\sum^0_n}$$
> \stoptext
>
> outputs the above in \textstyle, whereas
>
> \starttext
> $$\sum^0_n$$
> \stoptext
>
> is in (of course(?)) \displaystyle.
>
> Is this difference intentional?
>

Thanks for reporting. I don't think it is intentional. (Can you show your
real world example where \smash is needed? It seems to not really be used
in any macro in ConTeXt.)

/Mikael

PS $$ is not meant to be used in ConTeXt. If you want inline math in
display style, use \dm {}, and if you want displayed formulas in display
style, use \startformula \stopformula.

[-- Attachment #1.2: Type: text/html, Size: 1281 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13  6:44 ` [NTG-context] " Mikael Sundqvist
@ 2025-01-13  7:49   ` Hans Hagen via ntg-context
  2025-01-13 15:21     ` Jim
  2025-01-13 14:58   ` Jim
  1 sibling, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2025-01-13  7:49 UTC (permalink / raw)
  To: ntg-context; +Cc: Hans Hagen

On 1/13/2025 7:44 AM, Mikael Sundqvist wrote:
> Hi,
> 
> On Mon, Jan 13, 2025 at 1:43 AM Jim <zlists+context@jdvb.ca 
> <mailto:zlists%2Bcontext@jdvb.ca>> wrote:
> 
>     Hi,
> 
>     In plain TeX,
> 
>     $$\smash{\sum_0^n}$$
> 
>     is set in \displaystyle, just like
> 
>     $$\smash{\sum_0^n}$$
> 
> 
>     However, ConTeXt
> 
>     \starttext
>     $$\smash{\sum^0_n}$$
>     \stoptext
> 
>     outputs the above in \textstyle, whereas
> 
>     \starttext
>     $$\sum^0_n$$
>     \stoptext
> 
>     is in (of course(?)) \displaystyle.
> 
>     Is this difference intentional?
> 
> 
> Thanks for reporting. I don't think it is intentional. (Can you show 
> your real world example where \smash is needed? It seems to not really 
> be used in any macro in ConTeXt.)
> 
> /Mikael
> 
> PS $$ is not meant to be used in ConTeXt. If you want inline math in 
> display style, use \dm {}, and if you want displayed formulas in display 
> style, use \startformula \stopformula.


% put this in cont-new.mkxl

\unprotect

\protected\def\syst_boxes_math_set_nextbox#1%
   {\setbox\nextbox\hbox\expandafter\bgroup
      \expandafter\Ustartmathmode\the\mathstyle
      \mathsurround\zeropoint{#1}%
      \Ustopmathmode
    \egroup}

\protect

to get this right

\starttext

\ruledhbox{\smash{$\sum^0_n$}} \blank

\ruledhbox{\smash{$\displaystyle\sum^0_n$}} \blank

\ruledhbox{$\smash{\sum^0_n}$} \blank

\ruledhbox{$\displaystyle\smash{\sum^0_n}$} \blank

\stoptext

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13  6:44 ` [NTG-context] " Mikael Sundqvist
  2025-01-13  7:49   ` Hans Hagen via ntg-context
@ 2025-01-13 14:58   ` Jim
  2025-01-13 16:14     ` Hans Hagen via ntg-context
  1 sibling, 1 reply; 7+ messages in thread
From: Jim @ 2025-01-13 14:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Mikael et al,

On Mon, Jan 13, 2025 at 07:44 (+0100), Mikael Sundqvist wrote:

> Hi,

> On Mon, Jan 13, 2025 at 1:43 AM Jim <zlists+context@jdvb.ca> wrote:

>> Hi,

>> In plain TeX,

>> $$\smash{\sum_0^n}$$

>> is set in \displaystyle, just like

>> $$\smash{\sum_0^n}$$


>> However, ConTeXt

>> \starttext
>> $$\smash{\sum^0_n}$$
>> \stoptext

>> outputs the above in \textstyle, whereas

>> \starttext
>> $$\sum^0_n$$
>> \stoptext

>> is in (of course(?)) \displaystyle.

>> Is this difference intentional?


> Thanks for reporting. I don't think it is intentional. (Can you show your
> real world example where \smash is needed? It seems to not really be used
> in any macro in ConTeXt.)

At the risk of citing an example using a deprecated feature, in
        https://wiki.contextgarden.net/Tables/Deprecated/Table
the following example is shown:

\starttable[|M|c|]
\HL
\VL \VL a \VL \AR
\DC \DL[1] \DR
\VL \smash{\displaystyle\sum_0^N} \VL b \VL \AR
\DC \DL[1] \DR
\VL \VL c \VL \AR
\HL
\stoptable

Without \smash{}, the second row is higher than (presumably) whomever wrote
the example wanted.  I can imagine someone wanting to do something like
that in another type of table, even using a non-deprecated type of table.

(I added \displaystyle to the example yesterday to make it do what the
example's author intended.)


> PS $$ is not meant to be used in ConTeXt.  If you want inline math in
> display style, use \dm {}, and if you want displayed formulas in display
> style, use \startformula \stopformula.

Yeah...  as a very-long-time plain TeX user, old habits die hard (and I am
not using any math in my current main use of ConTeXt).

The main reason for using $$ in my report was because that is what is in
the wiki page.  (And the issue is still there with \startformula and
\stopformula anyway.)

Cheers.
                                        Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13  7:49   ` Hans Hagen via ntg-context
@ 2025-01-13 15:21     ` Jim
  0 siblings, 0 replies; 7+ messages in thread
From: Jim @ 2025-01-13 15:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans (et al),

On Mon, Jan 13, 2025 at 08:49 (+0100), Hans Hagen via ntg-context wrote:

> On 1/13/2025 7:44 AM, Mikael Sundqvist wrote:
>> Hi,

>> On Mon, Jan 13, 2025 at 1:43 AM Jim <zlists+context@jdvb.ca
>> <mailto:zlists%2Bcontext@jdvb.ca>> wrote:

>> Hi,

>> In plain TeX,

>>     $$\smash{\sum_0^n}$$

>> is set in \displaystyle, just like

>>     $$\smash{\sum_0^n}$$


>> However, ConTeXt

>>     \starttext
>>     $$\smash{\sum^0_n}$$
>>     \stoptext

>> outputs the above in \textstyle, whereas

>>     \starttext
>>     $$\sum^0_n$$
>>     \stoptext

>> is in (of course(?)) \displaystyle.

>> Is this difference intentional?


>> Thanks for reporting. I don't think it is intentional. (Can you show
>> your real world example where \smash is needed? It seems to not really
>> be used in any macro in ConTeXt.)

>> /Mikael

>> PS $$ is not meant to be used in ConTeXt. If you want inline math in
>> display style, use \dm {}, and if you want displayed formulas in display
>> style, use \startformula \stopformula.


> % put this in cont-new.mkxl

> \unprotect

> \protected\def\syst_boxes_math_set_nextbox#1%
>   {\setbox\nextbox\hbox\expandafter\bgroup
>      \expandafter\Ustartmathmode\the\mathstyle
>      \mathsurround\zeropoint{#1}%
>      \Ustopmathmode
>    \egroup}

> \protect

> to get this right

> \starttext

> \ruledhbox{\smash{$\sum^0_n$}} \blank

> \ruledhbox{\smash{$\displaystyle\sum^0_n$}} \blank

> \ruledhbox{$\smash{\sum^0_n}$} \blank

> \ruledhbox{$\displaystyle\smash{\sum^0_n}$} \blank

> \stoptext

Thanks Hans, that fixes that up nicely.

(And it is always nice to see a fix which actually makes the codebase (a
bit) shorter.

                                Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13 14:58   ` Jim
@ 2025-01-13 16:14     ` Hans Hagen via ntg-context
  2025-01-13 16:28       ` Jim
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen via ntg-context @ 2025-01-13 16:14 UTC (permalink / raw)
  To: Jim, mailing list for ConTeXt users; +Cc: Hans Hagen

On 1/13/2025 3:58 PM, Jim wrote:

> \starttable[|M|c|]
> \HL
> \VL \VL a \VL \AR
> \DC \DL[1] \DR
> \VL \smash{\displaystyle\sum_0^N} \VL b \VL \AR
> \DC \DL[1] \DR
> \VL \VL c \VL \AR
> \HL
> \stoptable

\bTABLE[offset=.5ex]
\bTR \bTD[ny=3,align=lohi] \dm {\sum_0^N} \eTD \bTD a \eTD \eTR
\bTR                                           \bTD b \eTD \eTR
\bTR                                           \bTD c \eTD \eTR


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [NTG-context] Re: How hard should something get \smash-ed ?
  2025-01-13 16:14     ` Hans Hagen via ntg-context
@ 2025-01-13 16:28       ` Jim
  0 siblings, 0 replies; 7+ messages in thread
From: Jim @ 2025-01-13 16:28 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Mon, Jan 13, 2025 at 17:14 (+0100), Hans Hagen wrote:

> On 1/13/2025 3:58 PM, Jim wrote:

>> \starttable[|M|c|]
>> \HL
>> \VL \VL a \VL \AR
>> \DC \DL[1] \DR
>> \VL \smash{\displaystyle\sum_0^N} \VL b \VL \AR
>> \DC \DL[1] \DR
>> \VL \VL c \VL \AR
>> \HL
>> \stoptable

> \bTABLE[offset=.5ex]
> \bTR \bTD[ny=3,align=lohi] \dm {\sum_0^N} \eTD \bTD a \eTD \eTR
> \bTR                                           \bTD b \eTD \eTR
> \bTR                                           \bTD c \eTD \eTR

Thanks Hans,

I took the liberty of adding that to the (deprecated) TaBlE page for the
benefit of anyone trying to undeprecate themselves.

                                   Jim
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-01-13 16:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-13  0:40 [NTG-context] How hard should something get \smash-ed ? Jim
2025-01-13  6:44 ` [NTG-context] " Mikael Sundqvist
2025-01-13  7:49   ` Hans Hagen via ntg-context
2025-01-13 15:21     ` Jim
2025-01-13 14:58   ` Jim
2025-01-13 16:14     ` Hans Hagen via ntg-context
2025-01-13 16:28       ` Jim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).