Tabularx を使用して、単語をテーブル コンテンツの 2 行目に移動するにはどうすればよいですか?

Tabularx を使用して、単語をテーブル コンテンツの 2 行目に移動するにはどうすればよいですか?

自動的に「-」を付けずに単語を 2 行目に表示するにはどうすればよいですか? たとえば、次のようになります。

Example-->Ex- ample

テーブルの長さを調整しようとしましたが、まだできません。tabularx

試してみました\spaceが、変な感じがします。

\documentclass[12pt,oneside]{book}
\usepackage{tabularx}
\usepackage{booktabs, ragged2e}   

\begin{document}

\begin{table}[h!]
\centering
    \begin{tabularx}{\textwidth}{>{\RaggedRight\arraybackslash}c X c c c c c }
      \toprule
           & & \multicolumn{2}{>{\centering\arraybackslash}p{8em}}{\textbf{95\% Confidence Interval of the Difference}}  &  \textbf{t}
           & \textbf {df} 
           & \textbf {Sig.(2-tailed)}  \\
     \cmidrule{3-4}  
           & & \multicolumn{1}{c}{\textbf{Lower}} &  \multicolumn{1}{c}{\textbf{Upper}} & & &\\
     \midrule
           Pair 1 & Fruit Fruit Example Dataset (AA) - Fruit Fruit Example Dataset (BB) & 34.33\% &  34.33\% & 34.33 & 34.33 & 34.33\\
    \bottomrule
    \end{tabularx}
\end{table}

\end{document}

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

答え1

環境を次のように再編成しますtabularx

  • まず第一に、デイヴィッド・カーライルの答え>{\RaggedRight\arraybackslash}cを に変更し、 (ハイフネーションが許可されている場合) または(ハイフネーションが許可されていない場合)にc変更します。X>{\RaggedRight\arraybackslash}X>{\raggedright\arraybackslash}X

  • \tabcolsep列間の空白の量を制御するパラメータ の値を 3 分の 1 減らします(デフォルト値 から6ptまで4pt)。

  • 最初の列の左側と最後の列の右側にある不要な空白スペースを削除します。

  • 使用しないでください太字ヘッダー セルの場合、大きな影響を与える必要はありませんが、限られたスペースを大量に占有します。

  • ヘッダー セルの 1 つに略語を使用します。

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

\documentclass[12pt,oneside]{book}
\usepackage{tabularx,booktabs}   
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcommand\smalltab[1]{%
   \begin{tabular}[t]{@{}c@{}}#1 \end{tabular}}
\begin{document}

\begin{table}[h!]
\setlength\tabcolsep{4pt} % default value: 6pt
%%%\centering
\begin{tabularx}{\textwidth}{@{} c L *{5}{c} @{}}
\toprule
& & \multicolumn{2}{c}{\smalltab{95\% Conf.\ Int.\\ of Difference}}  & $t$ & df & \smalltab{Significance\\(2-tailed)} \\
\cmidrule(lr){3-4}  
& & Lower & Upper \\
\midrule
Pair 1 & Fruit Fruit Example Dataset (AA) -- Fruit Fruit Example Dataset (BB) 
& 34.33\% &  34.33\% & 34.33 & 34.33 & 34.33\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

答え2

cは1行のエントリなので、

>{\RaggedRight\arraybackslash}c

\RaggedRight何もしませんが、2番目のX列を右に不揃いにしたいので、次のようXに置き換えます。

>{\RaggedRight\arraybackslash}X

関連情報