This is more extended comment than answer. It is based on guessing, since you are not willing to provide more data, that someone can help you. This means, that the answer probably will not help you.
Use adjustobox
for stretching table to text width is not right way to do this. It stretch all in it, from table to font size in it. When you lie to have table spanning whole text width, you need first to ask yourself, what is benefits to stretch table over it natural width? Table will look more empty (more white space between columns). Is this what you like to achieve?
From your comments follows, that your table float actually contain two tables. Cant this tables are separated by empty space? If not, than one of among many possible solutions is:
\begin{table}[htb]
\begin{tabularx}{.7\textwidth}{XXX}% table structure is not known
AAA & BBBB & CCCC \\
\end{tabularx}%no space between tables
\begin{tabularx}{.3\textwidth}{XX}% table structure is not known
DDDD & EEEE \\
\end{tabularx}
\end{table}
In this case the tables will stick each to other, font will not be changed and cells content will be adjusted. Iy like to mimic c
, l
or `rĖtipe of columns you need to define new columns type. For example:
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
For use of tabularx
you need to put in preamble \usepackage{tabularx}
.
In case that some white space between tables is desired, than replace %
with hfill
, which will move tables to the left and right text border.
Disclamer: since I never use R Sweave I do not know, how to described possible solution manage in it. Consequently I'm not able to offer further help in solving of your problem.
You can use tabularx
to produce a fit-to-width type table.
\documentclass{article}
\usepackage{tabularx}
\usepackage[nopar]{lipsum}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{ @{} p{2em} X @{} }
xy & Some text, some more text \\
yz & Some other text, some more text \\
& \hspace{\dimexpr-2em-2\tabcolsep}this is longer \quad Some other text, \lipsum[2] \\
zz & Some further text, some more text
\end{tabularx}
\end{document}
Instead of using \multicolumn
with a \hangindent
, just move the first line over to the left with a negative space on the first line. The column gaps on the other edges have been removed using a @{}
column specifier.
A tabular
-like construction will not break across the page boundary mid-paragraph (or row). If this is a concern, you can use a list like a description
. enumitem
provides some easy functionality for this using the style=sameline
:
\documentclass{article}
\usepackage{enumitem}
\usepackage[nopar]{lipsum}
\begin{document}
\begin{description}[font=\normalfont, leftmargin=2.5em, style=sameline, noitemsep]
\item[xy] Some text, some more text
\item[yz] Some other text, some more text
\item[this is longer\quad] Some other text, \lipsum[2]
\item[zz] Some further text, some more text
\end{description}
\end{document}
I've emphasized the gap between the item and the subsequent text by inserting a \quad
.
Best Answer
your table is wider than page width. consequently your attempt to fit it in column width with
\resizebox
also reduce font size ... only reasonable solution is redesign table such, that the text in cells is broken onto more linens and for table use font size\small
for better fitting text in cells:in above mwe is for table environment used
tabularx
for which you had prescribed table width. for columns is defined new column typeL
by help of macro\RaggedRight
fromragged2e
package. with this the multi line text formatting in cells is better than with centering (according to my taste). columns width ratio is also changed. if you like to have in table the same font size as it is in text, just remove\small
., but hen the table be less nice (again to my taste).