Please provide support for Latex Equations

0 votes
asked Dec 11, 2016 in Closed feature request by cnglen (120 points)

Please provide support for Latex Equations, for example:

@startuml

$\sum_{i=0}^{n-1} (a_i + b_i^2)$;

@enduml

1 Answer

+1 vote
answered Dec 12, 2016 by plantuml (294,960 points)
selected Jul 7, 2018 by Anthony-Gaudino
 
Best answer

In last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can have:

@startuml
:<math>int_0^1f(x)dx</math>;
:<latex>\sum_{i=0}^{n-1} (a_i + b_i^2)</latex>;
@enduml


Note that you have to install JLatexMath as explain at http://plantuml.com/ascii-math
This has not been very tested, so feedback is welcome!

commented Dec 13, 2016 by cnglen (120 points)
Thanks.
1. When setting larger dpi, for example:  skinparam dpi 200, the equation in png is ambiguous
2. The background color of equation can't be set independently.

#+BEGIN_SRC plantuml :file ../image/machine_learning_theory_frame.png
  left to right direction
  skinparam dpi 200
  skinparam componentStyle uml2
  [<latex>P(y|\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon</latex>] as fx
  [<latex>\mathcal{D}</latex>] as D
  [<latex>\mathcal{H}</latex>] as H
  [<latex>\mathcal{g}</latex>] as g
  [<latex>P(\mathbf{x})</latex>] as Px
  (<latex>\mathcal{A}</latex>) as A
  Px --> D
  fx --> D
  D --> A
  H --> A
  A --> g
  g .-> fx: <latex>\mbox{Loss}(f,g)</latex>
#+END_SRC
commented Dec 13, 2016 by plantuml (294,960 points)
Ok, thanks.
With last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar
You can have:
@startuml
left to right direction
skinparam dpi 192
skinparam componentStyle uml2
[<back:gray><latex>P(y|\mathbf{x}) \mbox{ or } f(\mathbf{x})+\epsilon</latex></back>] as fx
[<color:blue><latex>\mathcal{D}</latex></color>] as D
[<latex>\mathcal{H}</latex>] as H
[<latex>\mathcal{g}</latex>] as g
[<latex>P(\mathbf{x})</latex>] as Px
(<latex>\mathcal{A}</latex>) as A
Px --> D
fx --> D
D --> A
H --> A
A --> g
g .-> fx: <latex>\mbox{Loss}(f,g)</latex>
@enduml
...