2

Currently the table is throwing this warning, but I have no idea from where it is coming from:

\documentclass[
10pt,
a5paper,
twoside
]{memoir}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{ragged2e}
\usepackage{longtable}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}

\begin{document}
\frenchspacing

\begin{longtable}[!ht]{ | >{\RaggedRight}p{3cm} | p{5.5cm} | }

    \hline
    Tamanho da fonte & 10,5 para o texto incluindo os títulos das seções e subseções.
                       As citações com mais de três linhas as legendas das ilustrações
                       e tabelas, fonte 9,5. \\ \hline

    \caption{Formatação do texto}
    \label{tab:table}

\end{longtable}

\end{document}

enter image description here

test2.tex: Underfull \vbox (badness 10000) detected at line 95

The line 95 is \end{longtable}. Also I tried to remove the p{5.5cm} so the table last column width is automatically determined, but not the first column which must be p{3cm}. But if I do only | >{\RaggedRight}p{3cm} | p | it throws the error:

test2.tex:88: Missing number, treated as zero. [Tamanho da fonte& 1]
test2.tex:88: Illegal unit of measure (pt inserted). [Tamanho da fonte& 1]

Related

  1. Autofit a table to the column width
  2. Automatically adjusting the size table cells
  3. Tabular with p type columns to fill page width
  4. p,m and b columns in tables
  5. https://en.wikibooks.org/wiki/LaTeX/Tables
1
  • 1
    unrelated to the warning but [!ht] is incorrect input to longtable, the only allowed options are [l], [c] or [r] Commented Aug 19, 2017 at 19:18

1 Answer 1

3

I suppose you want your table to be exactly full text width. You can do that with the ltablex package, which brings the longtable functionalities (and syntax) of longtable to tabularx.

I took the liberty to place the caption above the table: if table captions are usually placed above tables, it is to spare readers from having to skim through pages to find what it's all about. Furthermore, in long tables (which are not floats, by the way, so the option [!ht] is meaningless), the caption is called from within the table, in the first head code.

\documentclass[
10pt,
a5paper,
twoside
]{memoir}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{ragged2e}
\usepackage{ltablex}
\keepXColumns
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}

\begin{document}
\frenchspacing
\setlength\extrarowheight{2pt}
\begin{tabularx}{\linewidth}{|>{\RaggedRight}p{3cm}|>{\arraybackslash}X|}
    \caption{Formatação do texto}
    \label{tab:table} \\
    \hline
\endfirsthead
\multicolumn{2}{c}{\tablename~\thetable}: Formatação do texto (continued)\\
\hline
\endhead
\hline
\multicolumn{2}{r}{\footnotesize to be continued}
\endfoot
\hline
\endlastfoot
    Tamanho da fonte & 10,5 para o texto incluindo os títulos das seções e subseções.
                       As citações com mais de três linhas as legendas das ilustrações
                       e tabelas, fonte 9,5.
\end{tabularx}

\end{document} 

enter image description here

5
  • Thanks! You are right with table full text width. Also, there is not warning with your version.
    – user
    Commented Aug 19, 2017 at 19:04
  • I checked before posting! I think the reason for the warning was your placing the caption as in ordinary tables. Long table requires a special syntax.
    – Bernard
    Commented Aug 19, 2017 at 19:26
  • Why using the \setlength\extrarowheight{2pt} option or \keepXColumns on the global?
    – user
    Commented Aug 22, 2017 at 21:44
  • 1
    Because the default vertical spacing is much too tight. \keepXColumns is here because most people want X columns to have their calculated width, as far as I know. In yhe present case, it doesn't change whatever to the layout.
    – Bernard
    Commented Aug 22, 2017 at 21:55
  • Big thanks! This table is pretty awesome! Today I spent several hours trying different longtables implementations but the only one which worked very well with no warnings/badboxes at all was yours!
    – user
    Commented Aug 23, 2017 at 0:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .