使用 beamer 将 TikZ 云移动到更好的位置

使用 beamer 将 TikZ 云移动到更好的位置

我正在尝试操纵 TikZ 的精确位置cloud,但我不确定我是否做了任何努力。

正如您在上述图片中看到的,项目之间的空间并不美观。所以我尝试将其添加到itemize环境之外。但它似乎没有遵循我的命令。我使用的代码是

\documentclass[slidestop,compress,mathserif,12pt,xcolor=dvipsnames]{beamer}
\graphicspath{{images/}}
\definecolor{LHCblue}{RGB}{4, 114, 255}
\usecolortheme[named=LHCblue]{structure}
\usepackage[bars]{beamerthemetree} % Beamer theme v 2.2
\usepackage{kerkis}
\usepackage{multimedia}
\usepackage{subfigure}
\mode<presentation>
%frame
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
     \oldmacro\hfill%
  \insertframenumber\,}%/\,\inserttotalframenumber
\setbeamertemplate{footline}[frame number]
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\setbeamercovered{higly dynamic}
\usetheme[watermark=ntua-logo.jpg]{Ilmenau} % Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%Beamer Outer Theme-circles on top

\useinnertheme{circles} %rectangle bullet points instead of circle ones
\usepackage{beamerthemebars}
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\title[July 2012 H4 Test Beam\hspace{3cm} Stony Brook, NYC]{July 2012 H4 Test Beam}
\author[Stamatopoulos N. Athanasios\hspace{2.5cm}{[email protected]}]        {Stamatopoulos N. Athanasios}
\institute{NTUA/CERN}
\logo{%
  \makebox[0.99\paperwidth]{%
    \includegraphics[width=1cm,keepaspectratio]{cern_logo_white.jpg}%
    \hfill%
    \includegraphics[width=1cm,keepaspectratio]{ntua-logo.jpg}%
  }%
}

\usepackage{textpos}
\usepackage{tikz}
\usetikzlibrary{%
calc,%
fadings,%
shadings%
}

\usetikzlibrary{arrows,snakes,shapes}
%\usepackage{enumitem}
%\usepackage{paralist}

   \begin{document}

    \begin{frame}
\begin{itemize}
    \item XY Resistive MM
    \item Manufactured by Rui de Oliveira \quad \uncover<1->{\begin{tikzpicture}
\node[align=center,draw,shading=ball,text=white,cloud callout,cloud puffs=17,cloud puff arc     =140,callout pointer segments=3,anchor=pointer,callout relative pointer={(200:2 cm )},     aspect =2.5,scale=0.5]
at(current page.east){Thank you Rui!};
\end{tikzpicture}}
    \item bla bla bla
\end{itemize}
\begin{tikzpicture}
\node[align=center,draw,shading=ball,text=white,cloud callout,cloud puffs=17,cloud puff arc     =140,callout pointer segments=3,anchor=pointer,callout relative pointer={(200:2 cm )},     aspect =2.5,scale=0.5]
at(current page.north east){Thank you Rui!};
\end{tikzpicture}
\end{frame}

\end{document}

对此有什么想法吗?

答案1

噢,敲击更快。我基本上做了同样的事情,但是把它变成了一个带有参数的宏[angle]{content}

代码

\documentclass{beamer}
\usetheme{Darmstadt}
\usepackage{tikz}
\usetikzlibrary{shapes}

\newcommand{\Cloud}[2][180]% [angle], content
{   \begin{tikzpicture}[overlay]
        \node[align=center, draw, shading=ball, text=white, cloud callout, cloud puffs=17, cloud puff arc=140, callout pointer segments=3, anchor=pointer, callout relative pointer={(#1:2 cm )}, aspect=4,scale=0.5] at (0.2ex,0.5ex) {#2};
\end{tikzpicture}
}

\begin{document}

\begin{frame}[t]
    \begin{itemize}
        \item XY Resistive MM\Cloud{Thank you Rui}
    \item Manufactured by Rui de Oliveira\Cloud[160]{Thanks again}
    \item bla bla bla\Cloud[120]{Thanks yet another time}
    \end{itemize}
\end{frame}

\end{document}

结果

在此处输入图片描述

答案2

这是另一种方法:首先标记云的起始点,然后从该位置开始定位云。该命令\mycallout具有覆盖感知功能,因此允许您进行一些自定义。

请注意,无论是否标记了点,您都可以定位云,但这样做可以使指针相对于句子垂直对齐(最后一个云不是)。

\documentclass[slidestop,compress,mathserif,12pt,xcolor=dvipsnames]{beamer}
\graphicspath{{images/}}
\definecolor{LHCblue}{RGB}{4, 114, 255}
\usecolortheme[named=LHCblue]{structure}
\usepackage[bars]{beamerthemetree} % Beamer theme v 2.2
\usepackage{kerkis}
\usepackage{multimedia}
\usepackage{subfigure}
\mode<presentation>
%frame
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
     \oldmacro\hfill%
  \insertframenumber\,}%/\,\inserttotalframenumber
\setbeamertemplate{footline}[frame number]
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\setbeamercovered{higly dynamic}
\usetheme[watermark=ntua-logo.jpg]{Ilmenau} % Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%Beamer Outer Theme-circles on top

\useinnertheme{circles} %rectangle bullet points instead of circle ones
\usepackage{beamerthemebars}
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\title[July 2012 H4 Test Beam\hspace{3cm} Stony Brook, NYC]{July 2012 H4 Test Beam}
\author[Stamatopoulos N. Athanasios\hspace{2.5cm}{[email protected]}]        {Stamatopoulos N. Athanasios}
\institute{NTUA/CERN}
\logo{%
  \makebox[0.99\paperwidth]{%
    \includegraphics[width=1cm,keepaspectratio]{logopolito}%
    \hfill%
    \includegraphics[width=1cm,keepaspectratio]{ntua-logo}%
  }%
}

\usepackage{textpos}
\usepackage{tikz}
\usetikzlibrary{%
calc,%
fadings,%
shadings%
}

\usetikzlibrary{arrows,decorations,shapes}
%\usepackage{enumitem}
%\usepackage{paralist}

\usepackage{xparse}

 \tikzset{
    invisible/.style={opacity=0},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }

\NewDocumentCommand{\mycallout}{r<> m m}{%
\tikz[remember picture, overlay]\node[visible on=<#1>,align=center,draw,shading=ball,text=white,cloud callout,cloud puffs=17,cloud puff arc=140,callout pointer segments=3,anchor=pointer,callout relative pointer={(200:2cm)}, aspect =2.5,scale=0.5]
at (#2) {#3};
}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline=-0.5ex] \node (#1) {};}

\begin{document}

\begin{frame}
\begin{itemize}
    \item<1-> XY Resistive MM
    \item<2-> Manufactured by Rui de Oliveira \tikzmark{this point}\quad 
     \mycallout<3>{this point}{Thank you Rui!}
    \item<4-> Another sentence with a callout \tikzmark{bla} \mycallout<5>{bla}{Bla bla bla}
\end{itemize}
\vfill
Another text. \mycallout<6>{0,0}{My text}
\vfill
\end{frame}

\end{document}

结果:

在此处输入图片描述


Percusse 建议对源自您的代码的警告进行注释:

  • 选项slidetop

类 beamer 警告:slidestop'' is obsolete. Use输入行 343 上显示为 t''。

  • 选项mathserif

类 beamer 警告:mathserif'' is obsolete. Use font theme输入行 343 上的 serif'' 带有选项“onlymath”。

您可以通过替换代码中的前两行来避免这些问题:

\documentclass[t,compress,12pt,xcolor=dvipsnames,]{beamer}
\usefonttheme[onlymath]{serif}

请注意,该snakes库也已过时:decorations尽管当前示例中不需要,您仍然可以使用它。


等效的xparse-free 解:

\documentclass[t,compress,12pt,xcolor=dvipsnames,]{beamer}
\usefonttheme[onlymath]{serif}
\usepackage{lmodern}
\graphicspath{{images/}}
\definecolor{LHCblue}{RGB}{4, 114, 255}
\usecolortheme[named=LHCblue]{structure}
\usepackage[bars]{beamerthemetree} % Beamer theme v 2.2
\usepackage{kerkis}
\usepackage{multimedia}
\usepackage{subfigure}
\mode<presentation>
%frame
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
     \oldmacro\hfill%
  \insertframenumber\,}%/\,\inserttotalframenumber
\setbeamertemplate{footline}[frame number]
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\setbeamercovered{higly dynamic}
\usetheme[watermark=ntua-logo.jpg]{Ilmenau} % Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%Beamer Outer Theme-circles on top

\useinnertheme{circles} %rectangle bullet points instead of circle ones
\usepackage{beamerthemebars}
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\title[July 2012 H4 Test Beam\hspace{3cm} Stony Brook, NYC]{July 2012 H4 Test Beam}
\author[Stamatopoulos N. Athanasios\hspace{2.5cm}{[email protected]}]        {Stamatopoulos N. Athanasios}
\institute{NTUA/CERN}
\logo{%
  \makebox[0.99\paperwidth]{%
    \includegraphics[width=1cm,keepaspectratio]{logopolito}%
    \hfill%
    \includegraphics[width=1cm,keepaspectratio]{ntua-logo}%
  }%
}

\usepackage{textpos}
\usepackage{tikz}
\usetikzlibrary{%
calc,%
fadings,%
shadings%
}

\usetikzlibrary{arrows,decorations,shapes}
%\usepackage{enumitem}
%\usepackage{paralist}

 \tikzset{
    invisible/.style={opacity=0},
    visible on/.style={alt=#1{}{invisible}},
    alt/.code args={<#1>#2#3}{%
      \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path
    },
  }

\newcommand{\mycallout}[3]{%
\tikz[remember picture, overlay]\node[visible on=<#1>,align=center,draw,shading=ball,text=white,cloud callout,cloud puffs=17,cloud puff arc=140,callout pointer segments=3,anchor=pointer,callout relative pointer={(200:2cm)}, aspect =2.5,scale=0.5]
at (#2) {#3};
}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture,baseline=-0.5ex] \node (#1) {};}

\begin{document}

\begin{frame}
\begin{itemize}
    \item<1-> XY Resistive MM
    \item<2-> Manufactured by Rui de Oliveira \tikzmark{this point}\quad 
     \mycallout{3}{this point}{Thank you Rui!}
    \item<4-> Another sentence with a callout \tikzmark{bla} \mycallout{5}{bla}{Bla bla bla}
\end{itemize}
\vfill
Another text. \mycallout{6}{0,0}{My text}
\vfill
\end{frame}

\end{document}

相关内容