Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plantweb --format auto file.txt fails to format AsciiMath / Latex #23

Open
mood-indigo opened this issue Mar 8, 2023 · 1 comment
Open

Comments

@mood-indigo
Copy link

I copied this example from Math in PlantUML

@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

to p.uml

In a JupyterLab notebook, I have this code cell

%%bash
plantweb --format auto p.uml

The generated p.svg does not shows beautiful math, it still shows the AsciiMath code:

p

But when I changed the code cell to

%%bash
plantweb --format png p.uml

the generated p.png looks beautifully formatted.
p

The --format auto and --format svg do not correctly format the AsciiMath and jLatexMath code.

@mood-indigo
Copy link
Author

I'm not sure whether the bug is in iplantuml or plantweb. I did an experiment based on Python API, I use this code cell

from plantweb.render import render

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

output = render(
    CONTENT,
    engine='plantuml',
    format='svg',
    cacheopts={
        'use_cache': False
    }
)

with open("alice+bob.svg", "wb") as f:
    f.write(output[0])

The AsciiMath code was not correctly formatted. But when I changed the format to png, it turned out correct.

This shows that the bug is in plantweb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant