Giter VIP home page Giter VIP logo

Comments (5)

dpvc avatar dpvc commented on May 18, 2024

OK, I tracked this down. First recall that the definition of \eqno that is in use by IEEE is essentially

\def\eqno#1{\tag*{$#1$}}

which was the solution I proposed for them in the discussion we had earlier.

The problem is that the \eqno uses dollar sign delimiters, and that interacts badly with the dollar signs in the \hbox. That is, after the macro replacement, the text is

\tag*{$\hbox{(6$^\prime$)}$}

and so the inner dollar signs cause the contents of the \tag to have two math blocks, \hbox{(6 and )}, both of which have unbalanced braces.

One possible solution would be to use

\def\eqn#1{\tag*{\(# 1\)}}   % space added between # and 1 to prevent autolink to issue 1

instead, so that it uses the alternative math delimiters \(...\) which won't interfere with the inner ones (unless the inner \hbox uses \(...\) as well). Unfortunately there is a problem: a bug in MathJax fails to properly handle the nesting of \(\hbox{$...$}\). It is easily fixed, and I'll make a test branch for the fix shortly, but it's not in the current version, so this redefinition won't work until the bug is fixed. Sigh.

Davide

from mathjax.

dpvc avatar dpvc commented on May 18, 2024

OK, I've put my fix for the nesting problem into the issue36 branch of my fork of MathJax for review. The issue was that when a \( delimiter is found and is followed by a $ before the closing \) was found, the matching was switched to the $ rather than continuing to search for \).

This still won't handle the SAME delimiters being nested, but that really shouldn't be occurring anyway.

Davide

from mathjax.

fred-wang avatar fred-wang commented on May 18, 2024

Is the following a correct reduced testcase?

\( \hbox{6$^\prime$} \)

from mathjax.

dpvc avatar dpvc commented on May 18, 2024

No, it would need to be

$$\hbox{\(\hbox{6$^\prime$}\)}$$

The nesting problem was when looking for math inside text-mode inside math-mode. It is not a problem with tex2jax, but rather with the treatment of text-mode inside math-mode.

Davide

from mathjax.

fred-wang avatar fred-wang commented on May 18, 2024

OK, thanks.
I've added a reftest

LaTeXToMathML/missing-brace-1.html

==> In testsuite

from mathjax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.