
저는 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가 항상 표시되는 효과를 얻습니다.
이 문제를 쉽게 해결할 수 있는 방법이 있나요? 어떤 도움이라도 대단히 감사하겠습니다.
감사해요,
암브로스
추신. 다음은 전체 소스 코드 예입니다.
\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와 잘못된 의사소통을 하는 사례 중 하나라고 생각합니다 beamer
. 가장 쉬운 해결책은 레이어 draw
의 명령 에 특정 오버레이 사양을 추가하여 background
오버레이 사양을 \only
(내가 착각한 것이 아니라면) 만드는 것입니다. 그래서 와는 달리 해당 슬라이드에서 일어난 일을 의도적으로 제거하도록 지시한 것입니다 \onslide
.
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
그러한 용도로 사용하십시오.