
Estou tentando replicar a tabela vista emesta página da web:
Estou tentando fazer com que várias células apareçam nas células da segunda coluna da tabela. Como isso pode ser feito? Eu tentei usar o multirow
pacote.
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}
Responder1
Contanto que seu objetivo seja apenas reproduzir a tabela, seu problema não tem nada a ver com multilinhas. Sua tabela possui 4 colunas e basta colocar linhas horizontais parciais com \cline{c1-c2}.
No entanto, se quiser preencher as células do seu arquivo em vez de manualmente, talvez seja necessário usar multirow.
\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}
Responder2
Aqui está uma solução com \multirow
a configuração da cabeceira da mesa longa e ambas com sua imagem e linhas mwe (ver comentários):
\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}
Primeira página:
Segunda página:
Responder3
Solução com uso de ltablex
package e X
columntype de package 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}
O texto nas células foi parcialmente retirado de outras respostas.