When compiling the MWE below with pdflatex, I get the warnings Underfull \hbox (badness 10000) in paragraph at lines 26--27 and Underfull \hbox (badness 10000) in paragraph at lines 36--37.
I tried to avoid this by using \hfill between the subfigures, but it didn't work.
\documentclass{scrbook}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{subcaption}
\usepackage{gnuplottex}
\usepackage{xparse}
\ExplSyntaxOn
\DeclareExpandableDocumentCommand{\convertlen}{ O{cm} m }
{
\dim_to_unit:nn { #2 } { 1 #1 } cm
}
\ExplSyntaxOff
\begin{document}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{.45\textwidth}
\begin{gnuplot}[terminal = cairolatex, terminaloptions = {size \convertlen{\textwidth},\convertlen{.3\textheight}}]
plot sin(x)
\end{gnuplot}
\caption{A subfigure}
\label{fig:1a}
\end{subfigure}%
\hfill
\begin{subfigure}[b]{.45\textwidth}
\begin{gnuplot}[terminal = cairolatex, terminaloptions = {size \convertlen{\textwidth},\convertlen{.3\textheight}}]
plot sin(x)
\end{gnuplot}
\caption{Another subfigure}
\label{fig:1b}
\end{subfigure}
\caption{A figure}\label{fig:1}
\end{figure}
\end{document}
! Undefined control sequence. \convertlen code #1#2->\dim_to_unit:nn– Gonzalo Medina Aug 13 '15 at 15:24\convertlencommand to specify the width of the gnuplot graph. I found the code for\convertlenhere and don't fully understand it. But it does what I want, except the underfull boxes. – Blub Bla Aug 13 '15 at 16:04\convertlen{\textwidth}to\convertlen{.99\textwidth}makes the warnings go away. – Gonzalo Medina Aug 13 '15 at 17:40.99worked. Who would have thought that you need a smaller figure to get rid of theunderfull boxwarning. – Blub Bla Aug 13 '15 at 19:52