我想把这个变成:
$$
\begin{gather}
\overbracket{\text{1 2}}^{\text{Basic idea}} &
\overbracket{\text{3 4}}^{\text{Contrasting idea}} \\
\underbracket{\text{5 6}}_{\text{Basic idea}} &
\underbracket{\text{7 8}}_{\text{Cadence}}
\end{gather}
$$
进入这个:
我尝试了以下操作:
$$
\begin{gather}
\begin{aligned}
\overbracket{\kern5em}^{\text{anticipation}}
\end{aligned}\\
\overbracket{\text{1 2}}^{\text{Basic idea}} &
\overbracket{\text{3 4}}^{\text{Contrasting idea}} \\
\underbracket{\text{5 6}}_{\text{Basic idea}} &
\underbracket{\text{7 8}}_{\text{Cadence}}
\end{gather}
$$
但它并没有按预期居中:
答案1
您需要做一些工作来使括号的宽度相同。
\documentclass{article}
\usepackage{mathtools}
\newcommand{\overunderbrack}[3]{{\overbracket{\underbracket{#3}_{#2}}^{#1}}}
\begin{document}
\[
\newcommand{\zw}[1]{\text{\makebox[0pt]{#1}}}% just for this display
\overbrace{
\settowidth{\dimen0}{$\scriptstyle\text{Basic idea}$}
\mathmakebox[\dimen0]{\overunderbrack{\zw{Basic idea}}{\zw{Basic idea}}{
\begin{matrix} 1 & 2 \\ 5 & 6 \end{matrix}
}}
\quad
\settowidth{\dimen0}{$\scriptstyle\text{Contrasting idea}$}
\mathmakebox[\dimen0]{\overunderbrack{\zw{Contrasting idea}}{\zw{Cadence}}{
\begin{matrix} 3 & 4 \\ 7 & 8 \end{matrix}
}}
}^{\text{Anticipation}}
\]
\[
\overbrace{
\settowidth{\dimen0}{$\scriptstyle\text{Contrasting idea}$}
\mathmakebox[\dimen0]{\overunderbrack{\zw{Basic idea}}{\zw{Basic idea}}{
\begin{matrix} 1 & 2 \\ 5 & 6 \end{matrix}
}}
\quad
\mathmakebox[\dimen0]{\overunderbrack{\zw{Contrasting idea}}{\zw{Cadence}}{
\begin{matrix} 3 & 4 \\ 7 & 8 \end{matrix}
}}
}^{\text{Anticipation}}
\]
\end{document}
在第二个显示中,左侧部分设置为与右侧部分一样宽的框,任您选择。这是通过将构造封闭\overunderbrack
在所需宽度的框中来实现的,但就 TeX 而言,标签的宽度为零。
答案2
就像是
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
\overbrace{
\overbracket{
\underbracket{\begin{matrix}
1&2\\
5&6
\end{matrix}}_{\text{Basic idea}}}
^{\text{Basic idea}}
\;
\overbracket{
\underbracket{\begin{matrix}
3&4\\
7&8
\end{matrix}}_{\text{Cadence}}}
^{\text{Contrasting idea}}
}^{\text{Anticipation}}
\]
\end{document}