我在使用 Beamer 中的 tabularx 环境时遇到了问题,即我的列被挤压在一起。我对使用 Beamer 还不太熟悉,所以有人能提供一些建议吗?
代码如下:
\documentclass{beamer}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{G}{@{}>{\begin{lrbox}{\mybox}}l<{\end{lrbox}}@{}}
\usepackage{multirow}
\usepackage{ragged2e}
\newcolumntype{L}{ >{\RaggedRight}X }
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand\theadfont{\normalfont\bfseries}
\setlength\parindent{0pt}
\newcolumntype{Y}{ >{\Centering}X}
\usepackage[justification=centering]{caption}
\setlength\parindent{0pt}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\renewcommand\theadfont{\normalfont\bfseries}
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}
\setlength\parindent{0pt}
\usepackage[round,sort,comma]{natbib}
\usepackage{indentfirst}
\usetheme{Warsaw}
\usepackage{pgfpages}
\usepackage{stmaryrd}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{units}
\usepackage{tikz}
\usepackage{bmpsize}
\usepackage{adjustbox}
\begin{document}
\documentclass{beamer}
\begin{tabularx}{\textwidth}{@{} lYYYYYY @{}}
\toprule
\thead[lc]{Category }& \thead{Strategies}& {\thead{Annualized \\ Mean}} & {\thead{Volatility}} & {\thead{Skew}} & {\thead{kurtosis}} & {\thead{Sharpe \\ Ratio}} \\
\midrule
\multirow{2}{*}{ Momentum } & TSMOM(1,1) & 3.18 & 3.84 & -0.26 & 20.06 & 0.00 \\
& TSMOM(3,3) & 11.85 & 7.76 & -1.96 & 24.72 & 0.00 \\ \addlinespace
\multirow{5}{*}{ Size } & Top Decile & 12.70 & 9.26 & 1.44 & 15.80 & 0.00 \\
& 9\textsuperscript{th} Decile & 0.11 & 8.49 & 0.49 & 12.73 & 0.00\\
& Bottom Decile & 8.96 & 5.07 & -0.57 & -9.38 & 0.00 \\
& 2\textsuperscript{nd} Decile & 10.13 & 5.19 & -0.44 & 10.87 & 0.00\\
& Top minus Bottom & 3.75 & 6.54 & 2.45 & 18.54 & 0.00\\
\addlinespace
\multirow{7}{*}{ Value } & Top Decile & 11.76 & 8.73 & 0.1915 & 14.62 & 0.00\\
& Bottom Decile & 8.38 & 5.76 & -0.59 & 8.74 & 0.00 \\
& Top Minus Lowest (Decile) & 3.38 & 5.94 & 0.68 & 11.03 & 0.00 \\
& Top 30\textsuperscript{th} Percentile & 11.79 & 8.73 & 0.19 & 14.62 & 0.00 \\
& Mid 40\textsuperscript{th} Percentile & 10.04 & 5.64 & 0.03 & 13.76 & 0.00 \\
& Bottom 30\textsuperscript{th} Percentile & 9.04 & 5.43 & -0.73 & 8.80 & 0.00 \\
& Highest Minus Lowest 30\textsuperscript{th} & 2.72 & 5.60 & 0.82 & 12.79 & 0.00 \\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}
下图如下:
正如所见,我遇到了一些大问题,我真的很想得到一些帮助,因为我试过使用 \adjustbox,但效果并不好,因为列高扩大了,但宽度没有扩大。如果有人有解决方案或能帮助我,我将不胜感激。
谢谢。
答案1
使用shrink
框架选项:
\begin{frame}[shrink=40]
\end{frame}
完整示例:
\documentclass{beamer}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{G}{@{}>{\begin{lrbox}{\mybox}}l<{\end{lrbox}}@{}}
\usepackage{multirow}
\usepackage{ragged2e}
\newcolumntype{L}{ >{\RaggedRight}X }
\usepackage{siunitx}
\usepackage{makecell}
\renewcommand\theadfont{\normalfont\bfseries}
\setlength\parindent{0pt}
\newcolumntype{Y}{ >{\Centering}X}
\usepackage[justification=centering]{caption}
\setlength\parindent{0pt}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\newcolumntype{C}{>{\Centering\arraybackslash}X}
\renewcommand\theadfont{\normalfont\bfseries}
\newcommand\mc[1]{\multicolumn{2}{c}{#1}}
\setlength\parindent{0pt}
\usepackage[round,sort,comma]{natbib}
\usepackage{indentfirst}
\usetheme{Warsaw}
\usepackage{pgfpages}
\usepackage{stmaryrd}
\usepackage{multicol}
\usepackage[english]{babel}
\usepackage{units}
\usepackage{tikz}
\usepackage{bmpsize}
\usepackage{adjustbox}
\begin{document}
\begin{frame}[shrink=40]
\vspace*{2em}
\begin{tabularx}{\textwidth}{@{} lYYYYYY @{}}
\toprule
\thead[lc]{Category }& \thead{Strategies}& {\thead{Annualized \\ Mean}} & {\thead{Volatility}} & {\thead{Skew}} & {\thead{kurtosis}} & {\thead{Sharpe \\ Ratio}} \\
\midrule
\multirow{2}{*}{ Momentum } & TSMOM(1,1) & 3.18 & 3.84 & -0.26 & 20.06 & 0.00 \\
& TSMOM(3,3) & 11.85 & 7.76 & -1.96 & 24.72 & 0.00 \\ \addlinespace
\multirow{5}{*}{ Size } & Top Decile & 12.70 & 9.26 & 1.44 & 15.80 & 0.00 \\
& 9\textsuperscript{th} Decile & 0.11 & 8.49 & 0.49 & 12.73 & 0.00\\
& Bottom Decile & 8.96 & 5.07 & -0.57 & -9.38 & 0.00 \\
& 2\textsuperscript{nd} Decile & 10.13 & 5.19 & -0.44 & 10.87 & 0.00\\
& Top minus Bottom & 3.75 & 6.54 & 2.45 & 18.54 & 0.00\\
\addlinespace
\multirow{7}{*}{ Value } & Top Decile & 11.76 & 8.73 & 0.1915 & 14.62 & 0.00\\
& Bottom Decile & 8.38 & 5.76 & -0.59 & 8.74 & 0.00 \\
& Top Minus Lowest (Decile) & 3.38 & 5.94 & 0.68 & 11.03 & 0.00 \\
& Top 30\textsuperscript{th} Percentile & 11.79 & 8.73 & 0.19 & 14.62 & 0.00 \\
& Mid 40\textsuperscript{th} Percentile & 10.04 & 5.64 & 0.03 & 13.76 & 0.00 \\
& Bottom 30\textsuperscript{th} Percentile & 9.04 & 5.43 & -0.73 & 8.80 & 0.00 \\
& Highest Minus Lowest 30\textsuperscript{th} & 2.72 & 5.60 & 0.82 & 12.79 & 0.00 \\
\bottomrule
\end{tabularx}
\end{frame}
\end{document}