
私は onslide を使用して、さまざまな画像要素をグループ化し、スライドにいつ、どのくらいの時間表示されるかを制御しようとしています。同時に、pgfonlayer を使用して、一部の要素が他の要素の「下」に描画され、適切な遮蔽が確実に行われるようにしようとしています。
これらは完全に独立しているべきだと思いますが、要素を pgfonlayer 環境 (onslide 内) に配置すると、同じ pgf 背景レイヤー内のすべての項目が onslide<1-> と同等のものに配置されるようです。まるで pgfonlayer が onslide の効果をキャンセルしているかのようです。
より正確に言うと、次のようになります (これは問題のスケッチです。A、B、C、D は単なる文字ではなく、実際のグラフィックです)。
\onslide<1>{
B
\begin{pgfonlayer}{bg}
A % A should be occluded by B
\end{pgfonlayer}
}
\onslide<2>{
D
\begin{pgfonlayer}{bg}
C % C should be occluded by D
\end{pgfonlayer}
}
そして、A と C が常に表示される効果が得られます。
これを修正する簡単な方法はありますか? ご協力いただければ幸いです。
ありがとう、
アンブローズ
ps. 完全なソースコードの例は次のとおりです。
\documentclass[10pt]{beamer}
\title{onslide vs pgfonlayer}
\author[My Team]{My Name}
\date{\today}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{First using pgfonlayer only -- works.}
On this first slide the light colors are on top, even though they are
drawn before the darker colors. {\bf pgfonlayer} is used to achieve
this.
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}
\begin{figure}
\begin{tikzpicture}
\draw[fill=blue!10] (0,1) circle (1cm);
\begin{pgfonlayer}{bg}
\draw[fill=blue] (0,0) circle (1cm);
\end{pgfonlayer}
\draw[fill=red!10] (3,1) circle (1cm);
\begin{pgfonlayer}{bg}
\draw[fill=red] (3,0) circle (1cm);
\end{pgfonlayer}
\end{tikzpicture}
\end{figure}
\end{frame}
\begin{frame}[t]
\frametitle{Next, adding onslide -- fails.}
On this second slide I attempt to use {\bf onslide} to show only one
side at a time. First the blues then the reds.
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}
\begin{figure}
\begin{tikzpicture}
\onslide<1>{
\draw[fill=blue!10] (0,1) circle (1cm);
\begin{pgfonlayer}{bg}
\draw[fill=blue] (0,0) circle (1cm);
\end{pgfonlayer}
}
\onslide<2>{
\draw[fill=red!10] (3,1) circle (1cm);
\begin{pgfonlayer}{bg}
\draw[fill=red] (3,0) circle (1cm);
\end{pgfonlayer}
}
\end{tikzpicture}
\end{figure}
First we see light blue with both dark colors, ...\pause and then we
see light red with both dark colors. It seems that because I put the
darker colors into the bg layer, the onslide groupings I put around
each basic color do not work
\end{frame}
\end{document}
答え1
おっしゃる通りです。pgfonlayer
環境によって の効果は打ち消されます\onslide
。
回避策:
\documentclass[10pt]{beamer}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{pgfonlayer and onslide...}
\pgfdeclarelayer{bg}
\pgfsetlayers{bg,main}
\begin{figure}
\begin{tikzpicture}
\onslide<1>{
\draw[fill=blue!10] (0,1) circle (1cm);
\begin{pgfonlayer}{bg}
\onslide<1>{
\draw[fill=blue] (0,0) circle (1cm);
}
\end{pgfonlayer}
}
\onslide<2>{
\draw[fill=red!10] (3,1) circle (1cm);
\begin{pgfonlayer}{bg}
\onslide<2>{
\draw[fill=red] (3,0) circle (1cm);
}
\end{pgfonlayer}
}
\end{tikzpicture}
\end{figure}
\end{frame}
\end{document}
答え2
これは、 と TikZ が通信を誤っている例の 1 つだと思いますbeamer
。最も簡単な解決策は、レイヤーdraw
のコマンドに特定のオーバーレイ仕様を追加してbackground
、オーバーレイ仕様を にすることです\only
(私が間違っていなければ)。つまり、 とは異なり、そのスライドで発生した内容を削除するように意図的に指示されていることになります\onslide
。
このタスク専用にカスタマイズされた TikZ ライブラリの使用を強くお勧めしますbackgrounds
。TikZ の機能をすべて正確に把握しているわけではありませんが、背景だけに興味がある場合は、TikZ にレイヤー化を任せるのが最善です。
\documentclass[10pt]{beamer}
\title{onslide vs pgfonlayer}
\author[My Team]{My Name}
\date{\today}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{frame}[t]{First using pgfonlayer only -- works.}
On this first slide the light colors are on top, even though they are
drawn before the darker colors. \textbf{pgfonlayer} is used to achieve
this.
\begin{figure}
\begin{tikzpicture}
\draw[fill=blue!10] (0,1) circle (1cm);
\begin{scope}[on background layer]
\draw[fill=blue] (0,0) circle (1cm);
\end{scope}
\draw[fill=red!10] (3,1) circle (1cm);
\begin{scope}[on background layer]
\draw[fill=red] (3,0) circle (1cm);
\end{scope}
\end{tikzpicture}
\end{figure}
\end{frame}
\begin{frame}[t]{Next, adding onslide -- fails.}
On this second slide the light colors are on top, even though they are
drawn before the darker colors. \textbf{pgfonlayer} is used to achieve
this.
\begin{figure}
\begin{tikzpicture}
\onslide<1>{
\draw[fill=blue!10] (0,1) circle (1cm);
\begin{scope}[on background layer]
\draw<1>[fill=blue] (0,0) circle (1cm);
\end{scope}
}
\onslide<2>{
\draw[fill=red!10] (3,1) circle (1cm);
\begin{scope}[on background layer]
\draw<2>[fill=red] (3,0) circle (1cm);
\end{scope}
}
\end{tikzpicture}
\end{figure}
First \pause and second
\end{frame}
\end{document}
小さな詳細:\bf
非推奨です。\textbf
このような用途に使用してください。