我尝试过在--和subcaption
内使用公式。我也查看了一些线程,但找不到任何我需要的东西。minipage
subcaption
subcaptionbox
请注意,这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 包将其视为minipage
,figure
至少从caption
s 的角度来看是这样。然后使用普通的字幕命令,如\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}