mathml转换:MathClass-rel不能正确显示<mrow>和<mfrac>

问题描述

以下代码是使用make4ht命令将tex转换为html的(结果)

<!DOCTYPE html> 
<html lang='en-US' xml:lang='en-US'> 
<head><title></title> 
<Meta charset='utf-8' /> 
<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=MML_HTMLorMML'></script>  
</head>
<body>
<div class='par-math-display'>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
    <mrow>
        <mo class='MathClass-rel'>∥</mo>
        <mi>x</mi>
        <mo class='MathClass-rel'>∥</mo> 
        <mo class='MathClass-rel'>=</mo> 
        <mfrac>
            <mrow>
                <mo class='MathClass-rel'>∥</mo>
                <mi>x</mi>
                <mo class='MathClass-rel'>∥</mo>
            </mrow> 
            <mrow>
                <mn>1</mn>
            </mrow>
        </mfrac>
    </mrow>
</math>
</div>
<p class='nopar'> and</p>
<div class='math-display'>
<math display='block' xmlns='http://www.w3.org/1998/Math/MathML'>
    <mrow>
        <mo class='MathClass-rel'>|</mo>
        <mi>x</mi>
        <mo class='MathClass-rel'>|</mo>
        <mo class='MathClass-rel'>=</mo> 
        <mfrac>
            <mrow>
                <mo class='MathClass-rel'>|</mo>
                <mi>x</mi>
                <mo class='MathClass-rel'>|</mo>
            </mrow> 
            <mrow>
                <mn>1</mn>
            </mrow>
        </mfrac>
    </mrow>
</math>
</div>
<p class='nopar'> </p> 
</body> 
</html>

显示

enter image description here

使用Chrome和Firefox。但是我想要的是以下图片(此图像是乳胶的pdf结果)

enter image description here

我对mathml不熟悉,但是我正在尝试,所以请提供任何帮助。

解决方法

你想要

   <mrow>
        <mo class='MathClass-rel'>∥</mo>
        <mi>x</mi>
        <mo class='MathClass-rel'>∥</mo> 
    </mrow>

所以两个||被拉伸到x的大小(即它们包含的修剪)

第一个错误地渲染,两个|| x周围的大小应与第二个示例中的相同,并带有|这似乎是一个mathjax问题,但是由于您不希望该布局反而在范数x周围添加了一个割线。