# Problem with tables and underful \hbox

I'm struggling to sort out some errors with the following table. I'd love some advice please? I keep getting errors like \underful hbox .

\documentclass[a4paper]{article}
\usepackage{array,pdflscape}

\begin{document}
\begin{landscape}
\begin{table}
\begin{tabular}{ | p{3.6cm} | p{3cm} | p{2.2cm} | p{3cm} | p{3.3cm} | p{4.8cm} |}

\hline

\textbf{API Service (coverage)} & \textbf{Available transport modes} & \textbf{Usage limits} & \textbf{Documentation} & \textbf{Simplicity of use} & \textbf{Customisation and notes} \\ \hline

Google Directions API (Worldwide) & Car, pedestrian, cycling, public transport & 750 per day (without license) & Provided, with many examples & Very simple to use & Limited. Parameters such as use of tolls, language of content, shortest or quickest. Public transport modes cannot be distinguished \\ \hline

OpenRouteService (Worldwide, but dependant on OSM data quality) & Car, pedestrian, cycling & Unlimited & In the form of a Wikipedia entry. Covers some examples but is not comprehensive. & Very simple & Limited. Road types, languages, zoom levels \\ \hline

Project OSRM (Open Source Routing Machine) (Worldwide, but dependant on OSM data quality) & Car & Unlimited & Basic instructions provided on GitHub & Very simple to use & Limited. Zoom level and output file type \\ \hline

Transport for London (Greater London) & Underground, overground, bus, train, tram, boat, cable---car, Docklands Light Railway & Unlimited (once registered) & Extremely comprehensive manual, but unclear in many places and often seemingly contradictory & Very difficult. Only simple examples are provided. So many parameters must be considered for a properly formed request & Fully customisable in almost every way. However it is limited to Greater London and does not alert when routes go outside. \\ \hline

MapQuest (Worldwide) & Car & Unlimited & Basic instructions provided on GitHub & Very simple to use & Limited. Zoom level and output file type \\ \hline

\end{tabular}
\caption{Summary of suitable routing APIs}
\label{tab:api_summary_table}
\end{table}
\end{landscape}

\end{document}

• Welcome to tex.sx, It always helps if your examples are complete (small) documents that people can run to see the problem – David Carlisle Oct 23 '14 at 16:19
• underfull box is not an error it is just a warning that tex was struggling to break the lines correctly and had to stretch some white space. The amount of stretching depends on the page size, fonts etc (that you have not shown here) but justified line breaking in 2.2cm columns is always going to be tricky, perhaps you would be OK with \raggedright text? – David Carlisle Oct 23 '14 at 16:21

I shrank the column widths a bit, added a bit of space to keep text away from rules, allowed the table to bleed into the margin a bit, and used a ragged setting, TeX doesn't complain about this:

\documentclass[a4paper]{article}

\usepackage{array,pdflscape}
\newcolumntype{R}{>{\raggedright\arraybackslash}p}
\setlength\extrarowheight{2pt}
\begin{document}
\begin{landscape}
\begin{table}
\hspace*{-.1cm}%
\begin{tabular}{@{}| R{3.5cm} | R{3cm} | R{2.2cm} | R{3cm} | R{3.3cm} | R{4.5cm} |@{}}

\hline

\textbf{API Service (coverage)} & \textbf{Available transport modes} & \textbf{Usage limits} & \textbf{Documentation} & \textbf{Simplicity of use} & \textbf{Customisation and notes} \\ \hline

Google Directions API (Worldwide) & Car, pedestrian, cycling, public transport & 750 per day (without license) & Provided, with many examples & Very simple to use & Limited. Parameters such as use of tolls, language of content, shortest or quickest. Public transport modes cannot be distinguished \\ \hline

OpenRouteService (Worldwide, but dependant on OSM data quality) & Car, pedestrian, cycling & Unlimited & In the form of a Wikipedia entry. Covers some examples but is not comprehensive. & Very simple & Limited. Road types, languages, zoom levels \\ \hline

Project OSRM (Open Source Routing Machine) (Worldwide, but dependant on OSM data quality) & Car & Unlimited & Basic instructions provided on GitHub & Very simple to use & Limited. Zoom level and output file type \\ \hline

Transport for London (Greater London) & Underground, overground, bus, train, tram, boat, cable---car, Docklands Light Railway & Unlimited (once registered) & Extremely comprehensive manual, but unclear in many places and often seemingly contradictory & Very difficult. Only simple examples are provided. So many parameters must be considered for a properly formed request & Fully customisable in almost every way. However it is limited to Greater London and does not alert when routes go outside. \\ \hline

MapQuest (Worldwide) & Car & Unlimited & Basic instructions provided on GitHub & Very simple to use & Limited. Zoom level and output file type \\ \hline

\end{tabular}\hspace*{-2cm}%%stop complaining
\caption{Summary of suitable routing APIs}
\label{tab:api_summary_table}
\vspace{-1cm}%%stop complaining
\end{table}
\end{landscape}

\end{document}

• Thanks David. I'm still getting used to using Latex properly. The above example you provide - it won't mess-up the tables elsewhere in my document will it? (I'll give it a go I guess) – james Oct 23 '14 at 16:41
• \setlength\extrarowheight{2pt} adds 2pt padding above each row, as written it will apply to the whole document but you can move it to inside the table just before the tabular if you only want it for one environment (almost all latex settings are local to the current environment) but most tables with horizontal rules look better with the padding. – David Carlisle Oct 23 '14 at 16:43
• Should I move both these things to inside the tabuler code? \newcolumntype{R}{>{\raggedright\arraybackslash}p} \setlength\extrarowheight{2pt} – james Oct 23 '14 at 16:45
• @james they need to be before the tabular, the definition of R may as well be global, has no effect unless you use R instead of p in a table, the setting of \extrarowheight can be local or global depending, as I say tables often look better with it (you can take it out of this, it will just make the table look a bit cramped, it's unrelated to the warnings you had) – David Carlisle Oct 23 '14 at 16:47
• Gotcha I think. Cheers. Slight problem I've got is that because of the margins on my page, the table is now going just off the bottom of the page by a cm or so. I'll just play around with the column widths until it comes back on yes? – james Oct 23 '14 at 16:48