在我的 Beamer 演示文稿中,图/表标题应该是对齐的。标题和子标题包用于上述目的和其他目的。标题现在是对齐的,但它们在列表环境中的对齐方式不正确,如下图所示。
MWE 在这里:
\documentclass[]{beamer}
\usepackage{ragged2e}
\usepackage[justification=justified,width=\linewidth]{caption}
\usepackage{subcaption}
\begin{document}
\begin{frame}
\justifying
\begin{figure}
\caption{\textbf{Caption 1 }- A figure with very long caption. since it is outside list environments, it fits rightly to the text-width, with no unwanted indentation. This paragraph is justified using ragged2e package for proper comparison.}
\end{figure}
\begin{itemize}
\item Now let us introduce an environment.
\begin{figure}
\caption{\textbf{Caption 2 }- A figure with very long caption. since it is inside a list environment, it does not fit rightly to the linewidth, hence crossing the right margin. The caption appears justified though.}
\end{figure}
\item When caption-setup is included inside figure environment, the caption width is fine, but it creates unwanted indentation.
\begin{figure}
\captionsetup{width=\linewidth}
\caption{\textbf{Caption 3 }- A figure with very long caption. The width is okay, but because of unwanted indentation, it crosses the right margin here as well. The caption is justified here as well.}
\end{figure}
\end{itemize}
\end{frame}
\end{document}
如果没有字幕和子字幕包,这个问题就会随着字幕对齐而消失。由于许多原因,最好使用不排除字幕/子字幕包的修复方法。在此先感谢与此相关的任何帮助。
答案1
这里的问题是itemize
环境的额外缩进,它被添加到linewidth
。因此,我们必须在定义标题宽度时减去这个缩进。您可以使用\captionsetup{width=\dimexpr\linewidth-\itemindent\relax}
它。
平均能量损失
\documentclass[]{beamer}
\usepackage{ragged2e}
\usepackage[justification=justified,width=\linewidth]{caption}
\usepackage{subcaption}
\begin{document}
\begin{frame}
\begin{figure}
\caption{\textbf{Caption 1 }- A figure with very long caption. since it is outside list environments, it fits rightly to the text-width, with no unwanted indentation. This paragraph is justified using ragged2e package for proper comparison.}
\end{figure}
\begin{itemize}
\captionsetup{width=\dimexpr\linewidth-\itemindent\relax}
\item Now let us introduce an environment.
\begin{figure}
\caption{\textbf{Caption 2 }- A figure with very long caption. since it is inside a list environment, it does not fit rightly to the linewidth, hence crossing the right margin. The caption appears justified though.}
\end{figure}
\item When caption-setup is included inside figure environment, the caption width is fine, but it creates unwanted indentation.
\begin{figure}
\caption{\textbf{Caption 3 }- A figure with very long caption. The width is okay, but because of unwanted indentation, it crosses the right margin here as well. The caption is justified here as well.}
\end{figure}
\end{itemize}
\end{frame}
\end{document}