0

I want to achive to create the table below in latex. I'm using xltabular (12 columns) but I'm struggling with a 4 x 4 cell (Firma)

enter image description here

I've done this so far... but how can I achieve this ?

(Please look at the new command \xltmulticolumn, by this I'm creating multicols in 12 columns grid)

\documentclass[10pt,table]{report}

%%%%%%%   Document configuration   %%%%%%%
\usepackage[spanish,es-tabla]{babel}
\usepackage[table]{xcolor}
\usepackage[letterpaper, margin=25mm,includeheadfoot, headheight=33mm]{geometry}
\usepackage{ragged2e}
\decimalpoint
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%     Figures     %%%%%%%%%%
\usepackage{graphicx}
%\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[capposition=top]{floatrow}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%  Other  %%%%%%%%%%%
\usepackage{xltabular}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{adjustbox}
\usepackage[normalem]{ulem}
%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%   Configuration    %%%%%%%%%

%%%%%%%
% Color
%%%%%%%

\definecolor{codeColor}{RGB}{89,156,255}
\definecolor{blue}{RGB}{4, 121, 181}
\definecolor{link}{RGB}{25, 74, 141}
\definecolor{cherry}{RGB}{90, 18, 54}
\definecolor{lilac}{RGB}{174, 182, 211}
\definecolor{lightwhite}{RGB}{241, 241, 241}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%   Table   %%%%%%%%%%%

\newcommand{\xltmulticolumn}[3]{
    \multicolumn{#1}
    {|>{\hsize=\dimexpr#1\hsize+\tabcolsep * (2 * (#1 - 1) )+\arrayrulewidth* (#1 - 2)\relax}#2|}
    {#3}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%    Title    %%%%%%%%%%%
\title{My title}
\author{Lorem ipsum}
\date{\today}
\newcommand{\inlinemaketitle}{{\let\newpage\relax\maketitle}}
%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
    \pagenumbering{gobble}
    \nocite{*}
    \frenchspacing
        
    \renewcommand{\arraystretch}{2}
    \begin{xltabular}{\textwidth}{| X | X | X | X | X | X | X | X | X | X | X | X |}
        \endhead \hline
        \endfoot \hline
        % Título del protocolo %
        \rowcolor{cherry}
        \xltmulticolumn{12}{X}{
            \centerline{\textcolor{white}{TÍTULO DEL PROTOCOLO}}
        } \\ \hline
        \xltmulticolumn{12}{X}{
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sit amet turpis metus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae
        } \\ \hline
        % Datos del protocolo%
        \rowcolor{cherry}
        \xltmulticolumn{12}{X}{
            \centerline{\textcolor{white}{DATOS DEL PROTOCOLO}}
        } \\ \hline
        \xltmulticolumn{4}{X}{
            \raggedleft Número de revisión \\
            \tiny{(Primera, segunda tercera o Protocolo para registro)}
        } &
        \xltmulticolumn{2}{X}{
            Primera
        } &
        \xltmulticolumn{3}{X}{
            \raggedleft Semestre
        } &
        \xltmulticolumn{3}{X}{
            2022-2
        }\\ \hline
        \xltmulticolumn{4}{X}{
            \raggedleft Número de proyecto asignado \\
            \tiny{(Número asignado por el profesor de especialidad)}
        } &
        \xltmulticolumn{2}{X}{
            
        } &
        \xltmulticolumn{3}{X}{
            \raggedleft Fecha\\
            \tiny{(Fecha programada)}
        } &
        \xltmulticolumn{3}{X}{
            2022
        }\\ \hline
        \rowcolor{cherry}
        \xltmulticolumn{12}{X}{
            \centerline{\textcolor{white}{ALUMNO 1}}
        } \\ \hline
        % Datos alumno %
        \rowcolor{lightwhite}
        \xltmulticolumn{8}{X}{
            \centerline{DATOS ALUMNO 1}
        } &
        \xltmulticolumn{4}{X}{
            \centerline{FIRMA}
        } \\ \hline
        % Inicio datos%
        \xltmulticolumn{3}{c}{
            \raggedleft Nombre del alumno
        } &
        \xltmulticolumn{5}{c}{
            Lorem ipsum
        } &
        \xltmulticolumn{4}{c}{
            \multirow{2}{*}{}
        } \\ \hline
        
        \xltmulticolumn{3}{c}{
            \raggedleft Número de boleta
        } &
        \xltmulticolumn{5}{c}{
            this is secret
        } &
        \xltmulticolumn{4}{c}{
            
        } \\ \hline
        
    \end{xltabular}

\end{document}

enter image description here

EDIT: changed \xltmulticolumn{4}{X} to \xltmulticolumn{4}{c}

Fast solution: change \hline to \cline{1-8} but I'm wondering if there's a solution with multirow

3
  • 1
    Please make your document example minimal. Remove all definitions and packages which are not relevant to your table.
    – Zarko
    Commented Feb 23, 2022 at 7:10
  • Done, I just deleted the ones I think are not necessary Commented Feb 23, 2022 at 7:17
  • Any news? Does provided answer solve your problem?
    – Zarko
    Commented Mar 25, 2022 at 11:13

1 Answer 1

0

Something like this?

enter image description here

  • defined are new column types (C, L and R)
  • removed are all local \raggedleft commands
  • before multirow cel are used \cline{1-8}s
  • \multirow spned 8 lines in 4 rows, do it had to be declared as \multirow{8}{...}{...}`
\documentclass{report}
\usepackage[table]{xcolor}

%%%%%%%%%%%   Fonts  %%%%%%%%%%%
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\usepackage[altbullet]{lucidabr}
\usepackage{graphicx}
\usepackage{caption}
%%%%%%%%%%%   Table   %%%%%%%%%%%
\usepackage{multicol, multirow, xltabular}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\newcommand\xltmulticolumn[3]%
{
\multicolumn{#1}
            {|>{\hsize=\dimexpr#1\hsize + \tabcolsep*(2*(#1-1))
                                        + \arrayrulewidth*(#1-2)\relax}#2|}
            {#3}
}

%%%%%%%%%%%  Other  %%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[hidelinks]{hyperref}
\usepackage[spanish]{cleveref}

\definecolor{codeColor}{RGB}{89,156,255}
\definecolor{blue}{RGB}{4, 121, 181}
\definecolor{link}{RGB}{25, 74, 141}
\definecolor{cherry}{RGB}{90, 18, 54}
\definecolor{lilac}{RGB}{174, 182, 211}
\definecolor{lightwhite}{RGB}{241, 241, 241}

%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
    \frenchspacing

    \renewcommand{\arraystretch}{2}
\begin{xltabular}{\textwidth}{| *{12}{X}}
\endhead
    \hline
\endfoot
    \hline
\rowcolor{cherry}
\xltmulticolumn{12}{C}{\textcolor{white}{TÍTULO DEL PROTOCOLO}}   \\
    \hline
\xltmulticolumn{12}{X}{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut sit amet turpis metus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae}                                  \\
    \hline
% Datos del protocolo%
\rowcolor{cherry}
\xltmulticolumn{12}{C}{\textcolor{white}{DATOS DEL PROTOCOLO}}     \\
    \hline
\xltmulticolumn{4}{R}{Número de revisión

                      \tiny{(Primera, segunda tercera o Protocolo para registro)}}
    &   \xltmulticolumn{2}{R}{Primera}
        &   \xltmulticolumn{3}{R}{Semestre}
            &   \xltmulticolumn{3}{R}{2022-2}               \\
    \hline
\xltmulticolumn{4}{R}{Número de proyecto asignado

                      \tiny{(Número asignado por el profesor de especialidad)}} 
    &   \xltmulticolumn{2}{X}{} 
        &   \xltmulticolumn{3}{R}{Fecha
        
                                  \tiny{(Fecha programada)}}
            &   \xltmulticolumn{3}{R}{2022}                 \\
    \hline
    \rowcolor{cherry}
\xltmulticolumn{12}{C}{\textcolor{white}{ALUMNO 1}}         \\
    \hline
    \rowcolor{lightwhite}
\xltmulticolumn{8}{C}{DATOS ALUMNO 1}
        & \xltmulticolumn{4}{C}{FIRMA}                      \\
    \hline
\xltmulticolumn{3}{R}{Nombre del alumno}
        &   \xltmulticolumn{5}{C}{}
            &   \xltmulticolumn{4}{R}{\multirow{8}{=}{}}    \\
    \cline{1-8}
\xltmulticolumn{3}{R}{Número de boleta}
        & \xltmulticolumn{5}{C}{}
            &   \xltmulticolumn{4}{C}{}                     \\
    \cline{1-8}
\xltmulticolumn{3}{R}{Telefono de boleta}
        & \xltmulticolumn{5}{C}{Lorem lipsum}
            &   \xltmulticolumn{4}{C}{}                     \\
    \cline{1-8}
\xltmulticolumn{3}{R}{Correa Electronico}
        & \xltmulticolumn{5}{C}{this is secret}
            &   \xltmulticolumn{4}{C}{}                     \\
    \hline    
\end{xltabular}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .