[Tex/LaTex] Is it possible to use subcaption inside a minipage

minipagesubcaptionsubfloats

I have tried formulations of using subcaption inside minipagesubcaption and subcaptionbox. I have also look at some threads but couldn't find anything doing what I needed.

Please note that this minipage is enclosed in a tcolorbox.

\documentclass{article}
\usepackage{standalone}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{capt-of}
\captionsetup[subfigure]{labelformat = parens, labelsep = space, font = small}
\begin{document}
  \begin{minipage}{\linewidth}
    \centering
    \subcaptionbox{A frictionless ball in a semi-circle. \label{semicircle}
      [.5\linewidth]{\includestandalone{semicircle}}
    \subcaptionbox{Close up of the forces on the frictionless ball.
      \label{exam2triangle}
      [.5\linewidth]{\includestandalone{exam2triangle}}
    \captionof{figure}[Frictionless Ball on a Semi-Circle]{A frictionless ball
      oscillating on a semi-circle.}
    \label{exam2}
  \end{minipage}
\end{document}

This was my most recent failed attempt.

Best Answer

Normally I wouldn't suggest this, but this seems to be a case in which the H specifier (from, for example, the float package) might be handy to suppress flotation:

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[most]{tcolorbox}
\usepackage{subcaption}
\usepackage{float}
\captionsetup[subfigure]{labelformat = parens, labelsep = space, font = small}

\begin{document}

\begin{tcolorbox}
\begin{figure}[H]
  \begin{minipage}{\linewidth}
    \centering
    \subcaptionbox{A frictionless ball in a semi-circle.}
    {\includegraphics[height=3cm]{example-image-a}}\quad
    \subcaptionbox{Close up of the forces on the frictionless ball.}
     {\includegraphics[height=2cm]{example-image-b}}
    \caption[Frictionless Ball on a Semi-Circle]{A frictionless ball
      oscillating on a semi-circle.}
    \label{exam2}
  \end{minipage}
\end{figure}
\end{tcolorbox}

\end{document}

enter image description here

Related Question