【问题标题】:Error while running latex with a tex file created using XSLTML 2.1.2使用 XSLTML 2.1.2 创建的 tex 文件运行乳胶时出错
【发布时间】:2017-04-26 13:21:06
【问题描述】:

我正在通过以下方式创建一个带有等式的 PDF

Mathml.xml > XSLTML 2.1.2 > pdflatex

也就是说,我有一个带有 mathml 方程的 xml 文件,我正在使用 XSLTML 2.1.2(XSLT 文件)从中创建一个 tex 文件,它给出了 .tex 文件的输出,将使用 tex 文件通过将其编译为 pdflatex *.tex 来创建 PDF

但是在这样做的时候,出现了一个错误

我的 mathml 文件:

<math xmlns="http://www.w3.org/1998/Math/MathML" alttext="math equation" display="inline" altimg-width="389" altimg-height="57" altimg="../images/altmath_10486.png">
<mtable columnalign="left left">
    <mtr>
        <mtd>
            <mo>⤹</mo>
            <mo>+</mo>
            <mo>Σ</mo>
            <msub>
                <mi>M</mi>
                <mrow>
                    <mi>C</mi>
                </mrow>
            </msub>
            <mo>=</mo>
            <mn>0</mn>
            <mo>;</mo>
        </mtd>
        <mtd>
            <mo>−</mo>
            <msub>
                <mi>M</mi>
                <mrow>
                    <mi>C</mi>
                </mrow>
            </msub>
            <mo>−</mo>
            <mn mathvariant="normal">540</mn>
            <mspace width="0.33em"/>
            <mi mathvariant="normal">N</mi>
            <mo mathvariant="normal">(</mo>
            <mn mathvariant="normal">2</mn>
            <mspace width="0.33em"/>
            <mi mathvariant="normal">m</mi>
            <mo mathvariant="normal">)</mo>
            <mo mathvariant="normal">=</mo>
            <mn>0</mn>
        </mtd>
    </mtr>
    <mtr>
        <mtd/>
        <mtd>
            <msub>
                <mi>M</mi>
                <mrow>
                    <mi>C</mi>
                </mrow>
            </msub>
            <mo>=</mo>
            <mo>−</mo>
            <mn mathvariant="normal">1080</mn>
            <mspace width="0.33em"/>
            <mi mathvariant="normal">N</mi>
            <mo mathvariant="normal">⋅</mo>
            <mi mathvariant="normal">m</mi>
            <mspace width="35pt"/>
            <mi mathsize="normal" mathcolor="#ef3f3e" mathvariant="sans-serif-italic">Ans.</mi>
        </mtd>
    </mtr>
</mtable>

我的特克斯:

\documentclass[preview]{standalone}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{graphicx}

\begin{document}
\fontsize{12}{14}\selectfont

\begin{equation*}
\begin{array}{ll}⤹+\Sigma {M}_{C}=0;& -{M}_{C}-\mathrm{540}\phantom{\rule{0.33em}{0ex}}\mathrm{N}\mathrm{\left(}\mathrm{2}\phantom{\rule{0.33em}{0ex}}\mathrm{m}\mathrm{\right)}\mathrm{=}0\\ & {M}_{C}=-\mathrm{1080}\phantom{\rule{0.33em}{0ex}}\mathrm{N}\mathrm{\cdot }\mathrm{m}\phantom{\rule{35pt}{0ex}}\textcolor[rgb]{0.9372549019607843,0.24705882352941178,0.24313725490196078}{\mathsf{Ans.}}\end{array}
\end{equation*}

\end{document}

我是 MathML 和 Tex 的新手,所以任何人都建议为此提供解决方案

谢谢

【问题讨论】:

    标签: xslt latex pdflatex mathml xelatex


    【解决方案1】:

    Pandoc 也读取 MathML(你可以假装它是一个 HTML 文件):

    pandoc -f html -t latex Mathml.xml
    

    如果你安装了 LaTeX,你甚至可以直接获取 PDF:

    pandoc -f html Mathml.xml -o output.pdf
    

    【讨论】:

    • 您好 mb21,感谢您的回复,我试过这个并得到了 PDF,但“⤹”没有呈现,还有什么方法可以调整字体样式和字体大小?
    • 当然,看看manual,例如pandoc -V fontfamily ...箭头未渲染可能正是因为字体没有字符...也许也可以尝试--latex-engine xelatex
    • 哇,非常感谢您的快速回复,这真的很有趣,好的,所以我将尝试使用另一种字体,但还有一个问题,有没有办法将 pdf 输出页面大小减小到等于它的内容?
    • 我认为像pandoc -V mainfont=arev -V documentclass=standalone 这样的东西应该可以解决问题...
    • pandoc -V mainfont="Times New Roman" -V documentclass=standalone -f html Mathml.xml -o output.pdf 字体样式不起作用(如果错了,请纠正我)和“独立”工作但不需要方程式编号,那位朋友有什么办法吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-29
    相关资源
    最近更新 更多