1

I want to use longtable (because the table contains more than one page), but I got so many error:

Underfull \hbox (badness 2005) in paragraph at lines 22--23
\TU/lmr/m/n/10 menampilkan nilai \TU/lmr/m/it/10 vari-

Overfull \hbox (56.43303pt too wide) in alignment at lines 8--27
 [] [] [] [] [] 

I have made my table smaller but nothing works. I also tried to add @{} but no luck. I tried this solution. The black overfull bar is gone, but the error still exists. Is this because latex need to force my table content to breakline ? Is this OK to have all those warning ?

This is my MWE

\documentclass{report}

\usepackage{longtable} % add table
\overfullrule=2cm % show overfull

\begin{document}

\begin{longtable}[c]{|p{1cm}|p{4cm}|p{4cm}|p{2cm}|p{1cm}|}
  \hline
  \textbf{No.\newline Jalur} & \textbf{Prosedur Uji} &
                                                    \textbf{\emph{Expected Result}}
  & \textbf{\emph{Result}} & \textbf{Status} \\\hline
  %
  1 & Menjalankan \emph{ssh\_out\_stream} dengan \emph{exit\_status\_ready()} bernilai
      \emph{true} & \emph{ssh\_out\_stream} akan berhenti berjalan & \emph{As expected} & Valid \\\hline
      %
  2 & Menjalankan \emph{ssh\_out\_stream} dengan \emph{variable} \emph{length} bernilai
      lebih kecil dari 0 & \emph{ssh\_out\_stream} tidak akan menampilkan nilai \emph{variable} \emph{length}
  & \emph{As expected} & Valid \\\hline
  %
  3 & Menjalankan \emph{ssh\_out\_stream} dengan \emph{variable} \emph{length} bernilai
      lebih besar dari 0 & \emph{ssh\_out\_stream} akan menampilkan nilai \emph{variable} \emph{length}
  & \emph{As expected} & Valid \\\hline
  %
  \caption{Pengujian \emph{unit} \emph{ssh\_out\_stream}}
  \label{jalur:ssh_out_stream}
\end{longtable}

\end{document}

enter image description here

Thank you in advance

0
  • your table is much wider than text area,
  • you can increase text width by use of the package geometry or define narrower second and third column (later is not recommended)
  • width of the first and the last column is to small, better is used natural width of column (see mwe below)
  • width of the second column is to small for nice fitting oc cell column into its cells
  • with use of the ragged2e package you can better align text in cells.
  • for column headers i suggest to use \thead macro from the makecell package
  • more vertical space around cells contents you can obtain with the macro \makegappedcells also from the package \makecell

off-topic

  • table caption, special at longtable should be on the top of table

    \documentclass{report}
    \usepackage{geometry}   % new
    
    \usepackage{ragged2e}
    \usepackage{longtable,
                makecell}   % new
    \newcolumntype{L}[1]{>{\RaggedRight}p{#1}}  % new
    \renewcommand\theadfont{\small\bfseries}    % new
    \setcellgapes{3pt}                          % new
    \overfullrule=2cm % show overfull
    
    %-------------------------------------- only for show page layout
    \usepackage{showframe}
    \renewcommand\ShowFrameLinethickness{0.25pt}
    \renewcommand*\ShowFrameColor{\color{red}}
    %---------------------------------------------------------------%
    
    \begin{document}
    
    {\makegapedcells    % new
     \begin{longtable}{|c|L{5cm}|L{4cm}|>{\itshape}L{2cm}|c|}   % changed
    \caption{Pengujian \emph{unit} \emph{ssh\_out\_stream}}
        \label{jalur:ssh_out_stream}                \\
        \hline
    \thead{No.\\ Jalur}
        &   \thead{Prosedur\\ Uji}
                &   \itshape\thead{Expected\\ Result}
                    &   \thead{Result}
                        &   \thead{Status}          \\
        \hline
      %
    1   &   Menjalankan \emph{ssh\_out\_stream} dengan \emph{exit\_status\_ready()} bernilai \emph{true}
            &   \emph{ssh\_out\_stream} akan berhenti berjalan
                &   As expected         & Valid \\
        \hline
    2   & Menjalankan \emph{ssh\_out\_stream} dengan \emph{variable} \emph{length} bernilai lebih kecil dari 0
            &   \emph{ssh\_out\_stream} tidak akan menampilkan nilai \emph{variable} \emph{length}
                &   As expected         & Valid      \\
        \hline
    3   & Menjalankan \emph{ssh\_out\_stream} dengan \emph{variable} \emph{length} bernilai lebih besar dari 0
            &   \emph{ssh\_out\_stream} akan menampilkan nilai \emph{variable} \emph{length}
                &   As expected         & Valid      \\
    \end{longtable}
    }
    

enter image description here

(red lines indicate text borders)

  • I still get this warning. Is it OK ? – azzamsa Oct 22 '18 at 3:32
  • see edit. no warnings, no bad boxes. anyway, warning are not errors and not harm of your table design ... – Zarko Oct 22 '18 at 3:37
  • Wow, awesome thank you. Sorry, I want to ask. I think warning comes from long word that need to break in narrow column, then latex break that word for me with a warning. Is it okay to have document with many warning like this (just because long words) ?. It doesn't do harm, But I am afraid this will contribute to other error like longtable overriding page number or etc ? are we have to take those warning seriously or just can we just leave it ? Any way thanks lot for this solution – azzamsa Oct 22 '18 at 3:48
  • @azzamsa, you need load babel with your language in your document preamble. it will help to hyphenate long words. the package ragged2e enable this on the smart way. full or overfull will not cause that longtable will overriding text area. – Zarko Oct 22 '18 at 4:03

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.