![在数组环境中为某些任意列添加下括号](https://linux22.com/image/346876/%E5%9C%A8%E6%95%B0%E7%BB%84%E7%8E%AF%E5%A2%83%E4%B8%AD%E4%B8%BA%E6%9F%90%E4%BA%9B%E4%BB%BB%E6%84%8F%E5%88%97%E6%B7%BB%E5%8A%A0%E4%B8%8B%E6%8B%AC%E5%8F%B7.png)
我使用以下输出创建了以下输出阵列环境,我觉得它必须在那个环境中创建。如您所见,它分为三行。
我想要的是将其放在
\underbrace{}
与下图完全相同的位置:
输出的LaTeX命令如下:
\[\begin{array}{ccccccccc}
\text{Saturday} & \text{Sunday} & \text{Mondey} & \text{Tuesday} & \text{Wednesday} & & \text{Saturday} = 4 && \text{Wednesday} = 324 \\
%\smash[b]{\underbrace{
x & 3x & 9x & 27x & 81 x = 324
%}}
& \Longrightarrow& x = 4, && \text{Difference} = 320 \\
\multicolumn{5}{c}{(0.75)} & & (0.25) && (0.25)
\end{array}\]
如您所见,我已注释掉该\smash[b]{\underbrace{}}
命令,因为保持启用状态会导致错误,并且输出完全混乱。请帮助我解决这个问题。谢谢。
答案1
这不是用 完成的array
,而是用 完成的。用 调整列间间隙\setstacktabbedgap{}
,用 调整行间基线跳跃\setstackgap{L}{}
。
\documentclass{article}
\usepackage{tabstackengine,amsmath}
\begin{document}
\setstacktabbedgap{5pt}
\setstackgap{L}{18pt}
\renewcommand\stacktype{L}
\savestack\leftside{\tabbedLongunderstack{
Saturday & Sunday & Monday & Tuesday & Wednesday\\
$x$ & $3x$ & $9x$ & $27x$ & $81x = 324$
}}
\savestack\rightside{\tabbedLongunderstack{%
& Saturday${}= 4$ && Wednesday${}=324$\\
$\Longrightarrow$ & $x = 4$ && Difference ${}= 320$\\
& (0.25) && (0.25)
}}
\tabbedLongunderstack{
\stackunder[2\dimexpr\Lstackgap]{$\underbrace{\leftside}$}{(0.75)} & \rightside
}
\end{document}
如果想要降低支架,只需采取\addstackgap
以下简单补救措施:
\documentclass{article}
\usepackage{tabstackengine,amsmath}
\begin{document}
\setstacktabbedgap{5pt}
\setstackgap{L}{18pt}
\renewcommand\stacktype{L}
\savestack\leftside{\addstackgap[2pt]{\tabbedLongunderstack{
Saturday & Sunday & Monday & Tuesday & Wednesday\\
$x$ & $3x$ & $9x$ & $27x$ & $81x = 324$
}}}
\savestack\rightside{\tabbedLongunderstack{%
& Saturday${}= 4$ && Wednesday${}=324$\\
$\Longrightarrow$ & $x = 4$ && Difference ${}= 320$\\
& (0.25) && (0.25)
}}
\tabbedLongunderstack{
\stackunder[2\dimexpr\Lstackgap]{$\underbrace{\leftside}$}{(0.75)} & \rightside
}
\end{document}
作为一个兴趣点,我使用了因为所有列都具有相同的(中心)对齐方式。如果不同的列需要不同的对齐方式,\tabbedLongunderstack{}
则还有宏。\tabularLongunderstack{<alignment>}{}
答案2
您可以使用两个tabular
在顶部对齐的环境,其中第一个环境可以通过减小其尺寸来“支撑不足”。
关键是\\[-\arraystretch\normalbaselineskip]
在第一个表格的末尾添加。
\documentclass{article}
\begin{document}
\[
\renewcommand{\arraystretch}{2}
{\underbrace{\begin{tabular}[t]{@{}ccccc@{}}
Saturday & Sunday & Monday & Tuesday & Wednesday \\
$x$ & $3x$ & $9x$ & $27x$ & $81x=324$ \\
\multicolumn{5}{@{}c@{}}{$(0.75)$} \\[-\arraystretch\normalbaselineskip]
\end{tabular}}}
\begin{tabular}[t]{c@{\hspace{\tabcolsep}}cc@{}}
& Saturday${}=4$ & Wednesday${}=324$ \\
$\Longrightarrow$ & $x=4$, & Difference${}=320$ \\
& $(0.25)$ & $(0.25)$
\end{tabular}
\]
\end{document}
答案3
经过反复试验:
\documentclass{article}
\usepackage{array, amsmath}
\usepackage{geometry}%
\begin{document}
\[\begin{array}{*{9}{c}}
\text{Saturday} & \text{Sunday} & \text{Monday} & \text{Tuesday} & \text{Wednesday} & & \text{Saturday} = 4 && \text{Wednesday} = 324 \\
x & 3x & 9x & 27x & 81 x = 324
& \Longrightarrow & x = 4, && \text{Difference} = 320 \\
\multicolumn{5}{c}{\quad\;\raisebox{1.5ex}{$ \underbrace{\hspace{22em}}_{(0.75)} $}} & & (0.25) && (0.25)
\end{array}\]
\end{document}
如果要对齐最后一行的所有数字,可以使用该makecell
包:
\documentclass{article}
\usepackage{array, amsmath, makecell}
\usepackage{geometry}%
\begin{document}
\[\begin{array}{*{9}{c}}
\text{Saturday} & \text{Sunday} & \text{Monday} & \text{Tuesday} & \text{Wednesday} & & \text{Saturday} = 4 && \text{Wednesday} = 324 \\
x & 3x & 9x & 27x & 81 x = 324
& =⇒ & x = 4, && \text{Difference} = 320 \\[-1.5ex]
\multicolumn{5}{c}{\quad\;\makecell[bc]{\underbrace{\hspace{22em}}_{}\\[-1.5ex] (0.75)}} & & (0.25) && (0.25)
\end{array}\]
\end{document}
答案4
与。{NiceArray}
nicematrix
\documentclass{article}
\usepackage{geometry}
\usepackage{nicematrix}
\begin{document}
\[\begin{NiceArray}{*{9}{c}}
\text{Saturday}& \text{Sunday} & \text{Mondey} & \text{Tuesday} & \text{Wednesday} & & \text{Saturday} = 4 && \text{Wednesday} = 324 \\
x & 3x & 9x & 27x & 81 x = 324 & \Longrightarrow& x = 4, && \text{Difference} = 320 \\[2mm]
\multicolumn{5}{c}{(0.75)} & & (0.25) && (0.25)
\CodeAfter
\UnderBrace[yshift=-2mm]{(2-1}{2-5}{}
\end{NiceArray}\]
\end{document}