我有这个表格数据,我想让数据与顶部对齐,而不是像这里显示的那样居中。
%#%
\begin{frame}{frame 1}
\begin{tabular}[t]{l | l | l}
\parbox{0.3\textwidth}{
\footnotesize
\tcboxmath[colframe=nus-blue,colback=white,boxrule=0.5pt,arc=4pt,left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima]{C_{ij}^{*}}
\begin{align*}
\textcolor{nus-orange}{C_{33}^0} + \textcolor{nus-orange}{C_{33}^1} &= C_{33}^* = \rho V_p^2,\\[1ex]
\textcolor{nus-orange}{C_{44}^0} + \textcolor{nus-orange}{C_{44}^1} &= C_{44}^* = \rho V_s^2.
\end{align*}
}
&
\parbox{0.3\textwidth}{
\footnotesize
\tcboxmath[colframe=nus-blue,colback=white,boxrule=0.5pt,arc=4pt,left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima]{C_{ij}^{0}}
\begin{align*}
\textcolor{nus-orange}{C_{11}^0} = \textcolor{nus-orange}{C_{33}^0} &= \lambda + 2 \mu,\\[1ex]
\textcolor{nus-orange}{C_{66}^0} = \textcolor{nus-orange}{C_{44}^0} &= \mu.
\end{align*}
\footnotesize
\boxed{\lambda = K^{HS+} - \frac{2}{3} \mu^{HS+},}
\boxed{\mu = \mu^{HS+}.}
}
&
\parbox{0.3\textwidth}{
\footnotesize
\tcboxmath[colframe=nus-blue,colback=white,boxrule=0.5pt,arc=4pt,left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima]{C_{ij}^{1}}
\begin{align*}
\textcolor{nus-orange}{C_{33}^{1}} &= -\frac{(\lambda + 2 \mu)^2}{\mu} \textcolor{nus-blue}{d_c^{33}} U_3, \\[1ex]
\textcolor{nus-orange}{C_{44}^{1}} &= -\mu \textcolor{nus-blue}{d_c^{44}} U_1, \\[1ex]
U_1 &= \frac{16(\lambda + 2 \mu)}{3(3 \lambda + 4 \mu)},\\[1ex]
U_3 &= \frac{4(\lambda + 2 \mu)}{3(\lambda + \mu)(1 + K)},\\[1ex]
K &= \frac{K_f(\lambda + 2 \mu)}{\pi \textcolor{nus-blue}{\alpha} \mu(\lambda + \mu)}.
\end{align*}
}
\end{tabular}
\end{frame}
答案1
像这样?
由于您没有提供 MWE,我发明了颜色定义。
\documentclass{beamer}
\usepackage{tabularx}
\usepackage[most]{tcolorbox}
\colorlet{nus-orange}{yellow!50!red}
\colorlet{nus-blue}{white!50!blue}
\tcbset{colframe=nus-blue,colback=white,boxrule=0.5pt,arc=4pt,left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,width=\@tempdima}
\begin{document}
\begin{frame}{frame 1}\scriptsize
\begin{tabularx}{\linewidth}{@{}X|X|X@{}}
\tcboxmath{C_{ij}^{*}}\medskip
$\begin{aligned}
\textcolor{nus-orange}{C_{33}^0} + \textcolor{nus-orange}{C_{33}^1} &= C_{33}^* = \rho V_p^2,\\[1ex]
\textcolor{nus-orange}{C_{44}^0} + \textcolor{nus-orange}{C_{44}^1} &= C_{44}^* = \rho V_s^2.
\end{aligned}$
&
\tcboxmath{C_{ij}^{0}}\medskip
$\begin{aligned}
\textcolor{nus-orange}{C_{11}^0} = \textcolor{nus-orange}{C_{33}^0} &= \lambda + 2 \mu,\\[1ex]
\textcolor{nus-orange}{C_{66}^0} = \textcolor{nus-orange}{C_{44}^0} &= \mu.
\end{aligned}$
\boxed{\lambda = K^{HS+} - \frac{2}{3} \mu^{HS+},}
\boxed{\mu = \mu^{HS+}.}%
&
\tcboxmath{C_{ij}^{1}}\medskip
$\begin{aligned}
\textcolor{nus-orange}{C_{33}^{1}} &= -\frac{(\lambda + 2 \mu)^2}{\mu} \textcolor{nus-blue}{d_c^{33}} U_3, \\[1ex]
\textcolor{nus-orange}{C_{44}^{1}} &= -\mu \textcolor{nus-blue}{d_c^{44}} U_1, \\[1ex]
U_1 &= \frac{16(\lambda + 2 \mu)}{3(3 \lambda + 4 \mu)},\\[1ex]
U_3 &= \frac{4(\lambda + 2 \mu)}{3(\lambda + \mu)(1 + K)},\\[1ex]
K &= \frac{K_f(\lambda + 2 \mu)}{\pi \textcolor{nus-blue}{\alpha} \mu(\lambda + \mu)}.
\end{aligned}$
\end{tabularx}
\end{frame}
\end{document}
答案2
立即回答你的问题,
如何使表格数据顶部对齐?
将是:用 替换所有 3 个实例\parbox{0.3\textwidth}
。\parbox[t]{0.3\textwidth}
但是,这将是一个笨拙的解决方案。将 3 个l
类型的列更改为更为优雅p{0.3\textwidth}
。
以下解决方案对p
-column 方法进行了轻微调整,方法是 (a) 为第二列分配略小的宽度,为第三列分配略大的宽度,以及 (b) 使用aligned
环境而不是align*
环境。此外,为了确保材料适合文本块的宽度,它使用tabular*
环境而不是tabular
环境。总体而言,结果与@CarLaTeX 的回答。
\documentclass{beamer}
\usepackage[most]{tcolorbox}
\begin{document}
\begin{frame}{frame 1}
\tcbset{colframe=blue,colback=white,boxrule=0.5pt,arc=4pt,
left=6pt,right=6pt,top=6pt,bottom=6pt,boxsep=0pt,
width=\@tempdima}
\footnotesize % a single '\footnotesize' directive suffices
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
p{0.3\textwidth} p{0.28\textwidth} p{0.32\textwidth}}
%% column 1
\tcboxmath{C_{ij}^{*}}
\medskip
$\begin{aligned}
\textcolor{orange}{C_{33}^0} + \textcolor{orange}{C_{33}^1}
&= C_{33}^* = \rho V_p^2, \\[2ex]
\textcolor{orange}{C_{44}^0} + \textcolor{orange}{C_{44}^1}
&= C_{44}^* = \rho V_s^2.
\end{aligned}$
&
%% column 2
\tcboxmath{C_{ij}^{0}}
\medskip
$\begin{aligned}
\textcolor{orange}{C_{11}^0} = \textcolor{orange}{C_{33}^0}
&= \lambda + 2\mu, \\[2ex]
\textcolor{orange}{C_{66}^0} = \textcolor{orange}{C_{44}^0}
&= \mu.
\end{aligned}$
\medskip
\boxed{\lambda = K^{HS+} - \tfrac{2}{3} \mu^{HS+},}
\smallskip
\boxed{\mu = \mu^{HS+}.}
&
%% column 1
\tcboxmath{C_{ij}^{1}}
\medskip
$\begin{aligned}
\textcolor{orange}{C_{33}^{1}}
%% use "\smash" to perform horizontal alignment
&= -\smash{\frac{(\lambda + 2\mu)^2}{\mu}} \textcolor{blue}{d_c^{33}} U_3, \\[2ex]
\textcolor{orange}{C_{44}^{1}}
&= -\mu \textcolor{blue}{d_c^{44}} U_1, \\[1ex]
U_1 &= \frac{16(\lambda + 2\mu)}{3(3 \lambda + 4 \mu)},\\[1ex]
U_3 &= \frac{4(\lambda + 2\mu)}{3(\lambda + \mu)(1 + K)},\\[1ex]
K &= \frac{K_f(\lambda + 2\mu)}{\pi \textcolor{blue}{\alpha} \mu(\lambda + \mu)}.
\end{aligned}$
\end{tabular*}
\end{frame}
\end{document}