表格和 \hbox 不足的问题

表格和 \hbox 不足的问题

我正在努力解决下表中的一些错误。我很想得到一些建议?我一直收到类似 \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}

答案1

我稍微缩小了列宽,添加了一些空间以使文本远离规则,允许表格稍微渗入边距,并使用了不规则设置,TeX 对此没有任何抱怨:

\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}

相关内容