我得到下表:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{pbox}
\title{Skills Matrix}
\author{Raphael Fritz}
\date{February 2019}
\begin{document}
\begin{table}[h]
\begin{tabularx}{\textwidth}{|l|X|X|}
\hline
\multicolumn{3}{|l|}{\textbf{Programming Languages}} \\ \hline
Skill & Degree of \newline experience \footnote{test} & Commentary \\ \hline
Java & 3 & this is a very long text and it needs much space in here \\ \hline \hline
\multicolumn{3}{|l|}{\textbf{test titel 2}} \\ \hline
Skill & Degree of \newline experience & Commentary \\ \hline
\end{tabularx}
\end{table}
\end{document}
它看起来像这样
第二列不需要那么多空间。最后一列需要更多空间。为什么第二列和第三列分布均匀?我该如何改变这种情况?
那么如何才能使表格占据纸张的整个宽度呢?
答案1
看看这是否能帮助你:
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X} % <--
\begin{document}
\begin{table}[ht] % <--
\begin{tabularx}{\textwidth}{|l|>{\hsize=0.6\hsize}L| % <--
>{\hsize=1.4\hsize}L|} % <--
\hline
\multicolumn{3}{|l|}{\textbf{Programming Languages}} \\ \hline
Skill & Degree of experience \footnote{test} & Commentary \\ \hline
Java & 3 & this is a very long text and it needs much space in here \\ \hline \hline
\multicolumn{3}{|l|}{\textbf{test titel 2}} \\ \hline
Skill & Degree of \newline experience & Commentary \\ \hline
\end{tabularx}
\end{table}
\end{document}