\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[dvipsnames]{article}
\usepackage[skins]{tcolorbox}
\usepackage{animate}
\providecommand{\actiontext}{Attention}
\newtcolorbox{achtungbox}[1][]{%
enhanced,
colframe=white,
natural height,
colback=black!10,
coltitle=black,
fonttitle=\bfseries\large,
boxrule=0.3mm,arc=0mm,boxsep=0pt,left=2mm,width=\linewidth,
leftrule=13mm,
title={\small{\actiontext}},
attach title to upper={\par\smallskip},
underlay={
\node[inner sep=0pt] (logo) at ([xshift=6mm,yshift=-6mm]frame.north west) {\ifpdf\includegraphics[width=10mm]{warning}\fi};
},
#1
}
\providecommand{\achtung}[1]{
\begin{achtungbox}
#1
\end{achtungbox}
}
\begin{document}
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{AAA}
% \newpage
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{I would expect the same figure in both animates at the start, but it does not. Sure, this is not the real case, but timeline options enables me to start animatens from different frames, this is currently impossible, seems to me. timeline option is not used here..., wanted to show a special animation at the intro of lectorenotes and later at the chapter.}
\end{document}
在我看来,我能够非常成功地捕捉虫子......
我希望在动画开始之前看到相同的图形。
下载warning.pdf
并pdstestg-pics.pdf
https://www.dropbox.com/sh/5y5rgralnw1pj8h/AABxTyDrCDUqo80ZtRF_rVTba?dl=0
答案1
图形文件的包含似乎令人不安animate
——但是,如果将图形文件放入一个盒子中,整个编译就会运行,并显示所需的功能。
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[dvipsnames]{article}
\usepackage[most]{tcolorbox}
\usepackage{animate}
\newsavebox{\mybox}
\savebox{\mybox}{\includegraphics[width=10mm]{warning}}
\providecommand{\actiontext}{Attention}
\newtcolorbox{achtungbox}[1][]{%
enhanced,
colframe=white,
natural height,
colback=black!10,
coltitle=black,
fonttitle=\bfseries\large,
boxrule=0.3mm,arc=0mm,boxsep=0pt,left=2mm,width=\linewidth,
leftrule=13mm,
title={\small{\actiontext}},
attach title to upper={\par\smallskip},
underlay={
\node[inner sep=0pt] (logo) at ([xshift=6mm,yshift=-6mm]frame.north west) {%
\ifpdf
\usebox{\mybox}%
\fi
};
},
#1
}
\providecommand{\achtung}[1]{
\begin{achtungbox}
#1
\end{achtungbox}
}
\begin{document}
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{AAA}
% \newpage
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{I would expect the same figure in both animates at the start, but it does not. Sure, this is not the real case, but timeline options enables me to start animatens from different frames, this is currently impossible, seems to me. timeline option is not used here..., wanted to show a special animation at the intro of lectorenotes and later at the chapter.}
\end{document}
答案2
基于上述解决方案,我改进了这个解决方案以供使用,包括 storebox。
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[dvipsnames]{article}
\usepackage[skins]{tcolorbox}
\usepackage{animate}
% \usepackage{storebox}
% \AtBeginDocument{{}} % see [2]
\providecommand{\newstorebox}[1]{\newsavebox{#1}} % <- fallback is no storebox is used
\providecommand{\storebox}[1]{\savebox{#1}} % <- fallback is no storebox is used
\providecommand{\usestorebox}[1]{\usebox{#1}} % <- fallback is no storebox is used
\newstorebox{\myboxgnA}
\AfterEndPreamble{%
\storebox{\myboxgnA}{\includegraphics[width=10mm]{warning}}
} % see [1]
\providecommand{\actiontext}{Attention}
\newtcolorbox{achtungbox}[1][]{%
enhanced,
colframe=white,
natural height,
colback=black!10,
coltitle=black,
fonttitle=\bfseries\large,
boxrule=0.3mm,arc=0mm,boxsep=0pt,left=2mm,width=\linewidth,
leftrule=13mm,
title={\small{\actiontext}},
attach title to upper={\par\smallskip},
underlay={
\node[inner sep=0pt] (logo) at ([xshift=6mm,yshift=-6mm]frame.north west) {\ifpdf\usestorebox{\myboxgnA}\fi};
},
#1
}
\providecommand{\achtung}[1]{
\begin{achtungbox}
#1
\end{achtungbox}
}
\begin{document}
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{AAA}
% \newpage
\animategraphics[trim=4.75cm 17cm 3.5cm 4.0cm, poster=last,autoplay=false,autoresume=true,autopause=true,loop=false,controls=true,scale=0.75]{8}{pdstestg-pics}{}{}
\achtung{I would expect the same figure in both animates at the start, but it does not. Sure, this is not the real case, but timeline options enables me to start animatens from different frames, this is currently impossible, seems to me. timeline option is not used here..., wanted to show a special animation at the intro of lectorenotes and later at the chapter.}
\end{document}
现在可以使用 storebox,但您不必这样做。
参考文献为:
[1]storebox 在 begin{document} 之前无法像普通 savebox 那样工作(感谢 egreg)
[2]tikz 与 storebox 结合时出现的问题:缺少数字,视为零。使用动画时,页面输出文本“graphicx”,(感谢 egreg)
如果没有 egreg,就不可能为 TeX.SE 提供这个解决方案。