如果我为表格单元格的文本添加颜色,文本的对齐就会错误。
无颜色:
配色:
梅威瑟:
\documentclass[10pt, handout]{beamer}
\usepackage{tabulary}
\usepackage{xcolor}
\begin{document}
\begin{frame}{Test}
\begin{tabulary}{\textwidth}{LLLL}
test & test & test & test \\
test & \color{red}test & test & test \\
\end{tabulary}
\end{frame}
\end{document}
我想以这样的方式使用它:
\newcommand{\highlight}{\color{black}\cellcolor{red}}
\begin{tabulary}{\textwidth}{LLLL}
test & test & test & test \\
test & \highlight test & test & test \\
\end{tabulary}
答案1
使用 \leavevmode 或 \textcolor
\documentclass[10pt, handout]{beamer}
\usepackage{tabulary}
\usepackage{xcolor}
\begin{document}
\begin{frame}{Test}
\begin{tabulary}{\textwidth}{LLLL}
test & test & test & test \\
test & \leavevmode\color{red}test & \textcolor{red}{test} & test \\
\end{tabulary}
\end{frame}
\end{document}