如何正确使用 tabular/table

如何正确使用 tabular/table

请问这段代码有什么问题?

\documentclass[franch]{beamer}
\usepackage{babel}
\begin{document}
\begin{frame}{Cs}
\centering
\begin{table}
\centering
\caption{Comparatif entre \textit{Two Track Unified Process} et \textit{Rational Unified Process}}
\begin{tabular}{|c{0.5cm}|c{0.5cm}|c{0.5cm}|c{0.5cm}|c{0.5cm}|}
\hline
& Axé développement & Projets cibles & Technologies & Architecture logicielle \\
\hline
RUP & \includegraphics[height=1.8ex]{images/danger} & >= 10 & \includegraphics[height=1.8ex]{images/danger} & \includegraphics[height=1.8ex]{images/danger} \\
\hline
2TUP & \includegraphics[height=1.8ex]{images/func_ok} & * & \includegraphics[height=1.8ex]{images/func_ok} & \includegraphics[height=1.8ex]{images/func_ok} \\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}

我找不到错误。表格在输出中缺少两条垂直线。

答案1

您可以定义一个\newcolumntype

\documentclass[french]{beamer}
\usepackage{babel}
\usepackage{array}             %% you need this
\usepackage[T1]{fontenc}       %% you need this
\usepackage[utf8]{inputenc}    %% you need this
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{frame}{Cs}
\centering
\begin{table}
\centering
\caption{Comparatif entre \textit{Two Track Unified Process} et \textit{Rational Unified Process}}
\begin{tabular}{|C{0.12\textwidth}*{4}{|C{\dimexpr0.22\textwidth-2\tabcolsep\relax}}|}
\hline
& Axé développement & Projets cibles & Technologies & Architecture logicielle \\
\hline
RUP & \includegraphics[height=1.8ex]{example-image} & >= 10 & \includegraphics[height=1.8ex]{example-image-c} & \includegraphics[height=1.8ex]{example-image-a} \\
\hline
2TUP & \includegraphics[height=1.8ex]{example-image-a} & * & \includegraphics[height=1.8ex]{example-image-a} & \includegraphics[height=1.8ex]{example-image-b} \\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}

在此处输入图片描述

相关内容