
나는에 본 테이블을 복제하려고합니다.이 웹페이지:
두 번째 테이블 열의 셀에 여러 셀을 표시하려고 합니다. 어떻게 할 수 있습니까? 패키지 를 사용해보았습니다 multirow
.
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}
답변1
목표가 테이블을 재현하는 것이라면 문제는 다중 행과 관련이 없습니다. 테이블에는 4개의 열이 있으며 \cline{c1-c2}를 사용하여 부분적인 수평선만 넣으면 됩니다.
그러나 수동이 아닌 파일의 셀을 채우려면 다중 행을 사용해야 할 수도 있습니다.
\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}
답변2
\multirow
다음은 긴 테이블의 헤드 설정과 이미지 및 mwe 라인을 모두 사용한 솔루션입니다 (설명 참조).
\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}
첫 페이지:
두 번째 페이지:
답변3
ltablex
패키지와 X
패키지의 열 유형을 사용하는 솔루션 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}
셀의 텍스트는 부분적으로 다른 답변에서 가져옵니다.