[Tex/LaTex] How to disable the Overfull \hbox too wide warning for the table

badnesstables

It just seems impossible to disable it. I tried putting:

  1. On the question Overfull \hbox warning when using tabular says adding \hfuzz=0.64pt, I tried \hfuzz=50000pt and no success.

    \hfuzz=5000pt
    \begin{adjustwidth}{-0.5\marginparwidth}{-0.5\marginparwidth}
    ...
    
  2. With the question Is there really no better solution to "Overfull \hbox" than adding a line break?, I tried adding \sloppy, and no results.

    \sloppy
    \begin{adjustwidth}{-0.5\marginparwidth}{-0.5\marginparwidth}
    ..
    
  3. I also tried putting this below from the question How to disable / suppress bad box warnings within a longtable?, but also had no effect.

    \hbadness=\maxdimen
    \vbadness=\maxdimen
    \begin{adjustwidth}{-0.5\marginparwidth}{-0.5\marginparwidth}
    ...
    
  4. On the question What is a "Overfull \hbox (9.89561pt too wide)"?, I did not understood how to use the \the\fontdimen2\font and \the\fontdimen3\font to extend the limits.

This is the table:

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

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

\usepackage{newtxtext,newtxmath}
\usepackage{microtype,booktabs}

\usepackage{ragged2e}
\usepackage{array, multirow, tabularx}
\usepackage[strict]{changepage}

\usepackage{hyperref}

\begin{document}

\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 }X       |} % Riscos
        *3{@{\hspace{3.0pt}}>{\Centering\arraybackslash                   }p{0.9cm}|} % Probabilidade, Impacto , Prioridade
        *2{                 >{\RaggedRight\arraybackslash\hsize=0.95\hsize}X       |} % Resposta, Prevenção
    }

    \hline Riscos  & Pro\-ba\-bi\-li\-da\-de & Im\-pac\-to & Prio\-ri\-da\-de & Es\-tra\-té\-gia de res\-pos\-ta & Ações de pre\-ven\-ção \\ \hline

    % Row 1
    % Riscos
    \hline 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
    \hline 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

    \hline \end{tabularx}
    \end{adjustwidth}

\end{document}

And this is the warning:

D:\main2.tex:63: Overfull \hbox (1.8104pt too wide) in paragraph at lines 63--63

Overfull \hbox (1.8104pt too wide) in paragraph at lines 63--63
 []|\T1/ntxtlf/m/n/10.95 (-20) M▒dia|

This is how the table looks like:

enter image description here

Which is look good for me, therefore how would I to extend the warning limits to allow this table only, not trigger them accordingly to how it is looking now?

Best Answer

The warning is

Overfull \hbox (1.8104pt too wide) in paragraph at lines 63--63
 []|\T1/ntxtlf/m/n/10.95 (-20) `M▒dia|

This shows you that the problem is not that the table is too wide, but that the text does not fit in the p column. This is why your settings outside the table had little effect as the paragraph settings are "normalized" in parboxes and p column entries.

So you could reset \hfuzz inside the table but really it is pretty odd to specify a column width and then give it an unbreakable one-word entry that is wider than the column.

If you make the p column 2pt wider then the warning goes.

\begin{tabularx}{\linewidth}
{|
 *1{     >{\RaggedRight\arraybackslash\hsize=1.1\hsize }X       |} % Riscos
 *3{@{\hspace{3.0pt}}>{\Centering\arraybackslash}p{\dimexpr 0.9cm+2pt\relax}|} % Probabilidade, Impacto , Prioridade
 *2{     >{\RaggedRight\arraybackslash\hsize=0.95\hsize}X       |} % Resposta, Prevenção
}