MathJax показывает дополнительные параметры

Я использую латекс на своем веб-сайте 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>

Как показано на следующем рисунке, в выводе отображаются лишние буквы и повторяющиеся уравнения! Я попытался создать другую страницу, и результат был таким же. Любая помощь приветствуется заранее. введите здесь описание изображения


person Majid    schedule 12.05.2020    source источник


Ответы (1)


Основная проблема заключается в том, что ваш 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>

который имеет 7 узлов MathML перед узлом <annotation>. Поскольку отображается только первый дочерний элемент <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>. Это также неверно, так как первый дочерний элемент должен быть элементом представления. Например:

<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, но я предполагаю, что LaTeX из самого элемента <annotation> может быть тем, что набирается. Этого не должно происходить, но вы не указали свою конфигурацию MathJax или то, как вы ее вызываете, поэтому я не могу сказать, что может быть причиной этого. У меня не получилось воспроизвести это у себя.

Кроме того, MathML не всегда соответствует LaTeX, указанному в аннотации. большинство аннотаций имеют двойные доллары, что означает отображаемый математический стиль, но элемент <math> не имеет атрибута display="block", поэтому будет отображаться как встроенная математика. Есть также проблемы со скобками, которые будут растягиваться, когда вы этого не ожидаете (отсутствует <mrow> вокруг групп скобок). Возможно, вам будет лучше просто использовать исходный LaTeX, а MathJax сделает преобразование в MathML за вас.

person Davide Cervone    schedule 12.05.2020