tabularx セル内の \newline 間のスペースを調整する

tabularx セル内の \newline 間のスペースを調整する

tabularx でテーブルを作成しましたが、このテーブルには長いテキスト (LaTeX によってセルの末尾で改行されます) があり、手動で \newline を挿入しました。自動改行と \newline の間のスペースは同じであるため、テキストがまだ上の行に属しているのか、新しい「項目」なのかを区別することが困難です。したがって、\newline の後の垂直方向のスペースを少し増やして、テキストが新しい項目なのか、まだ前の行に属しているのかを明確にしたいと思います。

PS どうすれば回避できますかOverfull \hbox (3.91661pt too wide) detected?

\documentclass[
paper=a4,                       
12pt,                           
BCOR=0.5cm,                     
twoside=false,                  
]
{scrreprt}
\usepackage[british]{babel}     
\usepackage[utf8]{inputenc}                     
\usepackage[LGR,T1]{fontenc}                    
\usepackage{microtype}                          
\usepackage{lmodern}                            
\usepackage{setspace}                           
\onehalfspacing                                 


\usepackage{tabularx}               
\usepackage{booktabs}           
\setlength{\tabcolsep}{12pt}    

\usepackage[format=hang, labelsep=quad, font=normal, labelfont=bf, justification=justified, singlelinecheck=false, figurewithin=none, tablewithin=none]{caption} 
\usepackage{floatrow}                           
\floatsetup[table]{style=plaintop,footnoterule=none}                
\captionsetup[floatfoot]{footfont=normalsize}   
\captionsetup[table]{footfont=normalsize}   


\overfullrule=1em           
\begin{document}
    

\setlength{\extrarowheight}{.5em}
\begin{table}
    \ttabbox{%
        \caption[Comparison of relevant domains according to sepsis survivor’s perception and domains covered by SF-36 and EQ-5D]{Comparison of relevant domains according to sepsis survivor’s perception and domains covered by SF-36 and EQ-5D} \label{tab2}}
    {\begin{tabularx} {\linewidth} {lXX}
            \toprule
            Domain&SF-36 & EQ-5D  \\
            \midrule
            Physical impairment &   Physical functioning \newline Role limitations due to physical problems \newline Bodily pain & Pain/discomfort \newline Mobility  \\
            Fatigue &   Vitality & \\
            Coping with daily life  &   Social functioning & Self-care \newline Usual activities  \\
            Psychological impairment    & Role limitations due to emotional problems \newline General mental health  & Anxiety/depression  \\
            Control over one’s life &   &  \\
            Ability to walk &   &   \\
            Return to normal living &   &  \\
            Cognitive impairment    &    &  \\
            Family support  &   &  \\
            Delivery of health care &   & \\
            Self-perception &   & \\
            & General health perception & VAS overall health \\
            \bottomrule
    \end{tabularx}}
\end{table}

\end{document}

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

答え1

セル内の各項目を別々のセルとして書き込むことをお勧めします。これにより、セル内の項目間のスペースに関する問題を回避できます。

\documentclass[ paper=a4,
                12pt,
                BCOR=0.5cm,
                twoside=false]{scrreprt}
\usepackage[british]{babel}
\usepackage[LGR,T1]{fontenc}
\usepackage{microtype}
\usepackage{lmodern}
\usepackage{setspace}
\onehalfspacing
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\usepackage{booktabs, tabularx}

\usepackage[format=hang, labelsep=quad, 
            font=normal, labelfont=bf, 
            justification=justified, singlelinecheck=false, 
            figurewithin=none, tablewithin=none]{caption}
\usepackage{floatrow}
\floatsetup[table]{style=plaintop,footnoterule=none}
\captionsetup[floatfoot]{footfont=normalsize}
\captionsetup[table]{footfont=normalsize}

\begin{document}
    \begin{table}[ht]
\setlength{\extrarowheight}{.5em}
\setlength\tabcolsep{9pt}
    \caption[Comparison of relevant domains according to sepsis survivor’s perception and domains covered by SF-36 and EQ-5D]{Comparison of relevant domains according to sepsis survivor’s perception and domains covered by SF-36 and EQ-5D}
    \label{tab2}
\begin{tabularx}{\textwidth}{|l|
    *{2}{>{\raggedright\arraybackslash}X|}}
        \toprule
    Domain  &SF-36 & EQ-5D            \\
        \midrule
    Physical impairment
        &   Physical functioning
            &   Pain/discomfort     \\
        &   Role limitations due to physical problems
            &   Mobility            \\
        &   Bodily pain     &       \\
    Fatigue
        &   Vitality        &       \\
    Coping with daily life
        &   Social functioning
            &   Self-care           \\
        &   &   Usual activities    \\
    Psychological impairment
        &   Role limitations due to emotional problems
            &   Anxiety/depression  \\
        &   General mental health
            &                       \\
    Control over one’s life
        &   &                       \\
    Ability to walk         &   &   \\
    Return to normal living &   &   \\
    Cognitive impairment    &   &   \\
    Family support          &   &   \\
    Delivery of health care &   &   \\
    Self-perception         &   &   \\
        &   General health perception
            &   VAS overall health \\
        \bottomrule
\end{tabularx}
    \end{table}
\end{document}

上記の MWE のコンパイル: エラーなし、警告なし、不良 (オーバーフル) ボックスなし。

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

(赤い線はテキストの境界線を示します)

関連情報