![如何在 msc 消息中拆分行](https://linux22.com/image/353091/%E5%A6%82%E4%BD%95%E5%9C%A8%20msc%20%E6%B6%88%E6%81%AF%E4%B8%AD%E6%8B%86%E5%88%86%E8%A1%8C.png)
我在 msc 图中有一些长消息。我想把消息分成两行,这样它们就不会重叠。我试过了,parbox
但结果出错了。如何在 msc 消息中拆分文本行?代码和输出如下所示。
\documentclass[10pt]{llncs}
\usepackage{underscore}
\usepackage{lipsum}
\usepackage[font=itshape]{quoting}
\usepackage[title]{appendix}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{msc}
\usepackage{xcolor}
\begin{document}
\begin{figure}[htb!]
\[
\resizebox{\textwidth}{!}{
\centering
\setmsckeyword{}
\drawframe{no}
\hspace{-1cm}
\begin{msc}[small values, /msc/level height=0.6cm, /msc/label distance=0.5ex , /msc/first level height=0.75cm]{}
\setlength{\instwidth}{2.5\mscunit}
\setlength{\instdist}{5\mscunit}
\declinst{A}{}{A}
\declinst{B}{}{B}
\declinst{C}{}{C}
\mess{ Long message1(......,A very long message goes here,......)} {A}{B}
\mess{Long message2(......,A very long message goes here,......)} {B}{C}
\nextlevel
\end{msc}
}
\]
\caption[caption]{Figure.}
\end{figure}
\end{document}
答案1
其他用户请注意:此代码是为 的开发版本编写的msc
,可从以下网址获取http://satoss.uni.lu/software/mscpackage/。它不适用于msc
CTAN 上的版本。
您可以使用\mess[text width=3cm,align=center]{...
\documentclass{article}
\usepackage{msc}
\begin{document}
\begin{figure}[htb!]
\centering
\setmsckeyword{}
\drawframe{no}
\begin{msc}[small values, /msc/level height=0.6cm, /msc/label distance=0.5ex , /msc/first level height=0.75cm]{}
\setlength{\instwidth}{1.8\mscunit}
\setlength{\instdist}{3\mscunit}
\declinst{A}{}{A}
\declinst{B}{}{B}
\declinst{C}{}{C}
\mess[text width=3cm,align=center]{ Long message1(......,A very long message goes here,......)} {A}{B}
\mess[text width=3cm,align=center]{Long message2(......,A very long message goes here,......)} {B}{C}
\nextlevel
\end{msc}
\caption[caption]{Figure.}
\end{figure}
\end{document}