我得到了下表:
\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}