As of version 7997, PlantUML has introduced the feature to generate diagrams directly into
LaTeX, leveraging the capabilities of the
Tikz package.
Beta Version Notice
Please be aware that this functionality is currently in beta. While it adds a promising direction for PlantUML, it might contain bugs or unsupported features. We encourage users to actively report any issues encountered on the
dedicated forum thread to help us improve this feature based on actual user feedback and needs.
How to Use LaTeX Generation
To utilize LaTeX generation, apply the following settings in your PlantUML environment:
- Use the
-tlatex
flag when operating through the command line. - Set
format="latex"
when configuring the Ant task.
Embedding in LaTeX Documents
If you're aiming to incorporate the LaTeX output directly within another LaTeX document, employ the
-tlatex:nopreamble
flag. By doing so, PlantUML will output only the tikz-picture component, excluding the document preamble, facilitating a seamless integration into your existing LaTeX files.
@startuml
class Subscriber {
subscriberId
}
class AccumUsage {
subscriberId
}
class IpSession {
ipAddress
specificData
sapcOriginStateId
apnId
}
Subscriber "1" -[#blue]-> "1..*" IpSession
Subscriber "1" --> "0..1" AccumUsage
@enduml
See result online (TODO:
#362)
@startuml
Bob -> Alice: hello
return Ok
@enduml
See result online (TODO:
#362)
При использовании пакета
hyperref
в документах LaTeX у вас появляется возможность создавать ссылки, ведущие к определенным якорям в том же документе LaTeX/PDF. В примере PlantUML, приведенном ниже, обратите внимание, что вторая и последняя ссылки указывают на конкретный ресурс в документе LaTeX:
@startuml
participant Bob [[http://www.yahoo.com]]
participant Alice [[latex://resource-interaction]]
Bob -> Alice : [[http://www.google.com]] hello
Bob -> Alice : [[latex://resource-interaction]] interact
@enduml
Подробное обсуждение и связанные с ним вопросы см. на
форуме PlantUML QA-3558.