LaTeXで\begin{table*}を使用してテーブルを作成するにはどうすればよいですか?

テーブルI作成しようとしているのは少し複雑で、次のようになります。

ここに画像の説明を入力してください

画像の曲がった線でごめんなさい。

これまでのところ、私は単純なものしか作成できませんでした:

\begin{table*}[t] \centering \begin{tabular}{ *1c | *3c | *3c | *2c | } & & & & & & & & & & & & \\ % Keep adding as many numbers of rows, etc. \end{tabular} \end{table} 

このコードでは、名前、テキスト1、テキスト2、テキスト3、テキスト4、テキスト5、テキスト6、テキスト7、テキスト8の列があります。追加できますテーブル全体で必要な数の行。

画像の左側と上部にカテゴリ1、カテゴリ2、カテゴリ3のパットがありません。

コメント

回答

これが出発点です。間隔は調整できますが、調整する必要がありますが、これはテーブルに入力した後でのみ意味があります。

画像の説明を入力してくださいここ

\documentclass{article} \usepackage{rotating} \newcommand\sw[1]{\begin{sideways}#1\end{sideways}} \usepackage{multirow} \begin{document} \begin{tabular}{r|l|*8{c|}} \multicolumn{2}{c|}{} & \multicolumn{3}{c|}{Category 1} & \multicolumn{3}{c|}{Category 2} & \multicolumn{2}{c|}{Category 3} \\\cline{3-10} & Name & \sw{Text1} & \sw{Text2} & \sw{Text3} & \sw{Text4} & \sw{Text5} & \sw{Text6} & \sw{Text7} & \sw{Text8} \\\hline \multirow{4}{*}{\sw{\small Category 1}} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\hline \multirow{4}{*}{\sw{\small Category 2}} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\cline{2-10} & & & & & & & & & \\\hline \end{tabular} \end{document} 

編集:コメントで尋ねられたように、カテゴリ3の列数を2から6に増やす方法:

  • テーブルを開始する行を

    \begin{tabular}{r|l|*{12}{c|}} 
  • 見出しの\multicolumn

  • \clineコマンドを\cline{3-14}および\cline{2-14}それぞれ。

  • 縦線を表示するには、空のままの場合でも、すべての行に列を追加する必要があります。これは、列見出しに

     & \sw{Text9} & \sw{Text10} & \sw{Text11} & \sw{Text12} 

を追加し、他の行を

コメント

  • 私はまだこれを理解しようとしています。カテゴリ3の列数を2から6に増やす方法についてのヒントを教えてください(つまり、テキスト7、8、9、10、11、12)また、間隔を調整するにはどうすればよいですか?/
  • 私の答えの編集を参照してください。 LaTeXでテーブルがどのように機能するかについてのチュートリアルを必ず読んでください。そうでない場合は、変更を加えるたびに質問する必要があります。間隔については、テーブルが完成するまで延期してください。次に、'特に何かが気に入らないかどうかをもう一度尋ねます。
  • つまり、間隔の問題は1つだけです。これをうまくするにはどうすればよいですか?次のようになります- drive.google.com/open?id=0B6unL1yNveR6eGlNUXZjaUdNVzA はい、ドキュメントを確認し、テーブルで作業します。
  • 基本的に、カテゴリ1とカテゴリ2のテキストはテーブルの左側で衝突しており、6番目の列はデフォルトで少し広くなっています。
  • わかりました。複数行オプションで正しい数値を使用していませんでしたが、6番目の列はまだ幅が広くなっています。

回答

ブックタブを使用することをお勧めします。

次のコードの出力

\documentclass{standalone} \usepackage{booktabs} \usepackage{rotating} \newcommand\sw[1]{\small\begin{sideways}#1 \end{sideways}} \usepackage{multirow} \begin{document} \def\arraystretch{1.25} \begin{tabular}{rl*8{c}} \toprule \multicolumn{2}{c}{} & \multicolumn{3}{c}{Category 1} & \multicolumn{3}{c}{Category 2} & \multicolumn{2}{c}{Category 3} \\ & Name & \sw{Text1} & \sw{Text2} & \sw{Text3} & \sw{Text4} & \sw{Text5} & \sw{Text6} & \sw{Text7} & \sw{Text8} \\ \midrule \multirow{4}{*}{\sw{Category 1}} & a & A & & & & & & & \\ & b & B & & & & & & & \\ & c & C & & & & & & & \\ & d & D & & & & & & & \\ \multirow{4}{*}{\sw{Category 2}} & a & A & & & & & & & \\ & b & B & & & & & & & \\ & c & C & & & & & & & \\ & d & D & & & & & & & \\ \bottomrule \end{tabular} \end{document} 

回答

\rotatebox{angle}{text} でテキストを回転します( rotatingパッケージが必要です)。

\multicolumn{num_cols}{alignment}{contents} を使用して、複数にまたがるセルを作成できます列。

\cline{from-to} は、 しない水平ルールに使用できます。 / em>すべての列にまたがります。

\multirow{num_rows}{width}{contents} を使用して、にまたがるセルを作成できます複数の行( multirowパッケージが必要です) 。

表形式の*{11}{c|}の引数は、c|の11倍のショートカットです。 id = “99d6989ce7″>

arrayパッケージ。

\documentclass{article} \usepackage{array} \usepackage{rotating}% https://en.wikibooks.org/wiki/LaTeX/Rotations \usepackage{multirow}% https://tex.stackexchange.com/a/73285/120953 \newcommand{\cat}[1]{#1} \newcommand{\thead}[1]{#1} \newcommand{\catver}[1]{\rotatebox{90}{\cat{#1}}} \newcommand{\theadver}[1]{\rotatebox{90}{\thead{#1}\hspace{.7em}}} \begin{document} \begin{tabular}{*{11}{c|}} \multicolumn{2}{l|}{} & \multicolumn{3}{l|}{\cat{Category~1}} & \multicolumn{3}{l|}{\cat{Category~2}} & \multicolumn{3}{l|}{\cat{Category~3}} % https://tex.stackexchange.com/a/8555/120953 \\\cline{3-11} & \thead{Name} & \theadver{Text~1} & \theadver{Text~2} & \theadver{Text~3} & \theadver{Text~4} & \theadver{Text~5} & \theadver{Text~6} & \theadver{Text~7} & \theadver{Text~8} & \theadver{Text~9} \\\hline \multirow{5}{*}{\catver{Category~1}} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\hline \multirow{5}{*}{\catver{Category~2}} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\hline \multirow{5}{*}{\catver{Category~3}} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\cline{2-11} &&&&&&&&&&\\\hline \end{tabular} \end{document} 

さらに可能性があります複数行のセルのコンテンツを垂直方向に中央揃えすることに関するこの質問に関心があります。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です