0

I have quite a big document and got an Underfull \hbox (badness 10000) warning at each and every caption I have in a figure, subfigure or table. I didn't find any notes about similar problems and I have no idea what could cause this. Maybe someone has an answer on this? I am coding in overleaf, if this makes a difference.

Here is a example of what I mean:

enter image description here

\documentclass[
  paper=a4,
  fontsize=12pt,
  openany,
  twoside=false,
  headsepline=true,
  numbers=noenddot]{scrartcl}
\usepackage{ifthen}

\usepackage{setspace}
\usepackage{geometry}
\geometry{left=3cm,right=2cm,bottom=2.5cm,top=2.5cm}

\usepackage{lmodern}

\usepackage{color}
\usepackage[table]{xcolor}

\usepackage[ngerman,silent]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}

\usepackage{graphicx}
\usepackage[list=true,listformat=simple]{subcaption}
\usepackage{pdfpages}
\usepackage{float}

\usepackage{textcomp}
\usepackage{latexsym}
\usepackage{marvosym}
\usepackage{amssymb}
\usepackage{rotating}

\usepackage{amsmath}
\usepackage{nicefrac}
\usepackage{bm}
\usepackage{ziffer}
\usepackage{physics}
\usepackage[locale=DE,per-mode=symbol]{siunitx}
\AtBeginDocument{\RenewCommandCopy\qty\SI}

\usepackage{upgreek}
\usepackage{mathtools}
\usepackage{leftidx}
\usepackage{scalerel}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{tabu,longtable}
\usepackage{arydshln}
\usepackage{makecell}
\usepackage{array}
\usepackage[NewCommands]{ragged2e}
\usepackage[german]{rccol}
\usepackage{tabularx}
\usepackage{dcolumn}  
\usepackage{xltabular}
\usepackage{pbox}

\usepackage[acronym,nonumberlist,nopostdot,nogroupskip,section=subsection]{glossaries}
\usepackage[font=small,skip=0pt]{caption}

\usepackage[autooneside=false]{scrlayer-scrpage}
\usepackage{listings}
\usepackage{xcolor}

\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{units}
\usepackage[americaninductors, straightvoltages, european resistors, nooldvoltagedirection]{circuitikz}
\usepackage{booktabs}
\usepackage{makecell}

\pgfkeys{/pgf/number format/.cd,use comma, 1000 sep={\,}}

\usepackage[
  final,
  bookmarks=true,
  bookmarksopen,
  bookmarksnumbered=true,
  linktoc=all,
  hidelinks
]{hyperref}
\usepackage{bookmark}

\usepackage[ngerman,noabbrev,sort,compress]{cleveref} 
\usepackage{attachfile}

\begin{document}

\begin{figure}[!htb]
    \centering
    \input{Falschstrom_Kabel.tex}
    \caption{Falschstromkennlinie des Kabels}
    \label{fig:one}
\end{figure}

\end{document}

Falschstrom_Kabel.tex:

\begin{tikzpicture}
    \begin{axis}[
      width = 0.9\textwidth,
      height = 0.3\textheight,
    ]        
        \addplot coordinates {(0,0) (1,1)};
    \end{axis}
\end{tikzpicture}
4
  • 2
    There could be tens of reasons for that. To be able to help, try to prepare a file showing the problem --- if it happens for every figure, it will suffice a file with just one figure and the preamble code that creates the problem.
    – Rmano
    Jan 22, 2023 at 18:03
  • I added my preamble and a figure as an example.
    – DraUX
    Jan 22, 2023 at 18:42
  • I'm not sure why, but it looks like the problem boils down to \usepackage{subcaption} \usepackage[NewCommands]{ragged2e}. (Also, this isn't really an overleaf problem, so that tag should be removed.)
    – Teepeemm
    Jan 22, 2023 at 19:04
  • Are you sure you need all those packages to produce the problem? It would be nice if you try to trim it down...
    – Rmano
    Jan 22, 2023 at 22:49

1 Answer 1

1

A real minimal code showing the problem is the following one(Note 1):

\documentclass{article}

\usepackage[NewCommands]{ragged2e}
\begin{document}

\begin{figure}[!htb]
    \centering
    \fbox{\Huge\strut image here}
    \caption{Falschstromkennlinie des Kabels}
    \label{fig:one}
\end{figure}

\end{document}

It seems that the problem is the [NewCommands] option for the ragged2e package. If you remove it, there is no more "underfull hbox" warning. Why this is happening, I do not know --- but the NewCommand option changes the original LaTeX commands and it seems that \caption is expecting something different from them.


Note 1: I copied your huge example, and removed (binary search) all packages until I found the minimal example showing the problem. Please, repeat this process next time!

You must log in to answer this question.

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