使用以下代码:
\documentclass{article}
\usepackage{tabu}
\usepackage{graphics}
\usepackage{booktabs}
\begin{document}
\begin{center}
\resizebox{0.9\linewidth}{!}{%
\setlength\extrarowheight{2pt}
\begin{tabu}{
>{\bfseries\raggedright}p{0.35\linewidth}
>{\raggedright }p{0.35\linewidth}
>{\raggedright }p{0.35\linewidth}
}
\toprule
\rowfont{\bfseries}
& Patching & Small-dictionary fitting \\
\midrule
Rationale for use & remove elements inconvenient to compress & keep only elements inconveient to compress \\
Intended scope of application & minimum necessary & maximum possible \\
Number of elements remaining to compress after application & the full column's length & less than full column length (hopefully much less) \\
Elements inconveient to compress reside in & the smaller subcolumn & the smaller subcolumn \\
Compression ratio of affected data & very poor (worse than uncompressed) & very good (probably better than rest of data) \\
Potential for overhead & per each patched position & per each original column element \\
Repeat application & useless & relevant, possibly even with same-or-lower width \\
\bottomrule
\end{tabu}
}
\end{center}
\end{document}
我不喜欢的事情:
- 行间距大于单元格间距,使得行看起来好像是断开的,但实际上并没有,反之亦然
- 我宁愿不必手动调整列宽和缩放比例
- 下面有足够的空间
\midrule
,但上面几乎没有空间\bottomrule
我应该怎么做才能让它看起来更好?(除了我不喜欢的之外,请随意提出建议,包括纯粹的“代码美化”建议。)
答案1
避免\resizebox
在文本区域中放置表格。
您可以使用X
列,而不必猜测宽度。
\documentclass{article}
\usepackage{tabu}
\usepackage{ragged2e}
\usepackage{booktabs}
\usepackage{microtype}
\begin{document}
\begin{center}
\small % if you prefer
\begin{tabu}{
@{}
>{\bfseries\RaggedRight}X<{\unskip\strut}
>{\RaggedRight }X<{\unskip\strut}
>{\RaggedRight }X<{\unskip\strut}
@{}
}
\toprule
& \bfseries Patching & \bfseries Small-dictionary fitting \\
\midrule
Rationale for use &
remove elements inconvenient to compress &
keep only elements inconvenient to compress \\
\addlinespace
Intended scope of application &
minimum necessary &
maximum possible \\
\addlinespace
Number of elements remaining to compress after application &
the full column's length &
less than full column length (hopefully much less) \\
\addlinespace
Elements inconvenient to compress reside in &
the smaller subcolumn &
the smaller subcolumn \\
\addlinespace
Compression ratio of affected data &
very poor (worse than uncompressed) &
very good (probably better than rest of data) \\
\addlinespace
Potential for overhead &
per each patched position &
per each original column element \\
\addlinespace
Repeat application &
useless &
relevant, possibly even with same-or-lower width \\
\bottomrule
\end{tabu}
\end{center}
\end{document}
答案2
我认为这看起来稍微好一些(但我不知道你的行间距和单元格间距是什么意思):
\documentclass{article}
\usepackage{tabularx}
\usepackage{graphics}
\usepackage{booktabs}
\begin{document}
\begin{center}
\resizebox{0.9\linewidth}{!}{%
\setlength\extrarowheight{4pt}
\begin{tabularx}{\textwidth}{
>{\bfseries\raggedright\arraybackslash}X
>{\raggedright\arraybackslash }X
>{\raggedright\arraybackslash }X
}
\toprule
& \bfseries Patching & \bfseries Small-dictionary fitting \\
\midrule
Rationale for use & remove elements inconvenient to compress & keep only elements inconveient to compress \\
Intended scope of application & minimum necessary & maximum possible \\
Number of elements remaining to compress after application & the full column's length & less than full column length (hopefully much less) \\
Elements inconveient to compress reside in & the smaller subcolumn & the smaller subcolumn \\
Compression ratio of affected data & very poor (worse than uncompressed) & very good (probably better than rest of data) \\
Potential for overhead & per each patched position & per each original column element \\
Repeat application & useless & relevant, possibly even with same-or-lower width \\
\bottomrule
\end{tabularx}
}
\end{center}
\end{document}