Hi fboehlandt,
Welcome to the LaTeX community!
You're nearly there. I took the liberty of completing your code snippet into a
minimal working example (MWE) (if you don't know or are not sure what that is you should follow the link for future questions).
fboehlandt wrote:I am becoming increasingly frustrated with introducing tables into my document, in particular with the number of packages available (tabu, tabularx, tabulary, ...).
Tables are not one of LaTeX's strengths and often a source of frustration for many users so you are not alone

The number of available packages often adds to the confusion but are a great resource once you get to know them and what they're capable of and what they can't do.
fboehlandt wrote:- Table full width of text.
- All columns equal width.
- Cell alignment left except first (cell alignment right).
- No padding for the cell left-/right-most position.
- This is already solved by
\begin{tabularx}{\textwidth}
. I added \usepackage{showframe} to visualize this. You can safely remove it again.
- This is solved by using tabularx'
X
columns for all columns (you haven't used it for the first column).
- Your example contradicts your requirement 3. where you use exactly the opposite. I changed it accordingly but maybe that was wrong?
- This can be achieved by using array's
@{<stuff>}
syntax that can be used in the column specification and which inserts <stuff>
between the columns where it is used and at the same time removes the space that's usually there. An empty @{}
will suppress the space.
I also used array's
*{<num>}{<spec>}
which can be used as a shortcut to insert the same column type
<num>
times. Your column specification becomes
{@{}R*{9}{X}@{}}
.
Code: Select all
\documentclass{article}
\usepackage[utf8]{inputenc}
% visualize page dimensions:
\usepackage{showframe}
% table packages
\usepackage{array,booktabs,tabularx}
\begin{document}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}%
\begin{table}
\caption{Frequency distribution of returns}
\centering
\begin{tabularx}{\textwidth}{@{}R*{9}{X}@{}}
\toprule
& m & $\bar \mu$ & $\bar \sigma^2$ & $\bar m_3$ & $\bar m_4$ & $\bar \chi_{JB}$ & $P_{\chi_{JB}}$ & $\bar d_n$ & $\bar d_n$ \\
\midrule
ABC & 38 & 1.28\% & 0.072 & 1.026 & 9.222 & 2572.5 & 89.5\% & 0.106 & 86.8\% \\
% show that alignment is as demanded:
r & l & l & l & l & l & l & l & l & l \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
Regards