【问题标题】:LaTeX math in github wikisgithub wikis 中的 LaTeX 数学
【发布时间】:2014-04-09 19:49:51
【问题描述】:

是否可以在 github repo wiki 中以任何方式包含 LaTeX 风格的数学?谷歌搜索意味着 github 不再允许使用 MathJax 之类的东西,但大多数参考文献已有多年历史。在 github wiki 中包含 LaTeX 格式的数学有什么(如果有的话)替代方案?

【问题讨论】:

标签: github latex wiki


【解决方案1】:

GitLab Wiki 和 markdown 支持公式。为此,我移动了多个存储库。

【讨论】:

    【解决方案2】:

    您可以使用chart.apis.google.com 将 LaTeX 公式呈现为 PNG。 它与 Githhub 的 markdown 配合得很好:

    示例(降价):

    The ratio of the momentum to the velocity is
    the relativistic mass, m.
    
    ![f1]
    
    And the relativistic mass and the relativistic
    kinetic energy are related by the formula:
    
    ![f2]
    
    Einstein wanted to omit the unnatural second term
    on the right-hand side, whose only purpose is
    to make the energy at rest zero, and to declare
    that the particle has a total energy, which obeys:
    ![f3] which is a sum of the rest energy ![f4]
    and the kinetic energy.
    
    [f1]: http://chart.apis.google.com/chart?cht=tx&chl=m=\frac{m_0}{\sqrt{1-{\frac{v^2}{c^2}}}}
    [f2]: http://chart.apis.google.com/chart?cht=tx&chl=E_k=mc^2-m_0c^2
    [f3]: http://chart.apis.google.com/chart?cht=tx&chl=E=mc^2
    [f4]: http://chart.apis.google.com/chart?cht=tx&chl=m_0c^2
    

    https

    Github Enterprise 的某些安装拒绝 http 并且只有在您使用 https 时才能工作

    渲染:

    【讨论】:

    • 看起来我需要一个额外的 \\ 来让 \frac 等乳胶命令使用您的方法正确渲染,例如 [f1]: http://chart.apis.google.com/chart?cht=tx&chl=m=\\frac{m_0}{\\sqrt{1-{\\frac{v^2}{c^2}}}}
    • 我想说你只写一个反斜杠,它在stackoverflow渲染中工作,我通过复制粘贴到chrome地址栏来测试它。
    【解决方案3】:

    您的问题有很好的解决方案-使用TeXify github 插件-有关此插件的更多详细信息以及为什么这是您可以在answer 中找到的好方法的解释。

    【讨论】:

      【解决方案4】:

      要将数学方程式添加到 GitHub wiki,我使用了 mathURL,正如 Ionică 所建议的那样。它会渲染你的 LaTeX 方程。将 .png 附加到生成的 url 并将该 url 用作降价中的图像(块或内联)。

      【讨论】:

      • 虽然它是一个选项,但它是一个非常有限的选项。它不支持加载 LaTeX 包,因此您必须坚持非常基础。
      【解决方案5】:

      对于简单的公式(例如指数等),您可能只是使用可用的渲染语言。例如,使用 Textile,您可以:

      _E = mc ^2^_
      

      Thiw 将呈现为:

      _ 用于斜体,^ 用于上标。

      你可以在 Markdown 中添加一些 HTML 做同样的事情:

      *E = mc<sup>2</sup>*
      

      您可以在这个地方看到它的实际效果:

      E = mc2

      如果您正在寻找对复杂数学公式的支持,那么没有比使用第三方服务为您生成图像更好的选择了。 mathUrl 看起来很有趣。

      我们给它E = mc ^ 2作为输入,它会生成以下链接:

      http://mathurl.com/render.cgi?E%20%3D%20mc%20%5E%202%5Cnocache

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-11-28
        • 2012-04-01
        • 2018-01-05
        • 2023-03-25
        • 2022-01-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多