我试图将latex风格的数学公式放入haskell图中。
http://projects.haskell.org/diagrams/doc/manual.html#essential-concepts 和 http://projects.haskell.org/diagrams/doc/tutorials.html 建议可以使用“mathjax”来实现这一点。
是否有一个解释或示例,说明如何实际编写代码?
尝试按照这些链接的文档进行操作,我的最佳猜测是:
mathDiagram :: Diagram B mathDiagram = stroke $ textSVG "`2 + \sqrt{\pi}`:math:" 1
但这当然给出了一个错误:
induction.hs:13:35: error: lexical error in string/character literal at character 's'
您可以使用 diagrams-pgf 后端。只要使用 text 函数并在文本周围放置美元符号。此外,有关如何在LaTeX文档中包含图表的说明,请参见此处: http://projects.haskell.org/diagrams/doc/latex.html .
diagrams-pgf
text