如何调整单个\captionof{figure}{}
字幕的字体大小?
中的细节很少\captionof{}
。是否所有相同的命令规则都\caption
适用。
希望在本地而不是全局更改字体大小。
答案1
这是我最近做的一个例子。其中 \usepackage{caption}
包括一个命令\captionof
,用于将标题添加到非浮点数中;例如:\captionsetup{font=footnotesize}
允许您设置整个标题的大小,包括标题文本前面的“图 1”文本。
\documentclass[12pt]{article}
\usepackage{caption}
% Includes a command \captionof for putting a caption to something that?s not a float; for example: minipage
\usepackage[usenames, dvipsnames]{color}
\usepackage{float}
% Let's you override the placement of figures and lets you specify if you want to figure in a particular place.
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{colortbl}
\usepackage[most]{tcolorbox}
%%%%%%%%%%%%%%%
\begin{document}
\tcbset{boxrule=1.5pt,colback=gray!10!white,colframe=blue!80!,coltitle=blue!80!,colbacktitle=white}
\vspace{1\baselineskip}
\begin{tcolorbox}[every float=\centering, drop shadow, title={\strut \bf Historical Note: Gauss as a Student}]
\begin{minipage}[t]{0.45\linewidth}
\vspace*{0pt}
{There is a great story of Gauss as a student. When he was in elementary school in the late 1700s, he was a bit of a troublemaker. As a punishment one day, his teacher asked him to add all the integers from 1 to 100 before he could join his friends outside to play. Gauss amazed his teacher by how fast he calculated the number: 5050. While he may not have used the formula in Eqn.(), he did a calculation that was similar to what we saw in Method 2. He knew that you could write the sequence 1 .. 100 and also 100 .. 1. Adding the numbers pairwise, you always got 101. The total would be one half of the sums of these sequences. So $101 \times 100 / 2 = 5050$.}
\end{minipage}\hfill%
\begin{minipage}[t]{0.45\linewidth}
\vspace*{0pt}
\begin{center}
\includegraphics[scale=0.09]{gauss_portrait.jpg}
\captionsetup{font=footnotesize}
\captionof{figure}{Portrait of Carl Friedrich Gauss (1792 - 1870) taken in 1840. {\it Source: Wikipedia}}
\label{fig:gauss1}
\end{center}
\end{minipage}
\end{tcolorbox}
\end{document}