我有以下代码(不要介意歌词:它们只是为了比较文本和数学模式):
\documentclass{article}
\usepackage{amsmath}
\usepackage{bm}
\begin{document}
I think about closing the door/And lately I think of it more/I'm living well out of my time/I feel like I'm losing my mind$\ |\ $I should be at the table round/A servant of the crown/The keeper of the sign/To sparkle and to shine
\newlength{\supal}
\settowidth{\supal}{$h_{(p+1,r,s-1)}$,}
\begin{alignat*}{2}
\uparrow=&
\begin{cases}
h_{(2,1,n-1)},&\ \text{if}\ n>2\,;\\
\makebox[\supal][l]{$\bm2$,}&\ \text{if}\ n=2\,.
\end{cases} &\downarrow=&
\begin{cases}
h_{(1,2,n)},&\ \text{if}\ n>2\,;\\
\makebox[\supal][l]{$\bm1$,}&\ \text{if}\ n=2\,.
\end{cases}\\[3mm]
\uparrow\hspace{-1mm}\mbox{\tiny$\circ$}\,\bm j=&\,\pmb\uparrow\!\bm j\ ; & \downarrow\hspace{-1mm}\mbox{\tiny$\circ$}\,\bm j=&\,\pmb\downarrow\!\bm j\,.\\[3mm]
\uparrow\hspace{-1mm}\mbox{\tiny$\circ$}\,h_{(p,r,s)}=&
\begin{cases}
h_{(p+1,r,s)},&\ \text{if}\ p+s-r<n\,;\\
h_{(p+1,r,s-1)},&\ \text{if}\ p+s-r=n\ \text{and}\ s-r>1\,;\\
\bm n,&\ \text{otherwise}\,.
\end{cases} & & \\[3mm]
\downarrow\hspace{-1mm}\mbox{\tiny$\circ$}\,h_{(p,r,s)}=&
\begin{cases}
h_{(p-1,r,s)},&\ \text{if}\ p>1\,;\\
h_{(1,r+1,s)},&\ \text{if}\ p=1\ \text{and}\ s-r>1\,;\\
\makebox[\supal][l]{$\bm1$,}&\ \text{otherwise}\,.
\end{cases} & &
\end{alignat*}
\end{document}
输出为
第一个cases
包含 3 个子句的环境(alignat
环境中的第三行)宽度过大,这迫使第二列太靠右,甚至超出了边距(如辅助歌词所示)。即使alignat
环境在列之间没有留出间距,也会发生这种情况。
我想知道是否有办法在alignat
环境中的列之间施加负间距;当然,在典型情况下,这会导致相应的(相邻的)列重叠,但在我的例子中不会发生这种情况。
答案1
您可以将想要减少宽度的内容放置在适合您需要的固定宽度的框内。
下面我创建了一个与您的场景类似的模型,并将长内容 - a very long condition that is very long
- 放在一个向左对齐的零宽度框内l
。这样就可以将右上角左cases
对齐到otherwise3
:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat*}{2}
a &= \begin{cases}
b, \text{if $c = d$} \\
e, \text{otherwise1}
\end{cases} &
f &= \begin{cases}
g, \text{if $h = i$} \\
j, \text{otherwise2}
\end{cases} \\
k &= \begin{cases}
l, \makebox[0pt][l]{a very long condition that is very long} \\
m, \text{otherwise3}
\end{cases}
\end{alignat*}
\end{document}