3

I am completely new to LaTeX and how to create tables in this environment. Currently, I am trying to create a table that contains much text in each cell using tabularx. The output does not look too bad, a lot of Underfull \hbox (badness 10000) in paragraph errors are created in the log related to the individual cells.

Is there any way to amend this?

I am trying to make following table:

\documentclass[12pt,a4paper]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage{booktabs,tabularx}

\begin{document}
\begin{table}
\centering
\caption{Diagnostic tests overview}
\setlength{\tabcolsep}{10pt}
\begin{tabularx}{\textwidth}{X p{2.8cm} p{2.8cm} p{2.8cm}}
\toprule
Test & Diagnose & $H_0$ & $H_1$ \\
\midrule
F-test & Joint significance & $\beta_0=\beta_1=\ldots=\beta_i=0$ & Some or all $\beta_i\neq0$ \\[0.7cm]
Jarque-Bera & Normality & No skewness or excess kurtosis & Non-normality \\[0.7cm]
White & Hetero\-skedasticity & Homo\-skesdasticity & Hetero\-skedasticity \\[0.7cm]
White Cross-Products (X) & Hetero\-skedasticity & Homo\-skesdasticity & Hetero\-skedasticity \\[0.7cm]
Breusch-Godfrey & Autocorrelation & No autocorrelation & Autocorrelation \\[0.7cm]
Ramsey\-RESET 1 & Misspecification & Correct specification & Misspecification \\[0.7cm]
Ramsey\-RESET 2 & Misspecification & Correct specification & Misspecification \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
0

1 Answer 1

5

The underful boxes are because LaTeX is trying to justify the text in the narrow columns with very little text. using

\begin{tabularx}{\textwidth}{
>{\raggedright\arraybackslash}X 
*{3}{>{\raggedright\arraybackslash}p{2.8cm}}
}

sets the text ragged and the underfull warnings go away, but you get some overfull warnings

Overfull \hbox (2.05496pt too wide) in paragraph at lines 25--25
[]|\OT1/cmr/m/n/12 Misspecification|

as that word is wider than the column. If you use

\begin{tabularx}{\textwidth}{
>{\raggedright\arraybackslash}X 
*{3}{>{\raggedright\arraybackslash}p{2.9cm}}
}

LaTeX goes very quiet.

2
  • Why is it "bad" to justify text in narrow columns? I mean, if the space is not between the words it will be after the last word of the row. I don't see it very different and I do like it better to see a defined column of text.
    – Miquel
    Jun 18, 2020 at 9:32
  • @Miquel it may look prettier if you are just looking at the page as a picture but it is far less readable Jun 18, 2020 at 10:34

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.