Repository navigation
LaTeX reader: \DeclareMathOperator, optional arguments with a default, empty macro bodies - #23
Open
simonebortolin wants to merge 1 commit into
Open
simonebortolin wants to merge 1 commit into
simonebortolin wants to merge 1 commit into
Conversation
|
Pre-release NuGet package of c685a8a. Updated on every push, deleted when this PR is closed. |
… a default and empty macro bodies
\DeclareMathOperator{\name}{text} (and \DeclareMathOperator\name, starred or not) defines
\name as \operatorname{text} (\operatorname*{text}); a macro of \newcommand{\f}[n][default]
takes its first argument optional, [given] or the default, as \newenvironment does; an
empty body (\newcommand{\e}{}, \def\e{}) expands to nothing, not to an empty group. The
latex2mathml macro cases that were not expanded now are, but for
newcommand-optional-default, where latex2mathml takes the group after a macro whose one
argument is optional as that argument: LaTeX gives it its default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyVio98rJkziNnwWW9T1Mn
simonebortolin
force-pushed
the
claude/latex-macro-expansion
branch
from
November 9, 2026 21:46
3592cf9 to
c685a8a
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of a stack: main ← #22 ← this ← write-back (
NotWrittenBack).Expands the macros of
NotExpandedinLatex2MathMLCorpusTests:\DeclareMathOperator{\name}{text}(braced or bare name) is\newcommand{\name}{\operatorname{text}},\DeclareMathOperator*with\operatorname*, through the operator names of LaTeX reader: operator names alone and the amsmath names of two words #22.\newcommand{\f}[n][default]{…}: the first argument is optional,[given]or the default (also for a macro at the end of the input), with theOptionalArgumentof\newenvironment.\newcommand{\e}{},\def\e{},\newcommand{\h}[2]{}) expands to nothing: no⬚for the group of the body, while{}_a^b Xkeeps its empty base.newcommand-optional-defaultstays listed, asExpandedOtherwise:\newcommand{\greeting}[1][Hello]{#1} \greeting{world}isHelloworldin LaTeX (the one argument is the optional one,{world}follows as a group), where latex2mathml readsworld.Tests: 9 new cases of
ExpandsMacros. 6806/6806 on net10.0 and net8.0.🤖 Generated with Claude Code
https://claude.ai/code/session_01SyVio98rJkziNnwWW9T1Mn