我正在尝试使用 LaTex 绘制消息序列图。目前,我在处理较长的操作时遇到了一些问题。如何才能让它自动换行?
这是 MSC 的一部分(在询问之前,我已经包含了该msc
包并且编译得很好)
\newcommand\setmscoptions{\setlength{\instdist}{5cm}\setlength{\levelheight}{1.5 \levelheight}\setlength{\instwidth}{3cm}}
\setmscoptions
\begin{msc}{Sequence Chart}
\declinst{A}{}{A}
\declinst{B}{}{B}
\declinst{C}{}{C}
\action*{This is a very log action that does not fit on one line}{B}
\end{msc}
答案1
将文本放在\parbox
这里效果很好。
\documentclass{article}
\usepackage{msc}
\newcommand\setmscoptions{%
\setlength{\instdist}{1cm}% % reduced from 5cm
\setlength{\levelheight}{1.5 \levelheight}%
\setlength{\instwidth}{3cm}}
\begin{document}
\setmscoptions
\begin{msc}{Sequence Chart}
\declinst{A}{}{A}
\declinst{B}{}{B}
\declinst{C}{}{C}
\action*{\parbox{3cm}{This is a very long action that does not fit on one line}}{B}
\end{msc}
\end{document}