I'm trying to create a table with exactly the same width as the surronding text.
I would expect that the command \resizebox{\linewidth}{!}{..table..}
should do the job. However, the tables width is still too small.
\documentclass{scrartcl}
\usepackage{graphicx}
\usepackage[table]{xcolor}
\setlength{\parindent}{0pt}
\usepackage[
top=0.600cm,
bottom=0.600cm,
left=0.600cm,
right=0.600cm]
{geometry}
\begin{document}
bla blub blaaa bla blub blaaabla blub blaaa bla blub blaaa bla blub blaaa bla blub blaaaa
bla blub blaaa bla blub blaaabla blub blaaa bla blub blaaa bla blub blaaa bla blub blaaaa
bla blub blaaa bla blub blaaabla blub blaaa bla blub blaaa bla blub blaaa bla blub blaaaa
bla blub blaaa bla blub blaaabla blub blaaa bla blub blaaa bla blub blaaa bla blub
\resizebox{\linewidth}{!}{
\begin{tabular}{|l|l|l|l|}
\hline
test entry & test entry & test entry & test entry \\
test entry & test entry & test entry & test entry \\
test entry & test entry & test entry & test entry \\
\hline
\end{tabular}
}
\end{document}
Best Answer
I think you have two good choices and a (likely) dreadful choice:
Use a
tabular*
environment,Use a
tabularx
environment (or its close cousin,tabulary
)Use the basic
tabular
environment and scale it up (or down) using\resizebox
.The results are as follows (the first horizontal line is there just to illustrate the width of the text block; the bodies of the four tables are identical, i.e., they differ "only" in their layouts):
Can you tell why I consider the method that uses
\resizebox
to be nothing short of dreadful?