
私は、このウェブページ:
複数のセルを 2 番目のテーブル列のセルに表示させようとしています。これはどのように実行できますか?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} を使用して部分的な水平線を配置するだけです。
ただし、ファイル内のセルを手作業ではなく手動で入力する場合は、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}
答え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}
一ページ目:
2ページ目:
答え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}
セル内のテキストは、他の回答から部分的に取得されています。