![次の表をどのように設計しますか?](https://rvso.com/image/461913/%E6%AC%A1%E3%81%AE%E8%A1%A8%E3%82%92%E3%81%A9%E3%81%AE%E3%82%88%E3%81%86%E3%81%AB%E8%A8%AD%E8%A8%88%E3%81%97%E3%81%BE%E3%81%99%E3%81%8B%3F.png)
答え1
私が主にお勧めするのは、資料を転置して、10 列以上ではなく 4 列または 5 列だけにすることです。
\documentclass{article}
\usepackage{array,booktabs}
\usepackage[flushleft]{threeparttable}
\begin{document}
\begin{table}[h]
\centering
\begin{threeparttable}
\caption{Test accuracies achieved by models trained on datasets R1, R2, and~R3}
\begin{tabular}{@{} ll ccc @{}}
\toprule
\multicolumn{2}{@{}l@{}}{Model} & \multicolumn{3}{c@{}}{Training Phases} \\
\cmidrule(l){3-5}
&& Phase 1 & Phase 2 & Phase 3 \\
\midrule
\multicolumn{2}{@{}l@{}}{Decision Tree} \\
& R1 & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots \\
\addlinespace
\multicolumn{2}{@{}l@{}}{LSTU} \\
& R1 & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots \\
\addlinespace
\multicolumn{2}{@{}l@{}}{Average} \\
& R1 & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
補遺OPのフォローアップコメント/リクエストに対応するために:上記の表に中央揃えの新しい列を挿入し、新しいヘッダーの内容として「ベースライン」を使用するには、次の変更を行う必要があります。
\begin{tabular}{@{} ll ccc @{}}
と
\begin{tabular}{@{} ll c ccc @{}}
次に変更
\cmidrule(l){3-5}
に
\cmidrule(l){4-6}
もちろん、新しい列 3 の内容を、各行に 1 つのセルとして表に挿入することを忘れないでください。
\documentclass{article}
\usepackage{array,booktabs}
\usepackage[flushleft]{threeparttable}
\newcommand\ML[1]{\multicolumn{2}{@{}l}{#1}} % handy shortcut macro
\begin{document}
\begin{table}[h]
\centering
\begin{threeparttable}
\caption{Test accuracies achieved by models trained on datasets R1, R2, and~R3}
\begin{tabular}{@{} ll c ccc @{}}
\toprule
\ML{Model} & Baseline & \multicolumn{3}{c@{}}{Training Phases} \\
\cmidrule(l){4-6}
&&& Phase 1 & Phase 2 & Phase 3 \\
\midrule
\ML{Decision Tree} \\
& R1 & \dots & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots & \dots \\
\addlinespace
\ML{LSTU} \\
& R1 & \dots & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots & \dots \\
\addlinespace
\ML{Average} \\
& R1 & \dots & \dots & \dots & \dots \\
& R2 & \dots & \dots & \dots & \dots \\
& R3 & \dots & \dots & \dots & \dots \\
\bottomrule
\end{tabular}
\end{threeparttable}
\end{table}
\end{document}
答え2
名前を繰り返してもそれほど問題ないと思います。私は次のように考えました。データによっては、パッケージS
の列を使用しsiunitx
たり、テキストを太字 ( \textbf{...}
) にしたりする必要があるかもしれません。
\documentclass{article}
\usepackage{booktabs,multirow}
\begin{document}
\begin{tabular}{llllllllll}
\toprule
\multirow{2}{*}{Training phases} & \multicolumn{3}{c}{Decision Tree} & \multicolumn{3}{c}{LST M} & \multicolumn{3}{c}{Average} \\ \cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){8-10}
& R1 & R2 & R3 & R1 & R2 & R3 & R1 & R2 & R3 \\ \midrule
Training phase 1 & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\
Training phase 2 & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\
Training phase 3 & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots \\ \bottomrule
\end{tabular}
\end{document}
答え3
テーブルに関する質問は大体答えられると思いますが、Excel2latex が役に立ちます。これは、Excel の TableView で LATEX コードを自動的に編集できる強力な Excel マクロです。非常に良い市場であり、オープンアクセスでオンラインで利用できます。使用に必要なパッケージ (bigstruth、colortbl、multirow など) を確認するには、Ladyte Macro の「Reed me」を参照してください。
このツールを使用すると、Excel でテーブルを作成できます。選択して「convert table to latex」をクリックしてください。 1 秒後に、選択したテーブルの LaTeX コードが生成されます。
答え4
このような表を作成する必要がある場合、私は Excel2latex を使用します。これは、Excel の表の LaTeX コードを自動的に再現する優れた Excel マクロです。これは非常によく機能し、Open Access でオンラインで入手できます。マクロの使用に必要なパッケージ (bigstruth、colortbl、multirow など) を確認するには、マクロの「Read me」を確認する必要があります。
このツールを使用すると、Excel で表を作成できます。次に、表を選択して「表を LaTeX に変換」をクリックします。1 秒で、選択した表の LaTeX コードが生成されます。