MathJax显示了额外的参数

问题描述 投票:1回答:1

我正在Moodle网站上使用乳胶。我对MathJax有问题。它两次显示每个方程式的第一个参数(大多数等于等号=的左侧)。我使用以下代码:

<p><span id="docs-internal-guid-618520b2-7fff-707e-1f90-60e30cf92cc1"></span></p>
<p style="font-weight: bold; text-align: center;"><b id="docs-internal-guid-618520b2-7fff-707e-1f90-60e30cf92cc1" style="font-size: 1rem;"><img src="https://lh5.googleusercontent.com/qE_PaXNcEbECok0Xfbj89ubXSw3h-Yt3l_HcM3Xai_QlQcLo9suGkEIX_x1bONqRLotS7QFRogRdEytPiqBHcATwjpiUBUaFLzs5GzxTW1zNWjeZe0gFyrvejnNMmJI5MNaEk0Bnmp8" alt="angle" width="500" height="524" class="img-responsive atto_image_button_text-bottom"></b></p>
<p
    style="text-align: left;"><span style="font-size: 1rem;"></span></p>
    <ul style="">
        <li dir="ltr" style="font-weight: bold;">
            <p dir="ltr" role="presentation" style=""><span style="font-weight: normal;">\(r_S\) = the vector from the center of the earth to the satellite</span></p>
        </li>
        <li dir="ltr" style="">
            <p dir="ltr" role="presentation">\(r_e\) = the vector from the center of the earth to the earth station</p>
        </li>
        <li dir="ltr" style="">
            <p dir="ltr" role="presentation">d = the vector from the earth station to the satellite</p>
        </li>
        <li dir="ltr" style="">
            <p dir="ltr" role="presentation">These vectors are in the same plane and from a triangle</p>
        </li>
        <li dir="ltr" style="">
            <p dir="ltr" role="presentation">\(\gamma\) = angle measured between re and \(r_S\) , i.e. the angle between the earth station and the satellite.</p>
        </li>
        <li dir="ltr" style="">
            <p dir="ltr" role="presentation" style="">\(\psi\) = angle measured from \(r_e\) to d</p>
        </li>
    </ul><span id="docs-internal-guid-da2fbfc2-7fff-6714-037c-8f92356d7f04"><ul style=""><li dir="ltr" style=""><p dir="ltr" role="presentation" style="">\(\gamma\) can be calculated from the following equation:<br><br><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>cos</mi><mo>(</mo><mi>γ</mi><mo>)</mo><mo>=</mo><mi>cos</mi><mo>(</mo><msub><mi>L</mi><mi>e</mi></msub><mo>)</mo><mi>cos</mi><mo>(</mo><msub><mi>L</mi><mi>S</mi></msub><mo>)</mo><mi>cos</mi><mo>(</mo><msub><mi>l</mi><mi>S</mi></msub><mo>-</mo><msub><mi>l</mi><mi>e</mi></msub><mo>)</mo><mo>+</mo><mi>sin</mi><mo>(</mo><msub><mi>L</mi><mi>e</mi></msub><mo>)</mo><mi>sin</mi><mo>(</mo><msub><mi>L</mi><mi>S</mi></msub><mo>)</mo><annotation encoding="LaTeX">$$\cos (\gamma ) = \cos (L_e)\cos (L_S)\cos (l_S-l_e)+\sin (L_e)\sin(L_S)$$</annotation></semantics></math></p></li></ul><p dir="ltr" style="">Where:</p><ul style=""><ul style=""><li dir="ltr" style=""><p dir="ltr" role="presentation">\(L_e\) = related to the earth station north Latitude (earth station is north of equator)</p></li><li dir="ltr" style=""><p dir="ltr" role="presentation">\(L_S\) = Subsatellite point at north Latitude</p></li><li dir="ltr" style=""><p dir="ltr" role="presentation">\(l_e\) = number in degree in longitude that earth station is west from the Greenwich meridian</p></li><li dir="ltr" style=""><p dir="ltr" role="presentation" style="">\(l_S\) = west longitude</p></li></ul></ul><span id="docs-internal-guid-c877d197-7fff-28c1-d222-3a1f1e55fc7b"><ul style=""><li dir="ltr" style=""><p dir="ltr" role="presentation" style="">The law of cosines allow us to relate the magnitudes of the vectors joining the center of the earth, the satellite, and the earth station. Therefore, the distance between earth&nbsp; station and satellite:</p></li></ul></span>
    <math
        xmlns="http://www.w3.org/1998/Math/MathML">
        <semantics>
            <annotation encoding="LaTeX">\(d = r_S \left[1+\left(\frac{r_e}{r_s}\right)^2-2\left(\frac{r_e}{r_s}\right)\cos(\gamma)\right]^\frac{1}{2}\)</annotation>
        </semantics>
        </math><br></span><br>
        <p></p>
        <p style=""><span style=""></span></p>
        <p dir="ltr" style="">Since the local and horizontal plane at the earth station is perpendicular to the \(r_e\). The elevation angle, El, is related to the central angle \(\psi\) by:</p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>E</mi><mi>l</mi><mo>=</mo><mi>Ψ</mi><mo>-</mo><mn>90</mn><mo>°</mo><annotation encoding="LaTeX">$$El= \Psi- 90^{\circ}$$</annotation></semantics></math>
        <p></p>
        <p style=""><span style=""></span></p>
        <p dir="ltr">From the law of sines:</p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mfrac><msub><mi>r</mi><mi>s</mi></msub><mrow><mi>sin</mi><mo>(</mo><mi>Ψ</mi><mo>)</mo></mrow></mfrac><mo>=</mo><mfrac><mi>d</mi><mrow><mi>sin</mi><mo>(</mo><mi>γ</mi><mo>)</mo></mrow></mfrac><annotation encoding="LaTeX">$$\frac{r_s}{\sin(\Psi)}=\frac{d}{\sin(\gamma)}$$</annotation></semantics></math>
        <p></p>
        <p style=""><span style=""><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>cos</mi><mo>(</mo><mi>Ψ</mi><mo>-</mo><mn>90</mn><mo>°</mo><mo>)</mo><mo>=</mo><mi>sin</mi><mo>(</mo><mi>Ψ</mi><mo>)</mo><mo>=</mo><mi>cos</mi><mrow><mi>E</mi><mi>l</mi></mrow><annotation encoding="LaTeX">$$\cos(\Psi-90^{\circ}) = \sin(\Psi)=\cos{El}$$</annotation></semantics></math></span></p>
        <p
            style=""><span style=""></span></p>
            <p dir="ltr">Combining the above three equations:</p>
            <p dir="ltr"></p><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>cos</mi><mo>(</mo><mi>E</mi><mi>l</mi><mo>)</mo><mo>=</mo><msub><mi>r</mi><mi>s</mi></msub><mo>×</mo><mfrac><mrow><mi>sin</mi><mo>(</mo><mi>γ</mi><mo>)</mo></mrow><mi>d</mi></mfrac><annotation encoding="LaTeX">$$\cos(El) = r_s \times \frac{\sin(\gamma)}{d} $$</annotation></semantics></math><br><span><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mo>&nbsp;&nbsp;</mo><mo>&nbsp;&nbsp;</mo><mo>&nbsp;</mo><mo>&nbsp;</mo><mo>&nbsp;</mo><mo>=</mo><mfrac><mrow><mi>sin</mi><mo>(</mo><mi>γ</mi><mo>)</mo></mrow><msup><mfenced close="]" open="["><mrow><mn>1</mn><mo>+</mo><msup><mfenced><mfrac><msub><mi>r</mi><mi>e</mi></msub><msub><mi>e</mi><mi>s</mi></msub></mfrac></mfenced><mn>2</mn></msup><mo>-</mo><mn>2</mn><mfenced><mfrac><msub><mi>r</mi><mi>e</mi></msub><msub><mi>r</mi><mi>s</mi></msub></mfrac></mfenced><mi>cos</mi><mo>(</mo><mi>γ</mi><mo>)</mo></mrow></mfenced><mfrac><mn>1</mn><mn>2</mn></mfrac></msup></mfrac><annotation encoding="LaTeX">$$\quad \quad~~~=\frac{\sin(\gamma)}{\left[1+\left(\frac{r_e}{e_s}\right)^2 -2\left(\frac{r_e}{r_s}\right)\cos(\gamma)\right]^\frac{1}{2}}$$</annotation></semantics></math></span><br><br>
            <span
                id="docs-internal-guid-13cec965-7fff-31c9-595f-a0530817198a">
                <h3><span><span><b>Elevation Angle Calculation of GEO Satellite</b></span></span>
                </h3>
                <p><span><span></span></span>
                </p>
                <p dir="ltr">For Geostationary Satellite:</p>
                <ul>
                    <li dir="ltr">
                        <p dir="ltr" role="presentation">Subsatellite point is on the equator at longitude \(l_S\) and the Latitude \(L_S\) is 0.</p>
                    </li>
                    <li dir="ltr">
                        <p dir="ltr" role="presentation">Geosynchronous radius \(r_S \)= 42,164.17 Km</p>
                    </li>
                    <li dir="ltr">
                        <p dir="ltr" role="presentation">Since \(L_S\) = 0,<br><br><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>cos</mi><mo>(</mo><mi>γ</mi><mo>)</mo><mo>=</mo><mi>c</mi><mi>o</mi><mi>s</mi><mo>(</mo><msub><mi>L</mi><mi>e</mi></msub><mo>)</mo><mo>×</mo><mi>cos</mi><mo>(</mo><msub><mi>l</mi><mi>s</mi></msub><mo>-</mo><msub><mi>l</mi><mi>e</mi></msub><mo>)</mo><annotation encoding="LaTeX">$$\cos (\gamma) = cos (L_e) \times \cos (l_s-l_e)$$</annotation></semantics></math></p>
                    </li>
                    <li dir="ltr">
                        <p dir="ltr" role="presentation">Since \(r_S\)=42,164.17 Km and \(r_e\) = 6378.17 Km, hence&nbsp;<br><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mi>d</mi><mo>=</mo><mn>42</mn><mo>,</mo><mn>164</mn><mo>.</mo><mn>17</mn><msup><mfenced close="]" open="["><mrow><mn>1</mn><mo>.</mo><mn>02288235</mn><mo>-</mo><mn>0</mn><mo>.</mo><mn>30253825</mn><mo>×</mo><mi>cos</mi><mo>(</mo><mi>γ</mi><mo>)</mo></mrow></mfenced><mfrac><mn>1</mn><mn>2</mn></mfrac></msup><annotation encoding="LaTeX">$$d= 42,164.17 \left[1.02288235 - 0.30253825 \times \cos (\gamma)\right]^\frac{1}{2}$$</annotation></semantics></math><br>
                            <math
                                xmlns="http://www.w3.org/1998/Math/MathML">
                                <semantics>
                                    <mi>cos</mi>
                                    <mo>(</mo>
                                    <mi>E</mi>
                                    <mi>l</mi>
                                    <mo>)</mo>
                                    <mo>=</mo>
                                    <mfrac>
                                        <mrow>
                                            <mi>sin</mi>
                                            <mo>(</mo>
                                            <mi>γ</mi>
                                            <mo>)</mo>
                                        </mrow>
                                        <msup>
                                            <mfenced close="]" open="[">
                                                <mrow>
                                                    <mn>1</mn>
                                                    <mo>.</mo>
                                                    <mn>02288235</mn>
                                                    <mo>-</mo>
                                                    <mn>0</mn>
                                                    <mo>.</mo>
                                                    <mn>32053825</mn>
                                                    <mi>cos</mi>
                                                    <mo>(</mo>
                                                    <mi>γ</mi>
                                                    <mo>)</mo>
                                                </mrow>
                                            </mfenced>
                                            <mfrac>
                                                <mn>1</mn>
                                                <mn>2</mn>
                                            </mfrac>
                                        </msup>
                                    </mfrac>
                                    <annotation encoding="LaTeX">$$\cos(El) = \frac{\sin (\gamma)}{\left[1.02288235 -0.32053825\cos(\gamma)\right]^\frac{1}{2}}$$</annotation>
                                </semantics>
                                </math>
                        </p>
                    </li>
                </ul><b><b><br></b></b>
                </span><br><br>
                <p></p>

如下图所示,它在输出中显示了多余的字母和重复的方程式!我尝试创建另一个页面,结果是相同的。任何帮助都需要提前感谢。enter image description here

php moodle mathjax mathml
1个回答
0
投票

主要问题是您的MathML格式错误。特别是<semantics>元素无效。 <semantics>的内容应为单个MathML节点,后接零个或多个<annotation><annotation-xml>节点。以您的情况为例,例如:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <mi>E</mi>
    <mi>l</mi>
    <mo>=</mo>
    <mi>Ψ</mi>
    <mo>-</mo>
    <mn>90</mn>
    <mo>°</mo>
    <annotation encoding="LaTeX">$$El= \Psi- 90^{\circ}$$</annotation>
  </semantics>
</math>

<annotation>节点之前有7个MathML节点。因为仅显示<semantics>元素的第一个子元素,所以在这种情况下,将仅显示“ E”。您需要将MathML包裹在<mrow>中,以使完整表达式成为<semantics>节点的第一个子代:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <mrow>
      <mi>E</mi>
      <mi>l</mi>
      <mo>=</mo>
      <mi>Ψ</mi>
      <mo>-</mo>
      <mn>90</mn>
      <mo>°</mo>
    </mrow>
    <annotation encoding="LaTeX">$$El= \Psi- 90^{\circ}$$</annotation>
  </semantics>
</math>

您也有一些表达式,这些表达式以<annotation>元素作为<semantics>节点的第一个子元素的start。这也是不正确的,因为第一个孩子应该是一个presentation元素。例如:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <annotation encoding="LaTeX">\(d = r_S \left[1+\left(\frac{r_e}{r_s}\right)^2-2\left(\frac{r_e}{r_s}\right)\cos(\gamma)\right]^\frac{1}{2}\)</annotation>
  </semantics>
</math>

这将失败,因为没有可显示元素作为第一个子元素。 (我认为它将产生一个空的表达式。)

我不确定为什么要在初始MathML节点之后显示完整的表达式,但是我猜测<annotation>元素本身的LaTeX可能是排版的内容。那不应该发生,但是您没有给出MathJax配置或如何调用它,因此我无法确定是什么原因造成的。我自己无法复制。

[此外,MathML并不总是对应于注释中给出的LaTeX。大多数注释具有双元,表示显示为数学样式,但是<math>元素不具有display="block"属性,因此将被呈现为嵌入式数学。当您不希望括号出现时,括号也会出现问题(括号组中缺少<mrow>)。您可能会发现只使用原始的LaTeX并让MathJax为您完成向MathML的转换会更好。

© www.soinside.com 2019 - 2024. All rights reserved.