让我们看一下以下使用 TikZ-UML 创建的示例状态图:
\documentclass{standalone}
\usepackage{tikz-uml}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\umlstateinitial[name=initial]
\begin{umlstate}[name=simple,below=30mm of initial]{Simple state}
\end{umlstate}
\umltrans[arg={This is a very very very long text},pos=0.5]{initial}{simple}
\end{tikzpicture}
\end{document}
输出:
我的问题:如何在长参数描述中插入换行符?
答案1
您可以将其设置text width
为某个合理的值。
\documentclass{standalone}
\usepackage{tikz-uml}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
\umlstateinitial[name=initial]
\begin{umlstate}[name=simple,below=30mm of initial]{Simple state}
\end{umlstate}
\umltrans[arg={This is a very very very long text},pos=0.5,text width=2cm]{initial}{simple}
\end{tikzpicture}
\end{document}