我在 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}