简介

使用PlantUML时,若需要输入数学公式,可以使用AsciiMath

🎉 Copied!

@startuml
:<math>int_0^1f(x)dx</math>;
:<math>x^2+y_1+z_12^34</math>;
note right
Try also
<math>d/dxf(x)=lim_(h->0)(f(x+h)-f(x))/h</math>
<math>P(y|bb"x") or f(bb"x")+epsilon</math>
end note
@enduml

JLaTeXMath

🎉 Copied!

@startuml
:<latex>\int_0^1f(x)dx</latex>;
:<latex>x^2+y_1+z_{12}^{34}</latex>;
note right
Try also
<latex>\dfrac{d}{dx}f(x)=\lim\limits_{h \to 0}\dfrac{f(x+h)-f(x)}{h}</latex>
<latex>P(y|\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon</latex>
end note
@enduml

其它样例:

🎉 Copied!

@startuml
Bob -> Alice : Can you solve: <math>ax^2+bx+c=0</math>
Alice --> Bob: <math>x = (-b+-sqrt(b^2-4ac))/(2a)</math>
@enduml

独立图

您也可以用 @startmath/@endmath 来创建独立的 AsciiMath 公式。

🎉 Copied!

@startmath
f(t)=(a_0)/2 + sum_(n=1)^ooa_ncos((npit)/L)+sum_(n=1)^oo b_n\ sin((npit)/L)
@endmath

或用 @startlatex/@endlatex 来创建独立的 JLaTeXMath 公式。

🎉 Copied!

@startlatex
\sum_{i=0}^{n-1} (a_i + b_i^2)
@endlatex

这是如何工作的 ?

要绘制这此公式, PlantUML 使用了两个开源项目:

  • AsciiMath 转换 AsciiMath 符号为 LaTeX 表达式。
  • JLatexMath 来显示LaTex 数学公式。 JLaTeXMath 是最好的显示LaTeX代码的 Java 类库。

ASCIIMathTeXImg.js 是一个小到足以集成到 PlantUML 标准发版的。

由于 JLatexMath 太大, 您要单独到 下载它, 然后解压 4 jar 文件 (batik-all-1.7.jar, jlatexmath-minimal-1.0.3.jar, jlm_cyrillic.jarjlm_greek.jar) 到 PlantUML.jar同一目录下。

WARNING
 This translation need to be updated. 
WARNING


Privacy Policy      Advertise