Cree una tabla LaTeX con varias columnas dentro de una celda

Cree una tabla LaTeX con varias columnas dentro de una celda

Estoy intentando replicar la tabla vista enesta página web:

ingrese la descripción de la imagen aquí

Estoy tratando de hacer que aparezcan varias celdas en las celdas de la segunda columna de la tabla. ¿Cómo se puede hacer esto? Intenté usar el multirowpaquete.

MWE:

\documentclass{article}
\usepackage{longtable}
\usepackage{multirow}
\usepackage[table]{xcolor}
\begin{document}

\begin{longtable}{|p{3cm}|p{6cm}|p{5cm}|}
\hline
\rowcolor[HTML]{000000}
\multicolumn{1}{|c|}{\cellcolor[HTML]{000000}{\color[HTML]{FFFFFF} \textbf{Object}}}
    &\multicolumn{1}{|c|}{\cellcolor[HTML]{000000}{\color[HTML]{FFFFFF} \textbf{Details}}}
    & \multicolumn{1}{|c|}{\cellcolor[HTML]{000000}{\color[HTML]{FFFFFF} \textbf{Notes}}} \\ \hline
 NAME & \multicolumn{2}{c|}{test} {DATE} \\ {Time (UTC): 22:59:41-23:22:48} \\
                {Filter/s used: I, R, B, V} \\ {Telescope/s used: TELESCOPE}
    & A total of 20 exposures all taken with an exposure length of 60.0 seconds. \\ \hline
\end{longtable}

\end{document}

Respuesta1

Siempre que su objetivo sea simplemente reproducir la tabla, su problema no tiene nada que ver con varias filas. Tu tabla tiene 4 columnas y solo tienes que poner líneas horizontales parciales con \cline{c1-c2}.

Sin embargo, si desea completar las celdas de su archivo en lugar de hacerlo manualmente, es posible que deba utilizar varias filas.

\documentclass{article}

\usepackage[width=20cm]{geometry}

\usepackage{longtable}
\usepackage[table]{xcolor}

\newcommand\doublestrut{\vrule width 0pt height 2\ht\strutbox depth 2\dp\strutbox}

\begin{document}
\footnotesize
\begin{tabular}{|p{3cm}|p{2.4cm}|p{2.4cm}|p{10cm}|}\hline
\rowcolor{black}
\multicolumn{1}{|c|}{\doublestrut\color{white}\textbf{Index}}  &
    \multicolumn{2}{c|}{\color{white}\textbf{Details}}         &
    \multicolumn{1}{c|}{\color{white}\textbf{Notes}}\\\hline
\hfil Object & Date       & Time                    & \\
             &            &                         & \\\cline{2-3}
             & Eye Pierce & Seeing                  & \\
             &            &                         & \\\cline{2-3}
             & \multicolumn{2}{l|}{Instrument Type} & \\
             & \multicolumn{2}{l|}{}                & \\\hline
\hfil Object & Date       & Time                    & \\
             &            &                         & \\\cline{2-3}
             & Eye Pierce & Seeing                  & \\
             &            &                         & \\\cline{2-3}
             & \multicolumn{2}{l|}{Instrument Type} & \\
             & \multicolumn{2}{l|}{}                & \\\hline
\end{tabular}
\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

Aquí una solución con \multirowla configuración del cabecero de la mesa larga y tanto con su imagen como con mwe líneas (ver comentarios):

\documentclass{article}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3.5cm,lmargin=2cm,rmargin=2cm,marginparwidth=1cm}% Set these parameters according to your need 

\usepackage{longtable}
\usepackage{makecell} 
\usepackage{multirow}
\usepackage[table]{xcolor}
\renewcommand*{\arraystretch}{1.3}
\newcommand{\whitebf}[1]{\textcolor{white}{\textbf{#1}}}
%\usepackage{showframe}% Uncomment this to see the frame of your document, it is usefull to avoid going out of the borders

\begin{document}
\centering
\begin{longtable}{|p{3cm}|p{3cm}|p{3cm}|p{5cm}|}
    \rowcolor{black}
    \makecell[c]{\whitebf{Object}} &
    \multicolumn{2}{c}{\whitebf{Details}} & 
    \makecell[c]{\whitebf{Notes}} \\*
    \hline
    \endhead
    % Here I try to redo your MWE lines:
    \makecell[c]{Name} & Date & Time (UTC) & \multirow[t]{6}{5cm}{A total of 20 exposures all taken with an exposure length of 60.0 seconds.}\\*
    \multirow[t]{5}{3cm}{NAME has done this} & 17/11/2016 & 22:59:41-23:22:48 & \\*
    \cline{2-3}
     & Filter/s used & Something & \\* 
     & I, R, B, V & Quack & \\*
    \cline{2-3} 
     & \multicolumn{2}{l|}{Telescope/s used}  & \\*
     & \multicolumn{2}{l|}{TELESCOPE}  & \tabularnewline
    \hline 
    % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
     & Eye Pierce & Seeing &\\* 
     &  &  &\\*
    \cline{2-3} 
     & \multicolumn{2}{l|}{Instrument Type}  & \\*
     & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
        % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
    & Eye Pierce & Seeing &\\* 
    &  &  &\\*
    \cline{2-3} 
    & \multicolumn{2}{l|}{Instrument Type}  & \\*
    & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
        % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
    & Eye Pierce & Seeing &\\* 
    &  &  &\\*
    \cline{2-3} 
    & \multicolumn{2}{l|}{Instrument Type}  & \\*
    & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
        % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
    & Eye Pierce & Seeing &\\* 
    &  &  &\\*
    \cline{2-3} 
    & \multicolumn{2}{l|}{Instrument Type}  & \\*
    & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
        % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
    & Eye Pierce & Seeing &\\* 
    &  &  &\\*
    \cline{2-3} 
    & \multicolumn{2}{l|}{Instrument Type}  & \\*
    & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
    \newpage
    % Here I try to redo your image lines:
    \makecell[c]{Object} & Date & Time & \multirow[t]{6}{5cm}{ }\\*
    \multirow[t]{5}{3cm}{ } &  &  & \\*
    \cline{2-3}
    & Eye Pierce & Seeing &\\* 
    &  &  &\\*
    \cline{2-3} 
    & \multicolumn{2}{l|}{Instrument Type}  & \\*
    & \multicolumn{2}{l|}{ }  & \tabularnewline
    \hline
\end{longtable}
\end{document}

Primera página:

Primera página

Segunda pagina:

Segunda pagina

Respuesta3

Solución con uso de ltablexpaquete y Xtipo de columna del paquete tabularx:

\documentclass{article}
\usepackage[margin=30mm]{geometry}
\usepackage{ltablex,makecell,multirow}
    \renewcommand\thead{\color{white}\bfseries\normalsize}
\newlength\noteswidth
\setlength\noteswidth{5cm}% <-- width of the column wit notes
    \newcommand\mcp[1]{\multicolumn{2}% <-- calculation of multicolumn width
                        {p{\dimexpr0.66\linewidth-0.66\noteswidth-3\tabcolsep\relax}|}{#1}}
    \newcolumntype{C}{>{\centering\arraybackslash}X}% first column has centered content
\usepackage[table]{xcolor}

\begin{document}
{\renewcommand\arraystretch{1.2}% <-- more vertical space
\begin{tabularx}{\textwidth}{|C|X|X|p{\noteswidth}|}
\hline
\rowcolor[HTML]{000000}
\thead{Object}
        &   \mcp{\hfil \thead{Details}}
            &   \hfil\thead{Notes}                                   \\ 
        \hline
\endhead% head will appear on each new page with this table
\multirow[t]{6}{=}{Name}   
    &   Date \newline
        17/11/2016      &   Time (UTC):\newline
                            22:59:41-23:22:48
                            &   \multirow[t]{6}{=}{A total of 20
                                exposures all taken with an exposure
                                length of 60.0 seconds}     \\
    \cline{2-3}
    &   Filter/s used:\newline
        I, R, B, V      & quack!        &                   \\
    \cline{2-3}
    &   \mcp{Telescope/s used:\newline TELESCOPE}
                            &                               \\
    \hline
\multirow[t]{6}{=}{Name}
    &   Date \newline
        17/11/2016      &   Time (UTC):\newline
                            22:59:41-23:22:48
                            &   \multirow[t]{6}{=}{A total of 20
                                exposures all taken with an exposure
                                length of 60.0 seconds}     \\
    \cline{2-3}
    &   Filter/s used:\newline
        I, R, B, V      & quack, quack! &                   \\
    \cline{2-3}
    &   \mcp{Telescope/s used:\newline TELESCOPE}
                            &                               \\
    \hline
\end{tabularx}
}
\end{document}

El texto de las celdas se ha tomado en parte de otras respuestas.

ingrese la descripción de la imagen aquí

información relacionada