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

In TeX input, ` should produce left single quote. (‘) #402

Closed
jdh8 opened this issue Mar 3, 2013 · 11 comments

Comments

Projects
None yet
4 participants
@jdh8
Copy link
Contributor

commented Mar 3, 2013

In TeX, ` produces left single quote both in text mode and in math mode. This is "function application" in set theory.

If appends a function, should it replace⁡`?

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Mar 4, 2013

I'm not sure what is your idea. As I see, MathJax only produces

<mrow class="MJX-TeXAtom-ORD">
   <mo>`</mo>
</mrow>

Are you suggesting to append a <mo>&#x2061;<!-- &ApplyFunction; --></mo>?. Or that "‘" should be used instead of "⁡" everywhere? It seems to me that the semantic of the invisible apply function is well-defined in Unicode while the character ` only has the apply function meaning in set theory. Perhaps in other fields it has a different meaning.

@jdh8

This comment has been minimized.

Copy link
Contributor Author

commented Mar 8, 2013

TeX renders as &amp;#x2018; instead of itself.
Of course \sin x produces <mi>sin</mi><mo>&#x2061;</mo><mi>x</mi>, but for \sin`x, can the &#x2061; be omitted?

@pkra

This comment has been minimized.

Copy link
Member

commented Mar 8, 2013

If ` appends a function, should it replace ⁡

I think the answer is simply "no" -- &#x2061; should be there.

I don't know if MathML allows for maybe a style-setting to visualize such invisible characters. From reading the specs, I see that in PresentationMathML &#x2061; is usually followed by something like <mo>(</mo> .... So that construction seems the right way to go.

Not sure what you could do with ContentMathML to abstract that away but ContentMathML is currently not available in MathJax anyway. For TeX you could maybe build a macro that combines ` with another operatorname, but in MathJax setting that's probably a bit trickier.

@jdh8

This comment has been minimized.

Copy link
Contributor Author

commented Mar 10, 2013

OK, but should produce &amp;#x2018;. The grave accent can be produced by \.

@dpvc

This comment has been minimized.

Copy link
Member

commented Mar 10, 2013

You can get ``` to produce &#x2018; by adding

<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
  MathJax.InputJax.TeX.Definitions.remap["`"]="2018";
});
</script>

before the script that loads MathJax.js itself.

Since \`` is a text-mode macro not a math-mode one, you _can't_ use that to obtain the grave accent. And although \gravedoes produce a grave accent, it requires something to be an accent over, and the placement of it will depend on what follows. Also, the MathML that this produces will be more complicated, and not what is currently produced by ```. For that, you could use\mmlToken{mo}{}.

@dpvc

This comment has been minimized.

Copy link
Member

commented Mar 10, 2013

If you want to prevent the &#x2061; when a named function is followed by ```, you could add

<script type="text/x-mathjax-config">
  MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
    var TEX = MathJax.InputJax.TeX, STACKITEM = TEX.Stack.Item;
    var MML = MathJax.ElementJax.mml;
    TEX.Definitions.remap["`"] = "2018";
    var CHECK = STACKITEM.fn.prototype.checkItem;
    STACKITEM.fn.Augment({
      checkItem: function (item) {
        if (this.data[0] && item.type === "mml" && item.data[0] &&
            item.data[0].isa(MML.mo) && item.data[0].data.join("") === "\u2018") {
              return [this.data[0],item];
        }
        return CHECK.call(this,item);
      }
    });
  });
</script>

before the script that loads MathJax.js itself.

@jdh8

This comment has been minimized.

Copy link
Contributor Author

commented Mar 10, 2013

Thanks! They both work.

@jdh8 jdh8 closed this Mar 10, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Mar 10, 2013

I'm leaving this open so that I remember to add the remapping in the TeX input jax.

@dpvc dpvc reopened this Mar 10, 2013

@ghost ghost assigned dpvc Apr 15, 2013

dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 16, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Apr 16, 2013

The issue402 branch of my fork of MathJax includes the fix to map ``` to U+2018.

@fred-wang

This comment has been minimized.

Copy link
Contributor

commented Apr 19, 2013

This will be tested by

LaTeXToMathML/basic-operators/remap-1.html

=> In testsuite, Ready for release

dpvc pushed a commit to dpvc/MathJax that referenced this issue Apr 19, 2013

@dpvc

This comment has been minimized.

Copy link
Member

commented Apr 19, 2013

=> Merged

@dpvc dpvc closed this May 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.