![调整 Beamer 表格中文本和单元格边界之间的间距](https://linux22.com/image/383838/%E8%B0%83%E6%95%B4%20Beamer%20%E8%A1%A8%E6%A0%BC%E4%B8%AD%E6%96%87%E6%9C%AC%E5%92%8C%E5%8D%95%E5%85%83%E6%A0%BC%E8%BE%B9%E7%95%8C%E4%B9%8B%E9%97%B4%E7%9A%84%E9%97%B4%E8%B7%9D.png)
使用以下代码这个问题,如何调整文本和单元格边距(垂直和水平)之间的间距。
\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}