调整 Beamer 表格中文本和单元格边界之间的间距

调整 Beamer 表格中文本和单元格边界之间的间距

使用以下代码这个问题,如何调整文本和单元格边距(垂直和水平)之间的间距。

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{frametitle}{series=\bfseries}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\begin{frame}[t]
\frametitle{Types of ...}
\begin{table}
    \bfseries
    \begin{tabular}{|C{.16\textwidth}|C{.16\textwidth}|C{.28\textwidth}|}
    \hline
    hello & \textcolor{blue}{hello} \textcolor{green}{hello} & receptors\\ \hline
    hello & \textcolor{blue}{hello} \textcolor{green}{hello} & \\ \hline
    hello & \textcolor{blue}{hello} \textcolor{green}{hello} & \\ \hline
\end{tabular}
\end{table}
\end{frame}
\end{document} 

答案1

看看以下解决方案是否能帮助您:

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\setbeamerfont{frametitle}{series=\bfseries}

    \usepackage{cellspace,                  % for adding vertical space around cells' contents
                tabularx}
    \setlength\cellspacetoplimit{7pt}
    \setlength\cellspacebottomlimit{7pt}
    \newcolumntype{C}{>{\centering\arraybackslash}X}
    \addparagraphcolumntypes{C}
    \usepackage{ragged2e}

\begin{document}
\begin{frame}[t,fragile]
\frametitle{Types of ...}
    \renewcommand\tabularxcolumn[1]{m{#1}}  % for vertical centering of X cell contents
    \setlength\tabcolsep{12pt}              % increase horizontal space around cell         \begin{table}
\bfseries
\begin{tabularx}{0.75\linewidth}{|*{2}{>{\hsize=0.25\hsize}SC|}
                                       >{\hsize=0.50\hsize}C|
                                } \hline
hello & \textcolor{blue}{hello} \textcolor{green}{hello} & receptors\\ \hline
hello & \textcolor{blue}{hello} \textcolor{green}{hello} &          \\ \hline
hello & \textcolor{blue}{hello} \textcolor{green}{hello} &          \\ \hline
\end{tabularx}
    \end{table}
\end{frame}

在此处输入图片描述

相关内容