I've written a small command so that I don't have to keep creating minipage
s. The command is defined as such:
\newcommand{\itemimage}[3][]{%
\begin{minipage}{\linewidth}
\item #2
\centering
\includegraphics[#1]{#3}
\end{minipage}
}%
Any time I use this, it seems to generate a warning for "Underfull \hbox (badness 10000) in paragraph"
\begin{enumerate}[topsep=0pt]
%...
\itemimage[width=300px]{This is just some text.}{img001.png}
%...
\end{enumerate}
However, if I don't use the command, and instead use what the command is, then no warning is generated.
\begin{enumerate}[topsep=0pt]
%...
\begin{minipage}{\linewidth}
\item This is just some text.
\centering
\includegraphics[width=300px]{img001.png}
\end{minipage}
%...
\end{enumerate}
What am I missing from my \itemimage
command to prevent these warnings from occurring?
Minimal example:
\documentclass[letterpaper,12pt]{extreport}
\usepackage{mathtools}
\usepackage{enumitem}
\edef\restoreparindent{\parindent=\the\parindent\relax}
\usepackage{parskip}
\restoreparindent
\newcommand{\itemimage}[3][]{%
\begin{minipage}{\linewidth}
\item #2
\centering
\includegraphics[#1]{#3}
\end{minipage}
}%
\begin{document}
\begin{sloppypar}
\begin{enumerate}[topsep=0pt]
\itemimage[width=300px]{This is just some text.}{img001.png}
\begin{minipage}{\linewidth}
\item This is just some text.
\centering
\includegraphics[width=300px]{img001.png}
\end{minipage}
\end{enumerate}
\end{sloppypar}
\end{document}
\documentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.