Following code is currently used to show a figure:
\begin{figure}[ht]
\lineskip=-\fboxrule
\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule}
\centering
\includegraphics[width=0.5\textwidth]{example-image}
\end{minipage}}
\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule}
\caption{The caption text}
\end{minipage}}
\label{fig:test}
\end{figure}
Question: How can I adjust the code so that the full box is only 0.5\textwidth of a page, with the image being full width within the box?



\lineskip=-\fboxrule? (the behaviour with negative lineskip is defined but rather odd) – David Carlisle Apr 08 '18 at 19:21