2

I am trying to write a table. The table has 3 parts: header, body, footer. The rows of the body must have a fixed height regardless of their content. The last column should extend until there is space for it. With the code following I have a fixed height but it apply on all the rows, it is not specific for the body. I'd like to specify different heights for the header and the footer rows. Can you help? Thanks

\newcolumntype{M}[1]{%
 >{\vbox to 5ex\bgroup\vfill}%
 m{#1}%
 <{\egroup}}

\begin{table}[h]
    \begin{tabular}{|M{3cm}|>{\centering}p{0.7cm}|>{\centering}p{0.7cm}|>{\centering}p{0.7cm}|>{\centering}p{0.7cm}|m{7cm}|} 
    \hline
        & \multicolumn{4}{c}{Evaluations} &  \\ 
    \cline{2-5} 
        Cours & Elève  & Classe & Min & Max & Appréciations \\ \hline 

        Français & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur   \\
    \arrayrulecolor[gray]{.70}\hline 
        Mathématiques &15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur   \\
    \hline 
        Géographie & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod  \\ 
    \hline
        Histoire & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod  \\ 
    \arrayrulecolor{black}\hline 
        Average Rate &15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore  \\ 
    \hline
    \end{tabular}
2

It's not really clear what you mean; but you can always use \multicolumn for overriding a column specification for a cell; for having the last column extend to the maximum size available, use tabularx.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[margin=1cm]{geometry}
\usepackage{array,colortbl,tabularx}
\begin{document}
\newcolumntype{M}[1]{%
 >{\vbox to 5ex\bgroup\vfill}%
 m{#1}%
 <{\egroup}}

\begin{table}
\centering
\renewcommand{\tabularxcolumn}{m}
\begin{tabularx}{\textwidth}{
  |M{3cm}|
  >{\centering}p{1cm}|
  >{\centering}p{1cm}|
  >{\centering}p{1cm}|
  >{\centering}p{1cm}|
  X|
} 
    \hline
\multicolumn{1}{|c|}{}        & \multicolumn{4}{c}{Evaluations} &  \\ 
    \cline{2-5} 
\multicolumn{1}{|l|}{Cours} & Elève  & Classe & Min & Max & Appréciations \\ \hline 

        Français & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur   \\
    \arrayrulecolor[gray]{.70}\hline 
        Mathématiques &15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur   \\
    \hline 
        Géographie & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod  \\ 
    \hline
        Histoire & 15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod  \\ 
    \arrayrulecolor{black}\hline 
        Average Rate &15 & 15 & 15 & 15 & Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore  \\ 
    \hline
    \end{tabularx}
\end{table}
\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy