如何减少特定图形的 \subcaption 中的标题字体

如何减少特定图形的 \subcaption 中的标题字体

如何缩小\subfigureBeamer 环境中特定图形的字体大小。我知道如何缩小标题字体全球 \usepackage[font=small]{subcaption},但我正在寻找字体大小处理本地

\subfigure我使用from包在一个框架中显示四个子图\subcaption。问题是子图的各个标题,(A B C D),与子图片中使用的标签文本相比,它们太大了。因此,如果我增加单个子图的高度,\begin{subfigure}{.49\textwidth}那么这四张图片就会超出页面,如果我减小它的大小,那么与标题相比,图中使用的字体就会太小。因此,我想减小标题字体,这样图片中使用的文本看起来就不会太糟糕。

我的 MWE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\documentclass{beamer}

\mode<presentation> {

% The Beamer class comes with a number of default slide themes
% which change the colors and layouts of slides. Below this is a list
% of all the themes, uncomment each in turn to see what they look like.

%\usetheme{default}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Bergen}
%\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
%\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Darmstadt}
%\usetheme{Dresden}
%\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{Ilmenau}
%\usetheme{JuanLesPins}
%\usetheme{Luebeck}
% \usetheme{Madrid}
%\usetheme{Malmoe}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
\usetheme{Warsaw}

% As well as themes, the Beamer class has a number of color themes
% for any slide theme. Uncomment each of these in turn to see how it
% changes the colors of your current slide theme.
\useoutertheme{infolines}
%\usecolortheme{albatross}
%\usecolortheme{beaver}
%\usecolortheme{beetle}
%\usecolortheme{crane}
%\usecolortheme{dolphin}
%\usecolortheme{dove}
%\usecolortheme{fly}
%\usecolortheme{lily}
%\usecolortheme{orchid}
%\usecolortheme{rose}
%\usecolortheme{seagull}
%\usecolortheme{seahorse}
%%\usecolortheme{whale}
%\usecolortheme{wolverine}

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

% % % Black Background Configuration
%\setbeamercolor{normal text}{fg=white,bg=black!90}
%\setbeamercolor{structure}{fg=white}
%
%\setbeamercolor{alerted text}{fg=red!85!black}
%
%\setbeamercolor{item projected}{use=item,fg=black,bg=item.fg!35}
%
%\setbeamercolor*{palette primary}{use=structure,fg=structure.fg}
%\setbeamercolor*{palette secondary}{use=structure,fg=structure.fg!95!black}
%\setbeamercolor*{palette tertiary}{use=structure,fg=structure.fg!90!black}
%\setbeamercolor*{palette quaternary}{use=structure,fg=structure.fg!95!black,bg=black!80}
%
%\setbeamercolor*{framesubtitle}{fg=white}
%
%\setbeamercolor*{block title}{parent=structure,bg=black!60}
%\setbeamercolor*{block body}{fg=black,bg=black!10}
%\setbeamercolor*{block title alerted}{parent=alerted text,bg=black!15}
%\setbeamercolor*{block title example}{parent=example text,bg=black!15}

% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % %

%\setbeamertemplate{footline} % To remove the footer line in all slides uncomment this line
%\setbeamertemplate{footline}[page number] % To replace the footer line in all slides with a simple slide count uncomment this line

%\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables
\usepackage{epstopdf}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[backend=bibtex]{biblatex}

%\usepackage{IEEEtrantools.sty} %Copy file IEEEtran.sty to folder where miktek is installed i-e E:\Program Files\MiKTeX 2.9\tex\latex\IEEEtran.sty
\usepackage[retainorgcmds]{IEEEtrantools} %For TexLive

\usepackage{comment}
%\bibliography{references}
%\usepackage{bibentry}

%\usepackage{mathtools}
%\usepackage{verbatim}

\usepackage[disable,colorinlistoftodos]{todonotes}
%\usepackage[obeyDraft,colorinlistoftodos]{todonotes}

\usepackage{subcaption}

\beamertemplatenavigationsymbolsempty 
\usepackage[framemethod=tikz]{mdframed} %for slide transition
\setbeamertemplate{caption}[numbered] %To achieve numbering of figures, you need to set.



\begin{document}

%-----------------------------------------------------------

%------------------------------
\begin{frame}
\begin{figure}[h!]
    \begin{subfigure}{.49\textwidth}
        %           \centering
        \includegraphics[width=1\linewidth]{f22.eps}
        \caption{ }
        \label{fig7a}
    \end{subfigure} 
    \begin{subfigure}{.49\textwidth}
        %           \centering
        \includegraphics[width=1\linewidth]{f23.eps}
        \caption{ }
        \label{fig7b}
    \end{subfigure} \\%
    \begin{subfigure}{.49\textwidth}
%       \centering
        \includegraphics[width=1\linewidth]{f24.eps}
        \caption{ }
        \label{fig7c}
    \end{subfigure} %
    \begin{subfigure}{.49\textwidth}
        %           \centering
        \includegraphics[width=1\linewidth]{f25.eps}
        \caption{ }
        \label{fig7d}
    \end{subfigure}
    \caption{\textbf{My caption}
    \label{f7}
\end{figure}
\end{frame}

\end{document} 

答案1

我会添加说明

\captionsetup[subfigure]{font=scriptsize,labelfont=scriptsize}

之后\begin{figure}。这样,设置更改就只针对这个特定figure环境。

完整的 MWE:

在此处输入图片描述

\documentclass[demo]{beamer}

\mode<presentation> {
\usetheme{Warsaw}
\useoutertheme{infolines}
}
\usepackage{graphicx} % Allows including images
\usepackage{booktabs}
\usepackage{epstopdf}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[backend=bibtex]{biblatex}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage{comment}
\usepackage[disable,colorinlistoftodos]{todonotes}
\usepackage{subcaption}
\beamertemplatenavigationsymbolsempty 
\usepackage[framemethod=tikz]{mdframed} 
\setbeamertemplate{caption}[numbered]

\begin{document}

\begin{frame}
\begin{figure}[h!]
    \captionsetup[subfigure]{font=scriptsize,labelfont=scriptsize}
    \begin{subfigure}{.49\textwidth}
        \includegraphics[width=1\linewidth]{f22.eps}
        \caption{Hello World}
        \label{fig7a}
    \end{subfigure} \hspace*{\fill}
    \begin{subfigure}{.49\textwidth}
        \includegraphics[width=1\linewidth]{f23.eps}
        \caption{Good Morning}
        \label{fig7b}
    \end{subfigure} 

    \begin{subfigure}{.49\textwidth}
        \includegraphics[width=1\linewidth]{f24.eps}
        \caption{Good Night}
        \label{fig7c}
    \end{subfigure} \hspace*{\fill}
    \begin{subfigure}{.49\textwidth}
        \includegraphics[width=1\linewidth]{f25.eps}
        \caption{Goodbye World}
        \label{fig7d}
    \end{subfigure}
    \caption{\textbf{My caption}}
    \label{f7}
\end{figure}
\end{frame}

\end{document}

附录:如果您想要让整个图形标题显示在框架中,则必须减小图像的尺寸,可能类似于下面的示例。

在此处输入图片描述

\documentclass[demo]{beamer} % remove 'demo' option in real document

\mode<presentation> {
\usetheme{Warsaw}
\useoutertheme{infolines}
}
\usepackage{booktabs}
\usepackage[font=small,skip=0pt]{caption}
\usepackage[backend=bibtex]{biblatex}
\usepackage[retainorgcmds]{IEEEtrantools}
\usepackage{comment}
\usepackage[disable,colorinlistoftodos]{todonotes}
\usepackage{subcaption}
\beamertemplatenavigationsymbolsempty 
\usepackage[framemethod=tikz]{mdframed} 
\setbeamertemplate{caption}[numbered]

\begin{document}

\begin{frame}
\captionsetup[figure]{labelfont=scriptsize,
                      textfont={scriptsize,bf}}
\captionsetup[subfigure]{labelfont=scriptsize,
                         textfont=scriptsize}

\begin{figure}[h!]
    \centering
    \begin{subfigure}{.4\textwidth}
    \includegraphics[width=1\linewidth,height=0.2\textheight,keepaspectratio]{f22.eps}
    \caption{Hello World}
    \label{fig7a}
    \end{subfigure} \qquad
    \begin{subfigure}{.4\textwidth}
    \includegraphics[width=1\linewidth,height=0.2\textheight,keepaspectratio]{f23.eps}
    \caption{Good Morning}
    \label{fig7b}
    \end{subfigure} 

    \begin{subfigure}{.4\textwidth}
    \includegraphics[width=1\linewidth,height=0.2\textheight,keepaspectratio]{f24.eps}
    \caption{Good Night}
    \label{fig7c}
    \end{subfigure} \qquad
    \begin{subfigure}{.4\textwidth}
    \includegraphics[width=1\linewidth,height=0.2\textheight,keepaspectratio]{f25.eps}
    \caption{Goodbye World}
    \label{fig7d}
    \end{subfigure}

\caption{My caption}
\label{f7}
\end{figure}

\end{frame}

\end{document}

答案2

随后重新定义\thesubfigure并恢复正常字体大小即可得到所需的结果:

\documentclass{beamer}

\usetheme{Warsaw}
\useoutertheme{infolines}

\usepackage{caption}
\usepackage[labelformat=simple]{subcaption}

\setbeamertemplate{caption}[numbered] 

\captionsetup{font=bf}

\renewcommand\thesubfigure{\normalfont(\alph{subfigure})}

\begin{document}

    \begin{frame}
        \begin{figure}[h!]
            \begin{subfigure}{.49\textwidth}
                \renewcommand\thesubfigure{\fontsize{5}{8}\selectfont (\alph{subfigure})}
                \includegraphics[width=1\linewidth]{pic}
                \caption{ }
                \label{fig7a}
                \renewcommand\thesubfigure{\normalfont (\alph{subfigure})}
            \end{subfigure} 
            \begin{subfigure}{.49\textwidth}
                \includegraphics[width=1\linewidth]{pic}
                \caption{ }
                \label{fig7b}
            \end{subfigure}
            \caption{My caption}
            \label{f7}
        \end{figure}
    \end{frame}

\end{document} 

在此处输入图片描述

评论

  • 不需要,graphicx本身已经提供了beamerbeamer
  • 也不需要像[h!]中的放置选项beamer,因为它beamer禁用了浮动机制。

相关内容