1

I've created a table with tabularx where I have long text (gets broken at the end of the cell by latex) and manually inserted \newline. The space between the the automatically linebreak and the \newline is the same, making it difficult to distinguish if the text still belongs to the line above or if it is a new "item". Therefore, I would like to increase the vertical space after the \newline a bit to make it clear if the text is a new item or still belongs to the previous line.

P.S. How can I avoid the 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}

enter image description here

6
  • I don't think it would be a good idea, as in some cases one wouldn't know whether it is a new row. If you absolutely want to add some spacing, use something like \smallskip just before \newline. As to the ‘overfull hbox’ message, you can simply reduce the value of \tabcolsep, which is 6pt by default. – Bernard Nov 5 '20 at 12:38
  • Thanks for your answer. Even if I remove the \tabcolep, the 'overfull hbox' still exists. – Christian König Nov 5 '20 at 12:42
  • That's impossible if done correctly: use \setlength{\tabcolsep}{4pt}, say, just after \begin{table}. – Bernard Nov 5 '20 at 12:47
  • Did as you said... still issue still exists. – Christian König Nov 5 '20 at 12:54
  • Are you sure the message is related to the table? – Bernard Nov 5 '20 at 12:57
0

I would rather wrote each item in cell as separate cell. By this I would avoided your problem regarding space between items in cells:

\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}

Compilation of aboe MWE: no errors, no warnings, no bad (overfull) boxes.

enter image description here

(red lines show text borders)

1
  • Thank you. I hoped to avoid this, but it is the most clean and elegant way. – Christian König Nov 5 '20 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.