我正在使用投影仪准备演示文稿。我想插入一个带有刻度标记的表格,我使用了$\checkmark$
。如何实现这一点
\documentclass{beamer}
\usepackage{multirow}
\begin{document}
\begin{frame}{Time-line}
\begin{table}[]
\begin{tabular}{|c|c|l|c|l|c|l|c|}
\hline
& \multicolumn{7}{c|}{Status} \\ \cline{2-8}
\multirow{-2}{*}{\begin{tabular}[c]{@{}c@{}}Assigned\\ Task\end{tabular}} & \multicolumn{2}{c|}{{\color[HTML]{000000} Work partially completed}} & \multicolumn{2}{c|}{Work fully completed} & \multicolumn{2}{c|}{Work yet to start} & Documentation \\ \hline
Task 1 & \multicolumn{2}{c|}{{\color[HTML]{000000} $\Checkmark$}} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \\ \hline
Task 2 & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & $\Checkmark$ \\ \hline
Task 3 & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & $\Checkmark$ \\ \hline
Task 4 & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{$\Checkmark$} & \multicolumn{2}{c|}{} & \\ \hline
Task 5 & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{$\Checkmark$} & \\ \hline
\end{tabular}
\end{table}
\end{frame}
\end{document}
答案1
我已替换$\Checkmark$
并\checkmark
删除了多余的\multicolumn
命令以及不必要的列。为了使表格更窄,我在列标题中引入了换行符。在下面的 MWE 中,我还为表格添加了一些替代布局。
为了改变复选标记的颜色,请使用\textcolor{red}{\checkmark}
或您选择的任何其他颜色。
\documentclass{beamer}
\usepackage{makecell}
\usepackage{multirow}
\usepackage{calc} % used in third example
\usepackage{booktabs} % Used in fourth example
\begin{document}
\begin{frame}{Time-line}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
& \multicolumn{4}{c|}{\thead{Status}} \\ \cline{2-5}
\multirow{-2}{*}{\thead{Assigned\\ Task}}
& \thead{Work\\ partially\\ completed}
& \thead{Work\\ fully\\ completed}
& \thead{Work\\ yet to\\ start}
& \thead{Documentation} \\ \hline
Task 1 & \checkmark & & & \\ \hline
Task 2 & & & \checkmark & \\ \hline
Task 3 & & & & \checkmark \\ \hline
Task 4 & & \checkmark & & \\ \hline
Task 5 & & & \checkmark & \\ \hline
\end{tabular}
\end{table}
\end{frame}
\begin{frame}{Time-line}
\renewcommand{\theadfont}{\normalsize}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|}
\hline
& \multicolumn{4}{c|}{\thead{Status}} \\ \cline{2-5}
\multirow{-2}{*}{\thead{Assigned\\ Task}}
& \thead{Work\\ partially\\ completed}
& \thead{Work\\ fully\\ completed}
& \thead{Work\\ yet to\\ start}
& \thead{Documentation} \\ \hline
Task 1 & \checkmark & & & \\ \hline
Task 2 & & & \checkmark & \\ \hline
Task 3 & & & & \checkmark \\ \hline
Task 4 & & \checkmark & & \\ \hline
Task 5 & & & \checkmark & \\ \hline
\end{tabular}
\end{table}
\end{frame}
\begin{frame}{Time-line}
\begin{table}
\centering
\begin{tabular}{|c|*{3}{>{\centering\arraybackslash}p{\widthof{completed}}|}c|}
\hline
\multirow{4}{*}{\thead{Assigned\\ Task}}
& \multicolumn{4}{c|}{\thead{Status}} \\ \cline{2-5}
& \thead{Work\\ partially\\ completed}
& \thead{Work\\ fully\\ completed}
& \thead{Work\\ yet to\\ start}
& \thead{Documentation} \\ \hline
Task 1 & \checkmark & & & \\ \hline
Task 2 & & & \checkmark & \\ \hline
Task 3 & & & & \checkmark \\ \hline
Task 4 & & \checkmark & & \\ \hline
Task 5 & & & \checkmark & \\ \hline
\end{tabular}
\end{table}
\end{frame}
\begin{frame}{Time-line}
\begin{table}
\centering
\begin{tabular}{*{5}{c}}
\toprule
& \multicolumn{4}{c}{\thead{Status}} \\ \cmidrule{2-5}
\thead{Assigned\\ Task}
& \thead{Work\\ partially\\ completed}
& \thead{Work\\ fully\\ completed}
& \thead{Work\\ yet to\\ start}
& \thead{Documentation} \\ \midrule
Task 1 & \checkmark & & & \\
Task 2 & & & \checkmark & \\
Task 3 & & & & \checkmark \\
Task 4 & & \checkmark & & \\
Task 5 & & & \checkmark & \\
\bottomrule
\end{tabular}
\end{table}
\end{frame}
\end{document}
答案2
使用该tabularx
包:
\documentclass{beamer}
\usepackage{makecell, multirow, tabularx}
\usepackage{amssymb}
\newcommand\Checkmark{\textcolor{blue}{\checkmark}}
\begin{document}
\begin{frame}
\frametitle{Time-line}
\begin{table}
\setcellgapes{3pt}
\makegapedcells
\linespread{0.84}\selectfont
\begin{tabularx}{\linewidth}{|X| *{4}{>{\centering\arraybackslash}X|}}
\hline
\multirow{3.2}{=}{\centering Assigned Task}
& \multicolumn{4}{c|}{Status of Work} \\ \cline{2-5}
& partially completed
& fully completed
& yet to start
& Documen\-tation \\ \hline
Task 1 & $\Checkmark$
& & & \\ \hline
Task 2 & & & & $\Checkmark$ \\ \hline
Task 3 & & & & $\Checkmark$ \\ \hline
Task 4 & & $\Checkmark$
& & \\ \hline
Task 5 & & & $\Checkmark$ & \\ \hline
\end{tabularx}
\end{table}
\end{frame}
\end{document}