My task is to convert \overline
symbol to \overleftrightarrow
and \oversegment
to \overline
. The problem is that this is what I get on input (which is fundamentally wrong I know) but I can't modify it.
So based on this source: http://docs.mathjax.org/en/latest/tex.html#defining-tex-macros
I defined my macros:
MathJax.Hub.Config({
TeX: {
Macros: {
overline: ["{\\overleftrightarrow{#1}}", 1],
oversegment: ["{\\overline{#1}}", 1]
}
}
});
The problem is that when I have the input with \oversegment
, it gets converted by second macro to \overline
, and then it gets converted again by first macro to \overleftrightarrow
, which is wrong. I want it converted only once and make it final.
There isn't an easy way given the way macros are processed. The best way seems to be to replicate the original function in the TeX input jax, i.e., add this function to your inline configuration block.
<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready", function () {
var MML = MathJax.ElementJax.mml;
MathJax.InputJax.TeX.Definitions.Add({
macros: {
oversegment: ['UnderOver','00AF']
}
});
});
</script>