![Beamer,四幅图像在两幅上添加粗边框,为什么图像在幻灯片上移动](https://linux22.com/image/438344/Beamer%EF%BC%8C%E5%9B%9B%E5%B9%85%E5%9B%BE%E5%83%8F%E5%9C%A8%E4%B8%A4%E5%B9%85%E4%B8%8A%E6%B7%BB%E5%8A%A0%E7%B2%97%E8%BE%B9%E6%A1%86%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%E5%9B%BE%E5%83%8F%E5%9C%A8%E5%B9%BB%E7%81%AF%E7%89%87%E4%B8%8A%E7%A7%BB%E5%8A%A8.png)
我是 Beamer 的新手,正在尝试创建一个包含四个图形的幻灯片,并且我想用红色框强调两个图形。
这种设置使得四个数字很好地基于这里接受的答案:
\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}
\begin{frame}
\frametitle{Slide Title}
\begin{columns}[t]
\column{.5\textwidth}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 1}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 2}
\column{.5\textwidth}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 3}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 4}
\end{columns}
\end{frame}
当我尝试添加红色框时(按照这个问题/答案,图形会移到页面外。我怎样才能让它们保持在与上图相同的位置,并且只使用粗红色轮廓来强调前两个(左边两个)图形?
\usepackage{caption}
\captionsetup{labelformat=empty,labelsep=none}
\usepackage{fancybox}
\begin{columns}[t]
\fboxsep=1pt
\fboxrule=2pt
\def\bordercolor{red}
\def\backgroundcolor{white}
\cornersize{0.1}
\column{.5\textwidth}
\fcolorbox{\bordercolor}{\backgroundcolor} {\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 1}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 2}
\column{.5\textwidth}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 3}
\includegraphics[width=\columnwidth,height=3cm]{path/to/my.jpg}
\captionof{figure}{Comment 4}
\end{columns}
\end{frame}
答案1
使用tabular
带有c
输入列而不是columns
环境来设置所有内容:
\documentclass{beamer}
\usepackage{fancybox}
\begin{document}
\begin{frame}
\setlength{\fboxsep}{1pt}%
\setlength{\fboxrule}{2pt}%
\newcommand\bordercolor{red}%
\newcommand\backgroundcolor{white}
\begin{tabular}{ c c }
\fcolorbox{\bordercolor}{\backgroundcolor}{%
\includegraphics[width=.45\linewidth,height=3cm]{example-image-a}%
} &
\includegraphics[width=.45\linewidth,height=3cm]{example-image-b} \\
Comment 1 &
Comment 2 \\
\fcolorbox{\bordercolor}{\backgroundcolor}{%
\includegraphics[width=.45\linewidth,height=3cm]{example-image-c}%
} &
\includegraphics[width=.45\linewidth,height=3cm]{example-image-a} \\
Comment 3 &
Comment 4
\end{tabular}
\end{frame}
\end{document}