我想消除第一张图片上的缩进,使其成为第二张图片。
\documentclass{beamer}
\usepackage{tikz}
\usepackage{amssymb,amsmath}
\usepackage{tikzpagenodes}
\usepackage{lipsum}
\usetikzlibrary{angles,
backgrounds,
calc,
decorations.pathreplacing,
fit,
arrows,
positioning,
quotes,
shapes}
\tikzset{
every picture/.style = {remember picture},
na/.style = {baseline=-.5ex}
}
\everymath{\displaystyle}
\begin{document}
\begin{frame}[t]
\qquad$\left.
\begin{array}{|*{5}{c|}}
\hline
C & C_{1} & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (table) {$C_{2}$};} & \ldots
& C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\\
\qquad$\left.
\begin{array}{|*{5}{c|}}
\hline
C & C_{1} & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (table) {$C_{2}$};} & \ldots
& C_{q^k}\tikz[na]\node[coordinate] (t1) {gi}; \\
\hline
v_{2}+C & v_{2}+0 & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (bug)
{$v_{2}+C_{2}$};}
& \ldots
& v_{2}+C_{q^k} \\
\hline
\ldots & \ldots & \ldots & \ldots
& \ldots \\
\hline
v_{j}+C & v_{j}+0 & v_j+C_2 & \ldots
& v_{j}+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\qquad$\left.
\begin{array}{|*{5}{c|}}
\hline
\ldots & \ldots & \ldots & \ldots
& \ldots \\
\hline
v_{2}+C & v_{2}+0 & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (dug)
{$v_{2}+C_{2}$};}
& \ldots
& v_{2}+C_{q^k} \\
\hline
v_{l}+C & v_{l}+0 & v_l+C_l & \ldots
& v_{l}+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\end{frame}
\end{document}
答案1
在您编辑问题后,它看起来完全是新的和不同的问题。所以我决定用新的答案来回答它,其中我专注于设计具有相等列宽的树形表。我的第一个答案已经解决了颜色问题,而我对您的问题的回答中解决了水平定位问题。“我怎样才能对齐这两个表格?”(正如我从您的问题中看到的,您使用了我提供的解决方案,但是您不认为答案对您有用...这对您来说不是很好)。
要制作三个具有相同宽度的列(具有不同宽度的内容)的不同表格似乎是可能的解决方案之一,最简单的方法是使用外部(中心)定义的宽度,例如
\newcolumntype{C}{>{\centering\arraybackslash$}p{16mm}<{$}}
使用此列类型,优势就 array
消失了。无论如何,让我们进一步使用。此案例的新、最小代码是:
\documentclass[xcolor={dvipsnames,table}]{beamer}
\everymath{\displaystyle}
\usepackage{array}
\newcolumntype{C}{>{\centering\arraybackslash$}p{16mm}<{$}}
\begin{document}
\begin{frame}[t]
\qquad$\left.
\begin{array}{|C|C|>{\columncolor{red!20}}C|c|C|}
\hline
C & C_1 & C_2 & \ldots & C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\vskip-1.5ex
\qquad$\left.
\begin{array}{|C|C|>{\columncolor{red!20}}C|c|C|}
\hline
C & C_1 & C_2 & \ldots & C_{q^k} \\
\hline
v_2+C & v_2+0 & v_2+C_2 & \ldots & v_2+C_{q^k} \\
\hline
\ldots & \ldots & \ldots & \ldots & \ldots \\
\hline
v_j+C & v_j+0 & v_j+C_2 & \ldots & v_j+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
%\vskip-1.5ex
\qquad$\left.
\begin{array}{|C|C|C|c|C|}
\hline
\ldots & \ldots & \ldots & \ldots & \ldots \\
\hline
v_2+C & v_2+0 & v_2+C_2 & \ldots & v_2+C_{q^k} \\
\hline
v_l+C & v_l+0 & v_l+C_l & \ldots & v_l+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\end{frame}
\end{document}
结果:
我必须承认,我不确定你的问题到底是什么。所以,上面的解决方案是基于猜测的。有了之前的答案,你已经收到了关于如何定位表格和为整个列着色的可用说明/帮助。
答案2
例如,如果您想为第二个表的第一列着色:
\documentclass[xcolor={dvipsnames,table}]{beamer}
\usepackage{tikz}
\usepackage{amssymb,amsmath}
\usepackage{tikzpagenodes}
\usetikzlibrary{angles,
backgrounds,
calc,
decorations.pathreplacing,
fit,
arrows,
positioning,
quotes,
shapes}
\tikzset{
every picture/.style = {remember picture},
na/.style = {baseline=-.5ex}
}
\everymath{\displaystyle}
\begin{document}
\begin{frame}[t]
\qquad$\left.
\begin{array}{|*{5}{c|}}
\hline
C & C_{1} & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (table) {$C_{2}$};} & \ldots
& C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\\
\qquad$\left.
\begin{array}{|>{\columncolor{red!20}}c|*{4}{c|}}
\hline
C & C_{1} & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (table) {$C_{2}$};} & \ldots
& C_{q^k}\tikz[na]\node[coordinate] (t1) {gi}; \\
\hline
v_{2}+C & v_{2}+0 & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (bug)
{$v_{2}+C_{2}$};}
& \ldots
& v_{2}+C_{q^k} \\
\hline
\ldots & \ldots & \ldots & \ldots
& \ldots \\
\hline
v_{j}+C & v_{j}+0 & v_j+C_2 & \ldots
& v_{j}+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\qquad$\left.
\begin{array}{|*{5}{c|}}
\hline
\ldots & \ldots & \ldots & \ldots
& \ldots \\
\hline
v_{2}+C & v_{2}+0 & \tikz[baseline]{
\node[rounded corners,fill=red!15,anchor=base] (dug)
{$v_{2}+C_{2}$};}
& \ldots
& v_{2}+C_{q^k} \\
\hline
v_{l}+C & v_{l}+0 & v_l+C_l & \ldots
& v_{l}+C_{q^k} \\
\hline
\end{array}\right\} \omega(v_{i}) > t$
\end{frame}
\end{document}
如您所见,要为列着色,您需要xcolor={dvipsnames,table}
向文档类添加选项,然后在您想要着色的列中beamer
使用宏。\columncolor{<color>}