3

I have large tables and they tend to no fit within the page so i used {adjustbox}{width=1.0\textwidth} but this make the font extreemly small.

Is there a way that i can fit the table without changining the font size?

\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}
| improve this question | | | | |
  • 1
    Welcome to TeX.SX! Are you aware of the p column type? – egreg May 19 '15 at 21:14
  • I just started using Latex few days agog so not really but will look it up. – Alswied May 19 '15 at 22:41
2

I suggest you use a tabularx environment and the X column type (both provided by the tabularx package) for the first and fourth columns.

The tabularx environment takes as one of its arguments the desired width of the environment; I would choose \textwidth, i.e., let the table occupy the full width of the textblock. The X column type (and the derived type L used in the example below) allow for automatic line breaks, while relieving the writer (you!) of the chore of having to compute the exact column widths.

enter image description here

\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}
| improve this answer | | | | |
  • One problem here. If the table is too long it goes out of the lower border of the page. Is there a way to make it continue to the next page? – Alswied May 19 '15 at 22:38
  • @Alswied - You may have to switch from a table/tabularx combined environment to a longtable environment. Please search this site for any number of postings on how to set up and use longtable environments, as well as postings that discuss how to combine tabularx and longtable environments. If there's a specific issue with your table that's not addressed in these postings, feel free to post a new query. – Mico May 19 '15 at 23:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.