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

Base primitive improvements #2369

Merged
merged 14 commits into from
May 29, 2024
Merged

Base primitive improvements #2369

merged 14 commits into from
May 29, 2024

Conversation

brucemiller
Copy link
Owner

Fixes various little fidelity problems that turned up while playing with plain.tex.

  • recognize more font names
  • initialize State more like INITEX does (UC,LC codes, etc)
  • a bit better with \nonscript, '\fam`,
  • make \write expand in the special \the style ('XGeneralText` parameter type)
  • Various primitives, '\mathopen`, etc, should digest args
  • Fixup \left,\right processing to digest args while still grouping between them.

@brucemiller brucemiller requested a review from dginev May 29, 2024 01:27
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.

I am a little out of my depth on the TeX details, but tried to provide a first surface review.

plain.tex itself will certainly be the harsher arbiter here.

@@ -250,6 +250,7 @@ sub canAutoClose {
|| (($t == XML_ELEMENT_NODE) # otherwise must be element
&& !$node->getAttribute('_noautoclose') # without _noautoclose
&& ($node->getAttribute('_autoclose') # and either with _autoclose
|| $node->getAttribute('_autoopened') # or was autoopened
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this mean that the implied "default" now is for any Tag() marked as autoOpen => 1, it will also lead to autoClose => 1 ?

I see we have a special attribute _noautoclose that prevents autoclose, but it makes me wonder if we should also respect an explicit autoClose => 0 from Tag(). Or document that we won't, or...

Copy link
Owner Author

Choose a reason for hiding this comment

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

When you put it like that, it does seems too much, although it's probably correct most/all of the time? The problem element in this case was the ltx:text opened for font switches, so better to explicitly mark them as auto-closable, as well. patched...

$DELIMITER_MAP{ $$entry{char} } = $entry; }
# The \lx@left, \lx@right versions are like \left,\right but without any extra grouping
DefConstructor('\lx@left TeXDelimiter',
"?#hint(<ltx:XMHint/>)(#1)",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the idea behind the empty XMHint elements? I see they are used in a few definitions here. I wonder if they should carry more information to be useful - or are they already useful when empty?

I see the code adds them when the \left/\right is applied to a dot, which indeed has no visible trace in rendering. Maybe an attribute on XMHint could indicate some of that?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I inherited the hint from the previous code, but I doubt the hint is ever actually used. Probably put there either so there's at least 1 element, or "just in case".

@@ -537,21 +537,21 @@
</Math>
</equation>
<equation xml:id="S5.Ex21">
<Math mode="display" tex="\left|{a\over b}\right|" text="absolute-value@(a / b)" xml:id="S5.Ex21.m1">
<Math mode="display" tex="\left{\delimiter 69632778}{a\over b}\right{\delimiter 86414091}" text="delimited-⟨⟩@(a / b)" xml:id="S5.Ex21.m1">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, we may want to avoid the { and } entirely when reverting delimiters. The tex attribute on the Math above encounters an error in pdftex. What succeeded was the plainer form from parens.tex:

$\left\delimiter 69632778 {a\over b}\right \delimiter 86414091$
\bye

Since we have recently fixed a report about tex attribute reuse with TeX, I thought I would bring this up.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah, good catch. patched..

@brucemiller brucemiller merged commit 1438332 into master May 29, 2024
26 checks passed
@brucemiller brucemiller deleted the base-primitive-improvements branch May 29, 2024 18:37
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