笔记

笔记

我有一张幻灯片,里面有一张图。我想在图片的顶部绘制一个圆角矩形,以突出显示该部分。如果您可以绘制两个圆角矩形作为叠加层,并且每次只显示一个,则可以获得加分。

替代文本

\documentclass{beamer}
\usepackage[T1]{fontenc}

\begin{document}

\begin{frame}
    \frametitle{ESR1} 

    \begin{center}
        Functional analysis
    \end{center}

    \begin{center}
        \includegraphics[width=1\textheight]{some_image.jpg}
    \end{center}
\end{frame}
\end{document}

(注意:我删除了示例代码中大部分不必要的代码,所以图片中的主题与示例代码中的默认主题不再匹配。--Caramdir)

答案1

您可以将图片包含到 TikZ 节点中,然后在其上绘制一些矩形。例如,

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{tikz}

\begin{document}

\begin{frame}
    \frametitle{ESR1} 

    \begin{center}
        Functional analysis
    \end{center}

    \begin{center}
        \begin{tikzpicture}
            \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[width=1\textheight]{some_image.jpg}};
            \draw<1>[red,ultra thick,rounded corners] (1.6,1) rectangle (\textheight-1cm,5);
            \draw<2>[red,ultra thick,rounded corners] (5.7,4.1) rectangle (7.5,4.9);
        \end{tikzpicture}
    \end{center}
\end{frame}
\end{document}

来自维基百科的图片就像some_image.jpg两张幻灯片一样

例子

注意那\node[anchor=south west,inner sep=0] at (0,0) {\includegraphics{...}};行。这会添加图片,使左下角位于 TikZ 坐标系的原点。TikZ 手册 (v2.10) 的第 14.6 节“圆角”告诉您如何更改圆角。

顺便问一下,你的意思是真的吗width=1\textheight

答案2

该死的卡拉姆迪尔,晚了四分钟!

无论如何,这就是我想到的。Caramdir 的至少一样好,但我的语法可能更接近你的语法...

\documentclass[english,ignorenonframetext,table]{beamer}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{graphicx}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
%% A simple dot to overcome graphicx limitations
\newcommand{\lyxdot}{.}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
 % this default might be overridden by plain title style
 \newcommand\makebeamertitle{\frame{\maketitle}}%
 \AtBeginDocument{
   \let\origtableofcontents=\tableofcontents
   \def\tableofcontents{\@ifnextchar[{\origtableofcontents}{\gobbletableofcontents}}
   \def\gobbletableofcontents#1{\origtableofcontents}
 }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{xcolor}
\usepackage{listings}
\usetheme{Frankfurt} %Warsaw
\usecolortheme{albatross}
\setbeamercovered{transparent}

\newcommand{\tformating}{
 \definecolor{darkPurple}{rgb}{0.101960784313725,0,0.2}
 \definecolor{purple}{rgb}{0.2,0,0.4}
 \definecolor{lightPurple}{rgb}{0.4,0,0.4}
 \rowcolors[]{1}{darkPurple}{purple}
 \small
}

\usepackage{tikz,overpic}
\usetikzlibrary{fit,shapes.misc}

\makeatother

\usepackage{babel}

\begin{document}
\begin{frame}

\frametitle{ESR1} 

\begin{center}
Functional analysis
\par\end{center}

\begin{center}
\only<1>{\begin{overpic}[width=1\textheight]{some_image.jpg}
\end{overpic}}%
\only<2>{\begin{overpic}[width=1\textheight]{some_image.jpg}
\put(40,38){\tikz \draw[red,thick,rounded corners] (0,0) rectangle (5,1.2);}
\end{overpic}}%
\only<3>{\begin{overpic}[width=1\textheight]{some_image.jpg}
\put(40,38){\tikz \draw[red,thick,rounded corners] (0,0) rectangle (5,1.2);}
\put(0,14){\tikz \draw[red,thick,rounded corners] (0,0) rectangle (3.5,1.2);}
\end{overpic}}%
\par\end{center}

\end{frame}
\end{document}

替代文本

答案3

笔记

因为我用的是PSTricks,所以图片是eps格式的。我的编译步骤如下

  1. latex.exe将 .tex 转换为 .dvi。
  2. dvips.exe将 .dvi 转换为 .ps。
  3. ps2pdf.exe将.ps 转换为.pdf。

替代文本

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{pstricks}


\newdimen\ImageW
\ImageW=8cm

\newdimen\ImageH
\ImageH=6cm

\begin{document}

\begin{frame}[t]{ESR1} 

    \begin{center}
        Functional analysis
    \end{center}

    \begin{center}
        \pspicture(\ImageW,\ImageH)
        \rput(0.5\ImageW,0.5\ImageH){\includegraphics[width=\ImageW]{pitfall}}
        %\psgrid%turn on or off for navigational purpose during development
        \pause
        \psset{linecolor=red,linewidth=2pt,framearc=0.5}
        \psframe(5.2,3.8)(6.4,5.6)\pause
        \psframe(2.7,0)(4.5,1)       
        \endpspicture
    \end{center}

\end{frame}
\end{document}

相关内容