# table too wide and doesn't fit within textwidth [duplicate]

\begin{table}[htbp]
\centering
\small
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
Wavelength & Model & Package & Emmitter type & Manufacturer & Power (mW) & Iop (mA) & Ith (mA) & Vop (V)\\
\hline
405 & DL-7386-101HG & TO-56 & single & sanyo & 50-70 & 70 & 35 & 4.8\\
\hline
450 & PL 450 & TO-38 & single & osram & 50-90 & 120 & 30 & 5.5\\
\hline
638 & ML520G54 & TO-56 & single & mitsubishi & 90-100 & 150 & 50 & 2.7\\
\hline
655 &  DL-5147-242 & TO-56 & single & sanyo & 30-50 & 80 & 40 & 3.8\\
\hline
\end{tabular}
\caption{Laser specifications}
\label{tab:Laser_Specs}
\end{table}


The above is my code for creating a table and when compiled it gets beyond textwidth. How can I solve this issue without altering the font size ?

## marked as duplicate by Werner tables StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Jan 16 '18 at 1:35

• How about swapping columns and rows?? – user32792 Jun 25 '13 at 19:36
• A few ideas (besides splitting the table up or rotating it): cells with more than one line (possible the long headings) or tabularxX column. Removing the unnecessary vertical lines or reducing \tabcolsep, the space between columns, could also be a solution. Could you add a full minimal working example? – Qrrbrbirlbel Jun 25 '13 at 19:41
• I can but not the right way to present such data. – Rene Duchamp Jun 25 '13 at 20:23

Please always post complete documents as for example the text width is important here and that can not be seen in your fragment.

\documentclass[a4paper]{article}

\usepackage{array}
\setlength\extrarowheight{2pt}

\begin{document}

\begin{table}[htbp]
\centering
\small
\setlength\tabcolsep{2pt}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\hline
Wave- &        &           & Emmitter & Manu- & Power & Iop & Ith  & Vop \\[-3pt]% compensate for extrarowheight
length& Model &    Package & type &  facturer & (mW) & (mA) &  (mA) & (V)\\
\hline
405 & DL-7386-101HG & TO-56 & single & sanyo & 50--70 & 70 & 35 & 4.8\\
\hline
450 & PL 450 & TO-38 & single & osram & 50--90 & 120 & 30 & 5.5\\
\hline
638 & ML520G54 & TO-56 & single & mitsubishi & 90--100 & 150 & 50 & 2.7\\
\hline
655 &  DL-5147-242 & TO-56 & single & sanyo & 30--50 & 80 & 40 & 3.8\\
\hline
\end{tabular}
\caption{Laser specifications}
\label{tab:Laser_Specs}
\end{table}

\noindent X\dotfill X

\end{document}

• the column headers would look nicer as bottom-aligned, centered "paragraphs"; the space between the lines is so wide that it makes these headers hard to read. – barbara beeton Jun 25 '13 at 20:20
• @barbarabeeton yes I know. What you mean I suspect is not that that would look nicer, but rather that I should edit the answer to make it so... – David Carlisle Jun 25 '13 at 20:23
• indeed -- that is exactly what i mean. (would make the answer much more useful.) – barbara beeton Jun 25 '13 at 20:29
• @barbarabeeton your wish is... – David Carlisle Jun 25 '13 at 20:29