ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jim <zlists+context@jdvb.ca>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: How hard should something get \smash-ed ?
Date: Mon, 13 Jan 2025 11:21:06 -0400	[thread overview]
Message-ID: <Z4UvYisrkDZ1B1tq@x360.localdomain> (raw)
In-Reply-To: <2d2fa7b5-5e52-4786-8193-c1ab04d0b043@freedom.nl>

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
___________________________________________________________________________________

  reply	other threads:[~2025-01-13 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13  0:40 [NTG-context] " 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 [this message]
2025-01-13 14:58   ` Jim
2025-01-13 16:14     ` Hans Hagen via ntg-context
2025-01-13 16:28       ` Jim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z4UvYisrkDZ1B1tq@x360.localdomain \
    --to=zlists+context@jdvb.ca \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).