[Tex/LaTex] Centered columns with fixed width using tabularx

horizontal alignmenttabularxwidth

How do I center the last seven columns in the attached text without dropping the fixed table width or the fixed column width?

\documentclass[a4paper,12pt,oneside]{article}
\usepackage{amsmath,amssymb,bm,mathtools,amsthm}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig,booktabs}
\usepackage{array}
\usepackage{multirow,dcolumn,booktabs}
\usepackage{threeparttable, tabulary, tabularx, placeins,tocloft,tocbibind}

\newcolumntype{s}{>{\hsize=1.5cm}X}

\begin{document}
\begin{threeparttable}\footnotesize
\centering
\begin{tabularx}{\textwidth}{Xsss|ssss}
\toprule
$\alpha$                &  & $ 1 $ & $ 2 $ & $ 3 $ & $ 4 $ & $ 5 $ & $ 6 $  \\
\bottomrule
\end{tabularx}
\end{threeparttable}

\end{document}

Best Answer

You need p columns for fixed width, not X also there is not room for that many columns of 1.5cm so I changed it to 1.1

\documentclass[a4paper,12pt,oneside]{article}
\usepackage{amsmath,amssymb,bm,mathtools,amsthm}
\usepackage{graphicx}
\usepackage{float}
\usepackage{wrapfig,booktabs}
\usepackage{array}
\usepackage{multirow,dcolumn,booktabs}
\usepackage{threeparttable, tabulary, tabularx, placeins,tocloft,tocbibind}

\newcolumntype{s}{>{\centering\arraybackslash}p{1.1cm}}



\begin{document}
\begin{threeparttable}\footnotesize
\centering
\begin{tabularx}{\textwidth}{Xsss|ssss}
\toprule
$\alpha$                &  & $ 1 $ & $ 2 $ & $ 3 $ & $ 4 $ & $ 5 $ & $ 6 $  \\
\bottomrule
\end{tabularx}
\end{threeparttable}

\end{document}
Related Question