1

It's the first time I work with latex and I have a problem with tables. I create the table below

\begin{table}[htp]
\begin{center}
\begin{tabular}{lp{1in}p{1in}}
\toprule
URI&\multicolumn{2}{l}{/RBP/config/startpresenceverification}\\ \midrule
HTTP method&\multicolumn{2}{l}{POST}\\ \midrule
Parameters&presenceverurl&String\\ \cline{2-3}
&presencevermode&String\\ \cline{2-3}
&presencevermessage&String\\ \cline{2-3}
&maxsuspicions&int\\ \cline{2-3}
&suspicionsinterval&long\\ \cline{2-3}
&exemptiontime&long\\ \midrule 
\end{tabular}
\caption{test}
\label{table:test}
\end{center}
\end{table}

Except the first and the fourth parameter, I got four warnings for the other lines:

\overfull hbox ... in paragraph ...

And this is how the table looks like when I compile the file enter image description here

Any idea on how to fix this ?

  • 1
    You defined a tabular with 3 columns (\begin{tabular}{lp{1in}p{1in}}), the first one is left aligned and the two others are 1in large paragraphs. 1in is not large enough to contain all your text. Moreover, your text is only one word, that's why the paragraph is only written on one line. You should try \begin{tabular}{llp{1in}} or \begin{tabular}{lp{3in}p{1in}}. – Jérôme Dequeker Jan 13 '17 at 17:46
1

The second and third column are to small, to fit long words like "presenceverur" into them.

Is there a need for you, to define the width of the columns yourself? It would be easier, if you let LaTeX do the job for you. So you could write

\begin{tabular}{@{} lll @{}}

Note, that the @{} suppress the white space on the left and right side of the table.

I'd also suggest, that leave the \clines away. If you insist on them, you should be consistent to the booktabs-package and use \cmidrule instead. It will not only have the same width, as the \midrule. It will also add some gap between the line and the cell contents. But I think, your table does not need those lines at all ...

Code

\documentclass[11pt,a4paper,draft]{report}
\usepackage{booktabs}

\begin{document}
\begin{table}[htp]
  \centering%
    \begin{tabular}{@{} lll @{}}
      \toprule
      URI
      &\multicolumn{2}{l@{}}{/RBP/config/startpresenceverification}\\ 
      \midrule
      HTTP method & \multicolumn{2}{l@{}}{POST}\\ 
      \midrule
      Parameters & presenceverurl & String\\
      & presencevermode & String\\
      & presencevermessage & String\\
      & maxsuspicions & int\\ 
      & suspicionsinterval & long\\
      & exemptiontime & long\\
      \midrule 
    \end{tabular}
    \caption{test}
    \label{table:test}
\end{table}
\end{document}

Result

enter image description here

  • 2
    You (and the OP) should use \centering, rather than the center environment. – egreg Jan 13 '17 at 21:01

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.