是否可以在小页面内使用子标题?

是否可以在小页面内使用子标题?

我尝试过在--和subcaption内使用公式。我也查看了一些线程,但找不到任何我需要的东西。minipagesubcaptionsubcaptionbox

请注意,这minipage是包含在内的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}

这是我最近一次失败的尝试。

答案1

通常我不会建议这样做,但是在这种情况下,说明H符(例如,来自float包)可能很方便抑制浮动:

\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}

在此处输入图片描述

答案2

是的,这是可能的,只需\captionsetup{type=figure}在您的内部使用minipage来告诉 (sub)caption 包将其视为minipagefigure至少从captions 的角度来看是这样。然后使用普通的字幕命令,如\caption\subcaptionbox,例如:

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

相关内容