数组单元格的垂直对齐和双左垂直线

数组单元格的垂直对齐和双左垂直线

如何使用此代码使表格中的 D 和 F 字符出现在单元格的顶部?

\documentclass[french]{beamer}
\usepackage{babel}

\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}   

\begingroup
\defbeamertemplate{enumerate item}{image}{\small\includegraphics[height=1.8ex]{images/gofor}}
\makeatletter
\def\@listii{\leftmargin\leftmarginii
              \topsep    2ex
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\makeatother
\begin{frame}{Conclusion}
\begin{table}
\centering
\caption{Comparatif entre ATL et MFC}
\vspace{0.4cm}
\begin{tabular}{|C{0.07\textwidth}*{4}{|C{\dimexpr0.22\textwidth-2\tabcolsep\relax}}|}
\hline
& {\fontsize{9}{9}\selectfont Gestion avancée des threads} & {\fontsize{9}{9}\selectfont Gestion de la mémoire} & {\fontsize{9}{9}\selectfont Vitesse d'exécution} & {\fontsize{9}{9}\selectfont Difficulté} \\
\hline
MFC & \includegraphics[height=1.8ex]{images/danger} & \includegraphics[height=1.8ex]{images/danger} & \includegraphics[height=1.8ex]{images/danger} & {\color{green} F} \\
\hline
ATL & \includegraphics[height=1.8ex]{images/func_ok} & \includegraphics[height=1.8ex]{images/func_ok}\includegraphics[height=1.8ex]{images/func_ok} & \includegraphics[height=1.8ex]{images/func_ok}\includegraphics[height=1.8ex]{images/func_ok}\includegraphics[height=1.8ex]{images/func_ok} & {\color{red} D} \\
\hline
\end{tabular}
\end{table}
\end{frame}
\endgroup
\end{document}

并且,如何使最后一列在其左侧获得另一条垂直线?

提前致谢!

答案1

像这样?我使用该adjustbox包调整图像的垂直对齐方式;从 切换到\color\textcolor用于||获取双垂直规则:

\documentclass[french]{beamer}
\usepackage{babel}
\usepackage{adjustbox}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}   

\begingroup
\defbeamertemplate{enumerate item}{image}{\small\includegraphics[height=1.8ex]{images/gofor}}
\makeatletter
\def\@listii{\leftmargin\leftmarginii
              \topsep    2ex
              \parsep    0\p@   \@plus\p@
              \itemsep   \parsep}
\makeatother
\begin{frame}{Conclusion}
\begin{table}
\centering
\caption{Comparatif entre ATL et MFC}
\vspace{0.4cm}
\begin{tabular}{
  | C{0.07\textwidth}
  *{3}{|C{\dimexpr0.22\textwidth-2\tabcolsep\relax}}
  ||C{\dimexpr0.22\textwidth-2\tabcolsep\relax} |
  }
\hline
& {\fontsize{9}{9}\selectfont Gestion avancée des threads} & {\fontsize{9}{9}\selectfont Gestion de la mémoire} & {\fontsize{9}{9}\selectfont Vitesse d'exécution} & {\fontsize{9}{9}\selectfont Difficulté} \\
\hline
MFC & \adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}} & \adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}} & \adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}} & \textcolor{green}{F}\\
\hline
ATL & \adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}} &\adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}\includegraphics[height=1.8ex]{example-image-a}} & \adjustbox{valign=c}{\includegraphics[height=1.8ex]{example-image-a}\includegraphics[height=1.8ex]{example-image-a}\includegraphics[height=1.8ex]{example-image-a}} & \textcolor{red}{D} \\
\hline
\end{tabular}
\end{table}
\end{frame}
\endgroup
\end{document}

在此处输入图片描述

相关内容