我需要修改之前关于图下标题宽度的问题。目标是让标题\captionsetup{width=x}
的宽度与图的宽度完全相同。我被建议使用 caption 包和命令,通过指定 x 等于图的宽度,使标题的宽度与图的宽度相同。但是,我正在做一个演示,似乎这在这里不起作用,当我这样做时,标题仍然比图宽得多,如下图所示。
另外,我想使用命令\setbeamertemplate{caption}{\raggedright\insertcaption\par}
删除标题前的“Figure:”,但现在这也不起作用,但如果我\usepackage{caption}
从序言中排除它,它就可以正常工作。这是我现在的代码:
\PassOptionsToPackage{table}{xcolor}
\documentclass[xcolor=svgnames]{beamer}
%\PassOptionsToPackage{svgnames}{xcolor}
%\documentclass[xcolor=table]{beamer}
%
% Choose how your presentation looks.
%
% For more themes, color themes and font themes, see:
% http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
%
\mode<presentation>
{
\usetheme{Warsaw} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{default} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
% \setbeamertemplate{caption}[numbered]
%\setbeamercolor{section in head/foot}{bg=NavyBlue}
}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{booktabs}% for better rules in the table
\usepackage{ragged2e}
\usepackage{rotating}
\usepackage{caption}
\title[Thesis Defense]{Name of the thesis}
\subtitle{Thesis Defense}
\author{}
\institute{}
\date{January 31, 2018}
\begin{document}
\setbeamertemplate{caption}{\raggedright\insertcaption\par}
\setbeamerfont{caption}{size=\tiny}
\begin{frame}[plain]
\titlepage
\end{frame}
\begin{frame}{Motivation}
\begin{figure}
\centering
\captionsetup{width=90mm}
\small{Appreciation of house prices and policy rate} \par
%\label{fig:circulation}
\includegraphics[width=90mm,height=0.5\textheight,keepaspectratio]{WuXia_rate_Real_HPI}
\caption{\textit{Shaded area marks the pre-crisis period in which effective federal funds rate was below the Taylor rule rate.}}
%\begin{source} National central banks \end{source}
\end{figure}
\begin{itemize}
\item
\item
\end{itemize}
\end{frame}
\end{document}
答案1
您可以使用measuredfigure
描述的环境 这里 (作者:Bernard)
并显示在以下 MWE 中:
\documentclass[xcolor=svgnames]{beamer}
\mode<presentation>
{
\usetheme{Warsaw}
\usecolortheme{default}
\usefonttheme{default}
\setbeamertemplate{navigation symbols}{}
}
\setbeamertemplate{caption}{\raggedright\insertcaption\par}
\setbeamerfont{caption}{size=\tiny}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{threeparttable}
\begin{document}
\begin{frame}{Motivation}
\begin{figure}
\centering
\small{Appreciation of house prices and policy rate} \par
\begin{measuredfigure}
\includegraphics[width=90mm,height=0.5\textheight,keepaspectratio]{example-image}
\caption{\textit{Shaded area marks the pre-crisis period in which effective federal funds rate was below the Taylor rule rate.}}
\end{measuredfigure}
\end{figure}
\begin{itemize}
\item
\item
\end{itemize}
\end{frame}
\end{document}
答案2
这字幕包提供了一个width
选项,允许您单独调整每个图形的宽度。这样,您就可以调整宽度以适合您的图形的宽度。如果您的所有图形都具有相同的宽度,则可以\captionsetup{width=<len>}
全局设置该选项。