我想知道如何删除最后一列右侧的空白区域。另外,有没有办法在投影仪中对齐面板 A 和 B?
%\documentclass[handout,table,slidestop,compress,mathserif, 10pt]{beamer}
\documentclass[table,slidestop,compress,mathserif, 10pt]{beamer}
\usepackage{array}
\usepackage{verbatim}
\usepackage{subfigure}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{booktabs,dcolumn}
\usetheme{Frankfurt}
%\usetheme{CambridgeUS}
\usecolortheme{seahorse}
\setbeamersize{text margin left=10mm, text margin right=7mm}
\usepackage{pstricks}
\usepackage{colortab}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{bbm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.pathmorphing}
\newcommand{\sumframe}[2]{\psframebox*[fillcolor=sumcolor,border=.5pt,bordercolor=black,shadow=true,shadowcolor=gray]{%
\parbox[c]{#1}{#2}}}%
\usepackage{xcolor}
\usepackage[orientation=landscape,size=custom,width=16,height=9,scale=0.5,debug]{beamerposter}
\newcommand{\indicator}[1]{\mathbbm{1}_{\left[ {#1} \right] }}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\definecolor{dgreen}{rgb}{0.,0.6,0.}
\definecolor{dblue}{rgb}{0.,0.,0.6}
\definecolor{dred}{rgb}{0.6,0.,0.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title[Title]
{
{\fontsize{16}{16}\selectfont Title} \\
}
\author[Name]
{%
\texorpdfstring{
\centering
Name\\
}
{Name}
}
\date[September 7, 2017]
{September 7, 2017}
% The main document
\begin{document}
\begin{frame}
\maketitle
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{subsection}{6}
\begin{frame}[label=Survivorship_Result2b]{Subsample test}
\vspace{-.53cm}
\begin{table}[htb]
\footnotesize
\begin{tabularx}{\linewidth}{l*{5}{Y}}
\toprule
\multicolumn{5}{l}{\textbf{Panel A: Group A}} \\
\midrule
& \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)} \\\hline
\tikzmark{newcolr}{\textbf{A $\cdot$ B} &\ 0.006& 0.006 &0.006&0.006&0.005 \\
&\ [4.05]&[2.58]&[3.29]&[3.06]&[4.06]}\\
\textbf{A} &-0.004& -0.003 & -0.003&-0.003 &-0.003 \\
&[-6.81]&[-3.49] &[-4.10] &[-3.05]&[-3.35]\\
\textbf{B} & &&-0.002&-0.002 \\
&&& [-1.60]& [-1.55] \\\hline
\end{tabularx}
\begin{tabularx}{\linewidth}{l*{5}{Y}}
\toprule
\multicolumn{5}{l}{\textbf{Panel B: Group X}} \\
\midrule
& \textbf{(1)} & \textbf{(2)} & \textbf{(3)}& \textbf{(4)} & \textbf{(5)} \\\hline
\tikzmark{colorsa}{\textbf{X $\cdot$ Y} &\ 0.003& 0.002 &0.002&0.002&0.002 \\
&\ [1.44]&[1.28]&[1.40]&[1.32]&[1.24]}\\
\textbf{X} &-0.001& 0.000 & 0.000&0.000 &-0.001 \\
&[-1.67]&[0.04] &[0.04] &[0.04]&[-1.08]\\
\textbf{Y} & &&-0.001&-0.001 \\
&&& [-1.06]& [-1.00]\\
\textbf{Controls}& No& Yes & Yes & Yes & Yes \\
\textbf{Group FEs}& Yes& Yes & No & No & Yes \\
\textbf{Family FEs}& No& No & Yes & Yes & No \\
\textbf{Individual FEs}& No& No & No & Yes & No \\
\textbf{Family-Individual Clustering}& Yes& Yes & Yes & Yes& Yes \\
\textbf{Observations}&8,895&7,654&7,654& 7,654&4,538 \\
\textbf{R-squared} &0.48&0.53&0.40&0.41 &0.54 \\\hline
\bottomrule
\end{tabularx}
\end{table}
\tikz[overlay,remember picture]{\draw[draw=red,thick,single,fill opacity=0.2] ($(colorsa)+(-0.19,0.28)$) rectangle ($(colorsa)+(11.9,-0.55)$);}
\tikz[overlay,remember picture]{\draw[draw=blue,thick,single,fill opacity=0.2] ($(newcolr)+(-0.19,0.28)$) rectangle ($(newcolr)+(11.9,-0.55)$);}
\end{frame}
\end{document}
答案1
我会重新设计你的表格如下:
- 在编辑器中重新排序代码,以便代码模仿表结构。这样可以更轻松地发现所有缺失的代码部分
- 将两个表合并为一个
- 删除多余的规则
- 仅使用包中定义的规则
booktabs
- 做你的姆韦作品
- 删除
\tikzmark
内容(似乎使用不当) - 而是使用围绕行的框架
\rowcolor
- 删除前言中多余的包(例如
colorab
,xcolor
;两者都是beamer
使用选项table
...加载的)
- 删除
Y
用S
包中定义的列类型替换未知的列类型siunitx
- 在姆韦仅考虑相关的包和框架
此项努力的成果是:
\documentclass[table,slidestop,compress,mathserif, 10pt]{beamer}
\usetheme{Frankfurt}
\usecolortheme{seahorse}
\setbeamersize{text margin left=10mm, text margin right=7mm}
\usepackage{array, booktabs, tabularx}
\newcommand\mcx[1]{\multicolumn{1}{>{\centering\arraybackslash}X}{\textbf{#1}}}
\setlength\aboverulesep{1pt}
\setlength\belowrulesep{1pt}
\usepackage{siunitx}
\begin{document}
\begin{frame}[fragile]
\frametitle{Subsample test}
\label{tab:SR-2b}
\scriptsize%footnotesize
\renewcommand\arraystretch{1.1}
\begin{tabularx}{\linewidth}{%
>{\bfseries}l
*{6}{S[detect-mode,
%input-symbols = ()[] ,
table-space-text-pre ={(},
table-space-text-post={)},
table-align-text-pre =false,
table-align-text-post=false,
table-format=-1.3]}
}
\toprule
\multicolumn{6}{l}{\textbf{Panel A: Group A}} \\
\midrule
& \mcx{(1)} & \mcx{(2)} & \mcx{(3)} & \mcx{(4)} & \mcx{(5)} \\
\midrule
\rowcolor{blue!20}
A $\cdot$ B
& 0.006 & 0.006 & 0.006 & 0.006 & 0.005 \\
\rowcolor{blue!20}
& [4.05] & [2.58] & [3.29] & [3.06] & [4.06] \\
\addlinespace[2pt]
A & -0.004 & -0.003 & -0.003 & -0.003 & -0.003 \\
& [-6.81] & [-3.49] & [-4.10] & [-3.05] & [-3.35] \\
\addlinespace[2pt]
B & & & -0.002 & -0.002 & \\
& & & [-1.60] & [-1.55] & \\
\midrule
\multicolumn{6}{l}{\textbf{Panel B: Group X}} \\
\midrule
\rowcolor{red!30}
X $\cdot$ Y
& 0.003 & 0.002 & 0.002 & 0.002 & 0.002 \\
\rowcolor{red!30}
& [1.44] & [1.28] & [1.40] & [1.32] & [1.24] \\
\addlinespace[2pt]
X & -0.001 & 0.000 & 0.000 & 0.000 & -0.001 \\
& [-1.67] & [0.04] & [0.04] & [0.04] & [-1.08] \\
Y & & & -0.001 & -0.001 & \\
& & & [-1.06] & [-1.00] & \\
\midrule
Controls
& {No} & {Yes} & {Yes} & {Yes} & {Yes} \\
Group FEs
& {Yes} & {Yes} & {No} & {No} & {Yes} \\
Family FEs
& {No} & {No} & {Yes} & {Yes} & {No} \\
Individual FEs
& {No} & {No} & {No} & {Yes} & {No} \\
Family-Individual Clustering
& {Yes} & {Yes} & {Yes} & {Yes} & {Yes} \\
Observations
& 8,895 & 7,654 & 7,654 & 7,654 & 4,538 \\
R-squared
& 0.48 & 0.53 & 0.40 & 0.41 & 0.54 \\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}
在此之后,如果由于某种原因需要现在周围的彩色行的矩形,我会研究如何正确使用tikzmark
它们来绘制它们。
我猜想行周围的框架应该如下图所示。对上面的内容进行一些更改。姆韦已完成。标明有% <---
:
为了获得上表的图像姆韦必须至少编译两次。
\documentclass[table,10pt]{beamer}
\usetheme{Frankfurt}
\usecolortheme{seahorse}
\setbeamersize{text margin left=10mm, text margin right=7mm}
\usepackage{array, booktabs, tabularx}
\newcommand\mcx[1]{\multicolumn{1}{>{\centering\arraybackslash}X}{\textbf{#1}}}
\setlength\aboverulesep{1pt}
\setlength\belowrulesep{1pt}
\usepackage{siunitx}
\usepackage{tikz} % <-------
\usetikzlibrary{calc, tikzmark} % <-------
\begin{document}
\begin{frame}[fragile]
\frametitle{Subsample test}
\label{tab:SR-2b}
\scriptsize%footnotesize
\renewcommand\arraystretch{1.1}
\begin{tabularx}{\linewidth}{%
>{\bfseries}l
*{6}{S[detect-mode,
%input-symbols = ()[] ,
table-space-text-pre ={(},
table-space-text-post={)},
table-align-text-pre =false,
table-align-text-post=false,
table-format=-1.3]}
}
\toprule
\multicolumn{6}{l}{\textbf{Panel A: Group A}} \\
\midrule
& \mcx{(1)} & \mcx{(2)} & \mcx{(3)} & \mcx{(4)} & \mcx{(5)} \\
\midrule
\tikzmark{a1} % <-------
A $\cdot$ B
& 0.006 & 0.006 & 0.006 & 0.006 & 0.005 \\
& [4.05] & [2.58] & [3.29] & [3.06] & [4.06]\tikzmark{a2} \\ % <-------
\addlinespace[2pt]
A & -0.004 & -0.003 & -0.003 & -0.003 & -0.003 \\
& [-6.81] & [-3.49] & [-4.10] & [-3.05] & [-3.35] \\
\addlinespace[2pt]
B & & & -0.002 & -0.002 & \\
& & & [-1.60] & [-1.55] & \\
\midrule
\multicolumn{6}{l}{\textbf{Panel B: Group X}} \\
\midrule
\tikzmark{b1} % <-------
X $\cdot$ Y
& 0.003 & 0.002 & 0.002 & 0.002 & 0.002 \\
& [1.44] & [1.28] & [1.40] & [1.32] & [1.24]\tikzmark{b2} \\ % <-------
\addlinespace[2pt]
X & -0.001 & 0.000 & 0.000 & 0.000 & -0.001 \\
& [-1.67] & [0.04] & [0.04] & [0.04] & [-1.08] \\
Y & & & -0.001 & -0.001 & \\
& & & [-1.06] & [-1.00] & \\
\midrule
Controls
& {No} & {Yes} & {Yes} & {Yes} & {Yes} \\
Group FEs
& {Yes} & {Yes} & {No} & {No} & {Yes} \\
Family FEs
& {No} & {No} & {Yes} & {Yes} & {No} \\
Individual FEs
& {No} & {No} & {No} & {Yes} & {No} \\
Family-Individual Clustering
& {Yes} & {Yes} & {Yes} & {Yes} & {Yes} \\
Observations
& 8,895 & 7,654 & 7,654 & 7,654 & 4,538 \\
R-squared
& 0.48 & 0.53 & 0.40 & 0.41 & 0.54 \\
\bottomrule
\end{tabularx}
\tikzset{frameline/.style = {draw=#1, thick, inner sep=2pt}} % <-------
\begin{tikzpicture}[overlay,remember picture] % <-------
\draw[frameline=blue] ($({pic cs:a1})+(-2ex,0.8em)$) % <-------
rectangle ($({pic cs:a2})+(3ex,-1ex)$); % <-------
\draw[frameline=red] ($({pic cs:b1})+(-2ex,0.8em)$) % <-------
rectangle ($({pic cs:b2})+(3ex,-1ex)$); % <-------
\end{tikzpicture} % <-------
\end{frame}
\end{document}