不改变字体大小的情况下调整表格大小

不改变字体大小的情况下调整表格大小

我有很大的表格,它们往往不适合页面,所以我使用了它,{adjustbox}{width=1.0\textwidth}但这会使字体变得非常小。

有没有一种方法可以使表格适合而不改变字体大小?

\begin{center}
\begin{table}

\begin{adjustbox}{width=1.0\textwidth}

\begin{tabular}{|llll|}
\hline 
Item & Manufacturer & Catalogue number & Use/Purpose \\ 
\hline \hline 
DMEM Dulbecco's Modified Eagle Medium & Life Technologies  & 41965-039
 & Maintain cultured RBL-2H3 cells  \\ 
\hline 
Penicillin-streptomycin
 & Life Technologies  & 15140-122 & Supplement for cell culture medium \\ 
\hline 

\hline\end{tabular} 


\label{tab}
\end{adjustbox}
\caption{Table to test captions and labels}
\end{table}
\end{center}

答案1

我建议您使用tabularx环境和X列类型(均由表格型第一列和第四列分别命名为“包”。

环境tabularx将环境的所需宽度作为其参数之一;我会选择\textwidth,即让表格占据文本块的整个宽度。X列类型(以及下面示例中使用的派生类型L)允许自动换行,同时减轻了作者(您!)计算精确列宽的麻烦。

在此处输入图片描述

\documentclass{article}
\usepackage{adjustbox}
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}
%%%\begin{center}
\begin{table}[h!]

\begin{adjustbox}{width=1.0\textwidth}
\begin{tabular}{|llll|}
\hline 
Item & Manufacturer & Catalogue number & Use/Purpose \\ 
\hline \hline 
DMEM Dulbecco's Modified Eagle Medium & Life Technologies  & 41965-039
 & Maintain cultured RBL-2H3 cells  \\ 
\hline 
Penicillin-streptomycin
 & Life Technologies  & 15140-122 & Supplement for cell culture medium \\ 
\hline \hline
\end{tabular} 
\end{adjustbox}

\caption{before: tabular, ``l'' columns, adjustbox} \label{tab1}

\end{table}
%%%\end{center}

\begin{table}[h!]
\begin{tabularx}{\textwidth}{@{}LllL@{}}
\toprule
Item & Manufacturer & Catalogue  & Use/Purpose \\
& & Number & \\ 
\midrule 
DMEM Dulbecco's Modified Eagle Medium & Life Technologies  & 41965-039 & Maintain cultured RBL-2H3 cells  \\
\addlinespace 
Penicillin-streptomycin
 & Life Technologies  & 15140-122 & Supplement for cell culture medium \\ 
\bottomrule
\end{tabularx} 

\caption{after: tabularx, ``L'' columns, booktabs-based lines}\label{tab2}
\end{table}

\end{document}

相关内容