I would like columns 2 and 3 to be aligned to the right hand side. However, it does not seem to work.
Though several questions relate to this issue and my question will probably be marked as duplicate, I don't know what is wrong about my table.
I would be thankful for any hints, e.g. on possibly missing packages.
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}[htbp]
\begin{tabular}{p{0.1\textwidth}>{\raggedright\arraybackslash}p{0.05\textwidth}>{\raggedright\arraybackslash}p{0.05\textwidth}}
\hline
& h\_1 & h\_2 \\
\hline
x\_1 & 10.80 & 11.68 \\
x\_2 & 1.96 & 1.94 \\
\end{tabular}
\end{table}
\end{document}
Best Answer
Your columns are too narrow for the data, latex warns:
It can not align unbreakable text that is wider than the specified column width
It works if the columns are wider, also you want
\raggedleft
Although for numeric columns it is usually better to use
dcolumn
orsiunitx
to align on the decimal point.