![beamer:图上的气泡/包含的 pdf(在中间)](https://linux22.com/image/357869/beamer%EF%BC%9A%E5%9B%BE%E4%B8%8A%E7%9A%84%E6%B0%94%E6%B3%A1%2F%E5%8C%85%E5%90%AB%E7%9A%84%20pdf%EF%BC%88%E5%9C%A8%E4%B8%AD%E9%97%B4%EF%BC%89.png)
我试图包含一个 pdf 文档,并且我想在中间添加气泡/注释框,这是我的代码的一部分(因为项目太长)(正在使用 beamer):基本上它工作正常,但是当我想看到它们时却不行,我想把它们放在每个 pdf 的中间,我加入了一个图,这样就很容易看到问题了。
編輯 整个项目的链接
\PassOptionsToPackage{many}{tcolorbox}
\documentclass{bredelebeamer}
\setbeamertemplate{caption}[numbered]{}
\usepackage[absolute,overlay]{textpos}
%%%%%%%%%%%%%%%%
\usepackage{array,colortbl,xcolor}
\usepackage{array}
\usepackage{booktabs}
%\setbeamertemplate{caption}[numbered]
\numberwithin{figure}{section}
\usepackage[export]{adjustbox}
\setbeamercovered{dynamic}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\usetikzlibrary{fit}
\usetikzlibrary{backgrounds}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{mindmap}
\usetikzlibrary{decorations.text}
% tikzmark command, for shading over items
%\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts}
\usepackage{xparse}
\tikzset{
invisible/.style={opacity=0,text 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<> O{opacity=0.8,text opacity=1} m m}{%
\tikz[remember picture, overlay]\node[align=center, fill=cyan!20, text
width=2cm,
#2,visible on=<#1>, rounded corners,
draw,rectangle callout,anchor=pointer,callout relative pointer=
{(230:1cm)}]
at (#3) {#4};
}
\newcommand{\tikzmark}[1]{\tikz[overlay,remember
picture,baseline=-0.5ex] \node (#1) {};}
% standard enumeration
\setbeamertemplate{enumerate items}{(\arabic{enumi})}
% default itemize
\setbeamertemplate{itemize items}[circle]
% transparency
\setbeamercovered{transparent=15}
% for resuming lists across frames
\newcounter{savedenum}
\newcommand*{\saveenum}{\setcounter{savedenum}{\theenumi}}
\newcommand*{\resume}{\setcounter{enumi}{\thesavedenum}}
\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
},
}
\title[]{efijrj iejijdfikj ldlckd,dkf}
% Titre du diaporama
\subtitle{}
% Sous-titre optionnel
\author{Majikdid Mkks}
% La commande \inst{...} Permet d'afficher l' affiliation de
l'intervenant.
% Si il y a plusieurs intervenants: Marcel Dupont\inst{1}, Roger
Durand\inst{2}
% Il suffit alors d'ajouter un autre institut sur le modèle ci-dessous.
\institute[]
{
MASTER RECHERCHE\\
Gestion \\
}
\date{\today}
%\date{18 Brumaire 2015}
% Optionnel. La date, généralement celle du jour de la conférence
\subject{Sujet de votre diaporama}
% C'est utilisé dans les métadonnes du PDF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\section{IAL \& feature ordering}
\begin{frame}{Danhjhuiiu hhyhuui yhgyygtyt (1/2)}
\includegraphics[page=1,height=0.80\textheight,scale=0.90]
{images/file.pdf} \tikzmark{mf1}
\mycallout<1>[opacity=1,yshift=1cm]{mf1}{gvhh hhj: 2.929}
\includegraphics[page=1,height=0.90\textheight,scale=0.90]
{images/file1.pdf}\tikzmark{mf2}
\mycallout<1>[opacity=1]{mf2}{ddfb jjhg: 5}
\end{frame}
\begin{frame}{Danhjhuiiu hhyhuui yhgyygtyt(2/2)}
\includegraphics[page=1,height=0.90\textheight,scale=0.90]
{images/file3.pdf}\tikzmark{mf1}
\mycallout<1>[opacity=1]{mf1}{tftgt jjjb: 0.31}
\includegraphics[page=1,height=0.90\textheight,scale=0.90]
{images/file2.pdf}\tikzmark{mf2}
\mycallout<1>[opacity=1]{mf2} {fgh nhhjj: 1.457}
\end{frame}
\end{document}
答案1
如果将图像包含在TikZ
节点内,则可以将其用作标注节点的参考(带有remember picture
和选项)。overlay
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts, calc}
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}[remember picture, overlay]
\node (a) {\includegraphics[width=.75\linewidth]{example-image-a}};
\node<2->[ellipse callout, draw=blue, fill=blue!30] at ($(a.center)!.5!(a.north east)$) (b) {Hello!};
\end{tikzpicture}
\end{frame}
\end{document}
更新:回答mirette
评论。
您的代码是正确的,结果也是预期的。tikzmark
创建对其位置的引用,在您的情况下是在includegraphics
命令之后,并mycallout
根据此引用放置,在本例中,位于所包含图形的左下角下方。
提出的解决方案是tikzmark
用node
包含整个页面的 来替换,然后您可以使用页面上的任何位置来放置标注。
由于mycallout
命令已在tikzpicture
环境中定义,因此最好在包含页面定义的 tikzpicture 之外使用它。
columns
下面的代码展示了一个帧上有两幅图的例子。两幅图都使用 beamer环境进行分发。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts, calc}
\usepackage[most]{tcolorbox}
\tikzset{
invisible/.style={opacity=0,text 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<> O{opacity=0.8,text opacity=1} m m}{%
\tikz[remember picture, overlay]\node[align=center, fill=cyan!20, text
width=2cm,
#2,visible on=<#1>, rounded corners,
draw,rectangle callout,anchor=pointer,callout relative pointer=
{(230:1cm)}]
at (#3) {#4};
}
\begin{document}
\begin{frame}{Test callouts}
\begin{columns}[onlytextwidth]
\column{.5\linewidth}
\centering
\begin{tikzpicture}[remember picture, overlay]
\node (a) {\includegraphics[width=.85\linewidth, height=.7\textheight]{example-image-a}};
\end{tikzpicture}
\mycallout<1>[opacity=1,yshift=1cm]{a}{gvhh hhj: 2.929}
\column{.5\linewidth}
\centering
\begin{tikzpicture}[remember picture, overlay]
\node (b) {\includegraphics[width=.85\linewidth, height=.7\textheight]{example-image-b}};
\end{tikzpicture}
\mycallout<1>[opacity=1,yshift=1cm]{[shift={(-1cm,-2cm)}]b.center}{gvhh hhj: 2.929}
\end{columns}
\end{frame}
\end{document}