Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Everymath #2461

Merged
merged 5 commits into from
Dec 28, 2024
Merged

Everymath #2461

merged 5 commits into from
Dec 28, 2024

Conversation

brucemiller
Copy link
Owner

Use \everymath, \everydisplay correctly. The latter is used (alone) for displayed math, the former for inline math. Add some tests.

@brucemiller brucemiller requested a review from dginev December 28, 2024 16:05
@dginev
Copy link
Collaborator

dginev commented Dec 28, 2024

Well, it is certainly more correct than before. But there are likely further hidden inaccuracies for more custom math environments.

As an example test of a subtlety, the left-arrow here surprised me in the PDF (and neither arrow shows up via this PR):

{
 \everymath={\leftarrow}
 \everydisplay={\rightarrow}
 \begin{equation}
  a+b
 \end{equation}
}

Copy link
Collaborator

@dginev dginev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge, just flagging that there are more icebergs out there...

@brucemiller
Copy link
Owner Author

Ah, yes. Painfully obvious, now that you point it out. Thanks!
So, here's a slightly scarier, but more complete version.

Copy link
Collaborator

@dginev dginev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge, nice upgrade.

return; },
properties => sub { RefStepID('equation') },
captureBody => 1);
beforeDigest => sub { $_[0]->beginMode('display_math'); },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice simplification. The cherry on the cake would be to switch the few cases of

beforeDigest => sub { $_[0]->beginMode('display_math'); }

to the abbreviated form of

mode => 'display_math'

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! I fell into that trap! (& wasted time). It's subtly different. That short form simply switches the mode (typically within an environment which establishes a grouping), whereas the commands in question like \lx@begin@displaymath come in pairs which will do beginMode and endMode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! mode also ends the mode at the end, indeed that slipped my mind. Apologies.

@brucemiller brucemiller merged commit f82b733 into master Dec 28, 2024
26 checks passed
@brucemiller brucemiller deleted the everymath branch December 28, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants