有没有一种方法可以在Scaladoc中包含数学公式? [英] Is there a way to include math formulae in Scaladoc?

查看:96
本文介绍了有没有一种方法可以在Scaladoc中包含数学公式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Scaladoc数学Scala代码文档中输入数学公式.在Java中,我发现了一个名为LatexTaglet的库,可以通过在Latex中编写公式来为Javadoc做到这一点: http://latextaglet.sourceforge.net/

I would like to enter math formulae in Scaladoc documentation of mathematical Scala code. In Java, I found a library called LatexTaglet that can do exactly this for Javadoc, by writing formulae in Latex: http://latextaglet.sourceforge.net/

它似乎与Maven集成得很好(POM的报告/插件"部分). Scaladoc是否有一个等效的库?如果没有,我该如何将该库与SBT集成在一起?

And it seems to integrate well with Maven (reporting/plugins section of a POM). Is there an equivalent library for Scaladoc? If not, how could I integrate this library with SBT?

我也考虑过使用MathML( http://www.w3.org/Math/),但是看起来太冗长了.您会推荐一个编辑器吗? MathML是否可以与Scaladoc很好地集成?

I also considered using MathML (http://www.w3.org/Math/), but looks too verbose. Is there an editor you would recommend? Does MathML integrate well with Scaladoc?

谢谢您的帮助!

推荐答案

简短的答案是:不. LaTeXTaglet通过JavaDoc Taglet Taglet API. Scaladoc中没有同类产品,因此没有干净的解决方案.

The short answer is: no. LaTeXTaglet is made possible by the JavaDoc Taglet API. There is no equivalent in Scaladoc, therefore no clean solution.

但是,我想到的一个骇客可能很容易做到:

However, I can think of a hack that might be easy enough to do:

有一个名为 MathJax 的库,该库在HTML页面中查找LaTeX风格的数学公式并动态呈现它就位.我以前用过,很好.您所要做的就是包含脚本.因此,您可以做两件事:

There's a library called MathJax, which looks for LaTeX-style math formulae in an HTML page and dynamically renders it in place. I've used it before, it's pretty nice; all you have to do is include the script. So you could do two things:

  1. 编辑并重建 Scaladoc 源,以包括MathJax或. ..
  2. 在Scaladoc的所有HTML输出运行后,编写一些后处理程序爬网,然后将MathJax注入每个文件中.
  1. Edit and rebuild the Scaladoc source to include MathJax, or...
  2. Write a little post-processor crawl all of Scaladoc's HTML output after it runs, and inject MathJax into each file.

这样,您可以直接在Scala注释中编写LaTeX公式,并且应在浏览器中呈现它们.当然,如果您想要一个 non-hacky 解决方案,我建议您为Scaladoc创建一个类似taglet的API;)

That way, you could just write LaTeX formulae directly in your Scala comments and they should be rendered in the browser. Of course if you wanted a non-hacky solution, I'd suggest you create a taglet-like API for Scaladoc ;)

这篇关于有没有一种方法可以在Scaladoc中包含数学公式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆