# Table Wider than text

I am trying to generate a normal table, but some columns have long lines and this made the table go outside the page margin. How can I adjust the table width

\documentclass[letterpaper,oneside,12pt]{book}

\begin{document}

\begin{table}[htb]
\centering
\vspace{0.5cm}
\caption{\small{Comparison between GPS and INS characteristics}}
\vspace{0.5cm}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|}\hline
& GPS                                     & INS                                      \\\hline\hline
& Errors are bounded                      & High data rate                           \\
Advantages    & Long term accuracy                      & Self-contained and independent of jamming\\\hline
& Low data rate                           &                                          \\
Disadvantages & Susceptible to jamming and interference & Errors grow with time                    \\
& Fails if no sufficient coverage         & Higher cost for higher quality           \\\hline \hline
\end{tabular}
\end{table}

\end{document}


If you allow multi lie cells than you can easily fit in text width with:

\documentclass[letterpaper,oneside,12pt]{book}
\usepackage{tabularx}
\begin{document}
\begin{table}[htb]
\centering
\vspace{0.5cm}
\caption{\small{Comparison between GPS and INS characteristics}}
\vspace{0.5cm}
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\hsize}{|l|X|X|}\hline
& GPS                   & INS                   \\\hline\hline
& Errors are bounded    & High data rate        \\
Advantages      & Long term accuracy    & Self-contained and independent of jamming
\\\hline
& Low data rate         &                       \\
Disadvantages   & Susceptible to jamming and interference
& Errors grow with time \\
& Fails if no sufficient coverage
& Higher cost for higher quality
\\\hline \hline
\end{tabularx}
\end{table}
\end{document}


But your table I will wrote differently: without vertical lines, horizontal lines with different thickness ... something like this:

\documentclass[letterpaper,oneside,12pt]{book}
\usepackage{tabularx,booktabs,makecell,multirow}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\begin{document}
\begin{table}[htb]
\centering
\caption{Comparison between GPS and INS characteristics}
\begin{tabularx}{\hsize}{@{}l
>{\setlength\hsize{0.9\hsize}}L
>{\setlength\hsize{1.1\hsize}}L@{}}
\toprule
\midrule
&   Errors are bounded\newline
Long term accuracy
&   High data rate\newline
Self-contained and independent of jamming   \\
\cmidrule{2-3}
&   Low data rate\newline
Susceptible to jamming and interference
&   Errors grow with time\newline
Fails if no sufficient coverage\newline
Higher cost for higher quality              \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}


and obtain:

For caption layout (now was not in my consideration} I will exploit posibilities of caption packages.

• Thanks Zarko, your first solution worked perfect. Also, I like your elegant way for the table, but it produced 20 errors with me knowing that I used the package \usepackage{tabularx} – Mohamed Elsheikh May 24 '15 at 16:46
• Huh, at copyng of code from my editor by accident I lost first four lines of code ... I correct this now. It should work without errors ... – Zarko May 24 '15 at 17:04
• I'm glad to help you. Since you accept my answer, is it worth to rise points for it? – Zarko May 24 '15 at 18:02
• Sure Zarko, but I haven't got this privileges yet as this is my first question and waiting for more reputation points! – Mohamed Elsheikh May 25 '15 at 3:41