0

On the question How to write a table, a little larger than the paragraphs, with centered columns and no warnings? I learned to align my documented centered. Now, I added ltablex to my document guided by the question How to auto adjust my last table column width, and why is there Underfull \vbox badness on this table?

However, if I build my document without the ltablex package, it outputs correctly without any warnings/badboxes/badness:

enter image description here

But if I add ltablex, I got 4 badboxes warnings and everything out of place:

test2.tex:65: Overfull \hbox (43.05408pt too wide) in alignment at lines 65--65 [] [] [] [] [] [] [] [] [] [] [] [] 
test2.tex: Underfull \vbox (badness 10000) detected at line 65
test2.tex:164: Overfull \hbox (44.00002pt too wide) in alignment at lines 164--164 [] [] [] [] [] [] 
test2.tex: Underfull \vbox (badness 10000) detected at line 164

enter image description here

This is the of my code which the ltablex do bad things and unalign tables. If you comment out the ltablex package it gets fixed.

Can I use the ltablex package accordingly to the question How to auto adjust my last table column width, and why is there Underfull \vbox badness on this table? without allowing it to break my other tables from the question How to write a table, a little larger than the paragraphs, with centered columns and no warnings?

\documentclass[12pt]{article}
\usepackage[a4paper, margin=2cm, showframe]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{mathptmx}
\usepackage{xspace}
\usepackage{microtype}
\usepackage{indentfirst}
\usepackage{lettrine}
\usepackage{graphicx}
\usepackage{float}

\usepackage{ragged2e}
\usepackage{array, multirow, tabularx}
\usepackage[strict]{changepage}% <-- added

\usepackage{hyperref}

\newcolumntype{B}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]
{%
    \gdef\currentrowstyle{#1}#1\ignorespaces
}

% Comment/uncomment this `ltablex`
\usepackage{ltablex}


\begin{document}

\section{Cronograma}

    \begin{adjustwidth}{-0.5\marginparwidth}{-0.5\marginparwidth}
    \small
    \begin{tabularx}{\linewidth}{|BX|*{11}{^c|}}

        \hline
        \multicolumn{1}{|c|}{\multirow{2}{*}{{\bfseries Etapas}}} & \multicolumn{11}{|c|}{{\bfseries Meses}} \\
        \cline{2-12}

        \rowstyle{\bfseries}
        & ago & set & out & dez & jan & fev & mar & abr & mai & jun & jul   \\ \hline

        Escrita da revisão bibliográfica
        &  x  &  x  &     &     &     &     &     &     &     &     &     \\ \hline

        Classificar todas classes e tipos de formatações
        &     &  x  &  x  &     &     &     &     &     &     &     &     \\ \hline

        Implementação de um núcleo funcional
        &     &     &  x  &  x  &     &     &     &     &     &     &     \\ \hline

        Finalização da escrita do TCC
        &     &     &     &  x  &  x  &     &     &     &     &     &     \\ \hline

        Ajustes finais no texto do TCC
        &     &     &     &     &  x  &  x  &  x  &  x  &     &     &     \\ \hline

        Defesa do TCC
        &     &     &     &     &     &     &     &     &  x  &  x  &  x  \\ \hline

    \end{tabularx}
    \end{adjustwidth}

    \hfill


\section{Custos}

    % How to align a vertical line at the end of the multicolumn in a table?
    % https://tex.stackexchange.com/questions/367075/how-to-align-a-vertical-line-at-the-end-of-the-multicolumn-in-a-table
    \begin{tabular}
    {|
        *1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }Bp{3.9cm}|} % Item
        *1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }^p{2.0cm}|} % Quantidade
        *1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }^p{3.2cm}|} % Valor, Valor
        *1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }^p{2.8cm}|} % Valor, Valor
    }

        \hline
        \rowstyle{\bfseries}
        Item                    &   Quantidade  &   Valor Unitário (R\$)    &   Valor Total (R\$) \\ \hline
        CD                      &   1           &   5,00                    &   5,00              \\ \hline
        Impressão               &   800         &   0,15                    &   120,00            \\ \hline
        Reserva Gerencial       &   1           &   20,00                   &   20,00             \\ \hline
        Reserva de Contingência &   1           &   20,00                   &   20,00             \\ \hline
        Total                   & \multicolumn{2}{c|@{\hspace{3.0pt}}}{}    &   165,00            \\ \hline

    \end{tabular}

    \medskip
    \hfill


\section{Comunicação}

    \begin{tabular}{|Bl|^l|^l|^l|}

        \hline
        \rowstyle{\bfseries}
        O quê  & De quem & Para Quem & Como                                        \\ \hline
        Proposta de TCC         & Autor     & bla bla           & Site de projetos \\ \hline
        Relatório de TCC I      & Autor     & bla bla           & Site de projetos \\ \hline
        Prévia do TCC, em TCC I & Autor     & Banca             & E-mail           \\ \hline
        Defesa do TCC           & Autor     & Banca             & Pessoalmente     \\ \hline
        Reunião de Orientação   & Orientadores  & Autor         & Pessoalmente     \\ \hline

    \end{tabular}

    \medskip
    \hfill


\section{Riscos}

    % https://tex.stackexchange.com/questions/366156/how-to-change-the-left-padding-for-one-latex-tables-cell
    % https://tex.stackexchange.com/questions/366155/how-to-write-a-table-a-little-larger-than-the-paragraphs-with-centered-columns
    %
    \begin{adjustwidth}{-0.5\marginparwidth}{-0.5\marginparwidth}
    \small
    \begin{tabularx}{\linewidth}
    {|
        *1{                 >{\RaggedRight\arraybackslash\hsize=1.1\hsize }BX        |} % Riscos
        *3{@{\hspace{3.0pt}}>{\Centering\arraybackslash                   }^p{0.95cm}|} % Probabilidade, Impacto, Prioridade
        *2{                 >{\RaggedRight\arraybackslash\hsize=0.95\hsize}^X        |} % Resposta, Prevenção
    }

    \hline

    \rowstyle{\bfseries}
    Riscos  & a & b & c & Estratégia de resposta & Ações de prevenção \\ \hline

    % Row 1
    % Riscos
    Problemas com perda de dados &
    % Probabilidade
    Baixa &
    % Impacto
    Alto &
    % Prioridade
    Alta &
    % Estratégia de resposta
    Uso do backup &
    % Ações de prevenção
    Backup periódicos \\ \hline

    % Row 2
    % Riscos
    Alteração do cronograma ou descontinuidade do projeto onde recebo uma bolsa &
    % Probabilidade
    Média &
    % Impacto
    Alto &
    % Prioridade
    Alta &
    % Estratégia de resposta
    Redefinição da data de entrega do trabalho &
    % Ações de prevenção
    Monitoramento contínuo das informações obtidas com superiores imediatos \\ \hline

    \end{tabularx}

    \hfill {\small {\bfseries a}: Probabilidade, {\bfseries b}: Impacto, {\bfseries c}: Prioridade}

    \end{adjustwidth}

    \vspace*{-4mm}
    \hfill

\end{document}
2

warning is not critical, they just inform you that natural widths of columns in tables (in the first and in the last) are wider than available spaces for them. for reducing theirs number try to reduce \tabcolsep size

i didn't found any connection between warnings and ltablex (which is not used in your document example). however, using ltablex and preserve features X column tables, you need to add \keepXColumns to preamble or before tables.

with small changes of your MWE for the first table i obtain the following results:

enter image description here

\documentclass[12pt]{article}
\usepackage[a4paper, margin=2cm, showframe]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{cfr-lm}
\usepackage{microtype}

\usepackage{array, makecell, multirow,
            ltablex}            % <--- doesn't change anything, 
                                % however for keep X column features
                                % you should add (before table) \keepXColumns 
\newcolumntype{B}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
                          #1\ignorespaces}
\newcolumntype{C}{>{\centering\arraybackslash}X}   % <-- new
\usepackage{siunitx}

\begin{document}
\section{Cronograma}
    \begin{center}                      % <--- adjustwidth is not necesary
    \small
    \setlength\tabcolsep{3pt}           % <--- added
    \renewcommand\arraystretch{1.3}     % <--- added
    \keepXColumns                       % <--- added
\begin{tabularx}{\linewidth}{| Bl *{11}{|@{} ^C @{}} |}
    \hline
    &   \multicolumn{11}{c|}{\textbf{Meses}}                            \\
    \cline{2-12}
\rowstyle{\bfseries\footnotesize}       % <--- changed
\multirow{-2}{*}{\hspace{20ex} Etapas}  % <--- moved here
    & ago & set & out & dez & jan & fev & mar & abr & mai & jun & jul   \\
    \hline
Escrita da revisão bibliográfica
    &  x  &  x  &     &     &     &     &     &     &     &     &       \\ \hline
Classificar todas classes e tipos de formatações
    &     &  x  &  x  &     &     &     &     &     &     &     &       \\ \hline
Implementação de um núcleo funcional
    &     &     &  x  &  x  &     &     &     &     &     &     &       \\ \hline
Finalização da escrita do TCC
    &     &     &     &  x  &  x  &     &     &     &     &     &       \\ \hline
Ajustes finais no texto do TCC
    &     &     &     &     &  x  &  x  &  x  &  x  &     &     &       \\ \hline
Defesa do TCC
    &     &     &     &     &     &     &     &     &  x  &  x  &  x    \\ \hline
\end{tabularx}
    \end{center}
\end{document}

compiling above code i obtain only one "Bad Boxes" which is related to underfull \vbox (badness10000) detected at line 52

off-topic:

used code can be simplified and table looks improved if you for showed tables instead of tabularx use tabu table environment (regardless that tabu is not maintained anymore and is buggy; in showed tables it will work without any problem) and siunitx for columns with decimal numbers. with them your code can be as follows:

\documentclass[12pt]{article}
\usepackage[a4paper, margin=2cm, showframe]{geometry}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{microtype}

\usepackage{array, multirow, tabularx}
\usepackage{ltablex}            % <--- doesn't change anything
\usepackage{tabu}               % <--- new
\usepackage{siunitx}

\begin{document}

\section{Cronograma}

    \begin{center}
    \small
    \setlength\tabcolsep{1.5pt}
    \tabulinesep =_3pt^3pt
\begin{tabu} to \linewidth {| l *{11}{| X[1,c]} |}
    \hline
    &   \multicolumn{11}{c|}{\textbf{Meses}}                            \\
    \cline{2-12}
\rowfont[c]{\bfseries\footnotesize}
\multirow{-2}{*}{\textbf{Etapas}}
    & ago & set & out & dez & jan & fev & mar & abr & mai & jun & jul   \\
    \hline
Escrita da revisão bibliográfica
    &  x  &  x  &     &     &     &     &     &     &     &     &       \\ \hline
Classificar todas classes e tipos de formatações
    &     &  x  &  x  &     &     &     &     &     &     &     &       \\ \hline
Implementação de um núcleo funcional
    &     &     &  x  &  x  &     &     &     &     &     &     &       \\ \hline
Finalização da escrita do TCC
    &     &     &     &  x  &  x  &     &     &     &     &     &       \\ \hline
Ajustes finais no texto do TCC
    &     &     &     &     &  x  &  x  &  x  &  x  &     &     &       \\ \hline
Defesa do TCC
    &     &     &     &     &     &     &     &     &  x  &  x  &  x    \\ \hline
\end{tabu}
    \end{center}

\section{Custos}

    \begin{center}
\newcolumntype Y{S [output-decimal-marker={,},
                    table-format=4.4] }
\tabucolumn Y
\tabulinesep =_3pt^3pt
\begin{tabu} {|l |*3{Y|} }
    \hline
\rowfont\bfseries
\multicolumn{1}{|c|}{Item}
            &   {Quantidade}    &   {Valor Unitário (R\$)}  &   {Valor Total (R\$)} \\
    \hline
CD          &   1               &   5,00                    &   5,00                \\ \hline
Impressão   &   800             &   0,15                    &   120,00              \\ \hline
Reserva Gerencial
            &   1               &   20,00                   &   20,00               \\ \hline
Reserva de Contingência
            &   1               &   20,00                   &   20,00               \\ \hline
Total       &   \multicolumn{2}{c|}{}                       &   165,00              \\ \hline
\end{tabu}
    \end{center}

\section{Comunicação}

    \begin{center}
    \tabulinesep =_3pt^3pt
\begin{tabu} {*{4}{| l}|}
    \hline
\rowfont[c]{\bfseries}
O quê                   & De quem       & Para Quem & Como              \\ \hline
Proposta de TCC         & Autor         & bla bla   & Site de projetos  \\ \hline
Relatório de TCC I      & Autor         & bla bla   & Site de projetos  \\ \hline
Prévia do TCC, em TCC I & Autor         & Banca     & E-mail            \\ \hline
Defesa do TCC           & Autor         & Banca     & Pessoalmente      \\ \hline
Reunião de Orientação   & Orientadores  & Autor     & Pessoalmente      \\ \hline
\end{tabu}
    \end{center}

\section{Riscos}

    \begin{center}
    \small
    \setlength\tabcolsep{3pt}
    \tabulinesep =_3pt^3pt
\begin{tabu} to \linewidth{| X[1,l] *{3}{| l} *{2}{| X[1,l]} |}
    \hline
\rowfont[c]{\bfseries}
Riscos  & a     & b     & c     & Estratégia de resposta
                                        & Ações de prevenção \\ \hline
Problemas com perda de dados
        & Baixa & Alto & Alta   & Uso do backup
                                        & Backup periódicos \\ \hline
Alteração do cronograma ou descontinuidade do projeto onde recebo uma bolsa
        & Média & Alto & Alta   & Redefinição da data de entrega do trabalho
                                        & Monitoramento contínuo das informações obtidas com superiores imediatos \\ \hline
\multicolumn{6}{r}{\textbf{a}: Probabilidade, \textbf{b}: Impacto, \textbf{c}: Prioridade}
\end{tabu}
    \end{center}
\end{document}

and tables looks as follows:

enter image description here

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.