我有使用sthlm 主题。在一张幻灯片上,我尝试使用所有可用的空白来容纳四个数字(在列环境中)。我想我可以使用此代码更改幻灯片的边距,但似乎没有效果,而且似乎不是特定于主题的。我该如何让它工作?
梅威瑟:
\documentclass{beamer}
%\usetheme{sthlm}
\usepackage{graphicx}
\usepackage{mwe}
\newenvironment{changemargin}[2]{%
\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{#1}%
\setlength{\rightmargin}{#2}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
}%
\item[]}{\end{list}}
\begin{document}
\begin{frame}{Main results}
\begin{changemargin}{-1in}{-1in}
\begin{columns}
\column{.5\textwidth}
\centering
\includegraphics[width=\columnwidth,keepaspectratio]{example-image-a}\\
\includegraphics[width=\columnwidth,keepaspectratio]{example-image-b}
\column{.5\textwidth}
\centering
\includegraphics[width=\columnwidth,keepaspectratio]{example-image-c}\\
\includegraphics[width=\columnwidth,keepaspectratio]{example-image-a}
\end{columns}
\end{changemargin}
\end{frame}
\end{document}
答案1
一般来说,更改 beamer 中的页边距不是一个好主意。您可以使用\makebox[\textwidth]{..}
宏轻松插入幻灯片大小允许的最大图像。在框内,使用minipage
您指定的宽度,并按您想要的顺序插入图像,并按您指定的带/不带间隙。以下是一个例子:
\documentclass{beamer}
\usepackage{graphicx,lmodern}
\usepackage{mwe}
\begin{document}
\begin{frame}{Main results}
\makebox[\textwidth]{%
\begin{minipage}{1.05\textwidth} % <--- can be as large the slide size permits
\includegraphics[width=.49\textwidth,keepaspectratio]{example-image-a}\hfill%
\includegraphics[width=.49\textwidth,keepaspectratio]{example-image-c}\\[4pt]
\includegraphics[width=.49\textwidth,keepaspectratio]{example-image-b}\hfill%
\includegraphics[width=.49\textwidth,keepaspectratio]{example-image-a}
\end{minipage}
}
\end{frame}
\end{document}
答案2
检查这是否有效。
您可以使用 tikz 来执行此操作。这是一个 MWE。
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}{Main results}
\begin{tikzpicture}[remember picture, overlay]
\node[anchor = north west] at ([yshift=-1cm]current page.north west) {
\includegraphics[height=0.43\paperheight,keepaspectratio]{example-image-a}};
\node[anchor = north east] at ([yshift=-1cm]current page.north east) {
\includegraphics[height=0.43\paperheight,keepaspectratio]{example-image-c}};
\node[anchor = south east] at (current page.south east) {
\includegraphics[height=0.43\paperheight,keepaspectratio]{example-image-a}};
\node[anchor = south west] at (current page.south west) {
\includegraphics[height=0.43\paperheight,keepaspectratio]{example-image-b}};
\end{tikzpicture}
\end{frame}
\end{document}
这将产生输出:
当然,您可以根据自己的喜好调整尺寸。如果您想保持纵横比不变,那么可能会有一些空间未使用。
答案3
适用于 LaTeX 的功能很少适用于 Beamer。我使用了 minipage 而不是列表环境,因为我们不需要分页符。我不太熟悉 Beamer 的列环境,无法确定列间隙有多宽(除了太宽之外)。
剩下的唯一问题是图像对于页面来说太高了。
\documentclass{beamer}
%\usetheme{sthlm}% could not find
\usepackage{graphicx}
\makeatletter
\newenvironment{fullwidth}{\hspace*{-\beamer@leftmargin}%
\minipage{\paperwidth}}{\endminipage
\hspace*{-\beamer@rightmargin}}
\makeatother
\begin{document}
\begin{frame}{Main results}
\begin{fullwidth}
\begin{minipage}{\dimexpr.5\textwidth-0.5\columnsep}
\centering% redundant - no free space
\includegraphics[width=\linewidth,keepaspectratio]{example-image-a}\\
\includegraphics[width=\linewidth,keepaspectratio]{example-image-b}
\end{minipage}\hfill
\begin{minipage}{\dimexpr.5\textwidth-0.5\columnsep}
\centering% redundant - no free space
\includegraphics[width=\linewidth,keepaspectratio]{example-image-c}\\
\includegraphics[width=\linewidth,keepaspectratio]{example-image-a}
\end{minipage}
\end{fullwidth}
\end{frame}
\end{document}