我試圖包含一個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 之外使用它。
以下程式碼顯示了一個框架上有兩個圖形的範例。兩個數字均已使用 Beamercolumns
環境進行分發。
\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}