我希望我的幻灯片中包含以下内容:一些数学运算,在它下面是两个圆圈的图表,理想情况下,我希望有一个箭头从<=
下面显示的数学符号指向左侧的圆圈,箭头上有一个标签;另一个箭头从>=
数学符号指向右侧的圆圈,箭头上也有一个标签。
到目前为止,我尝试了一种更简单的做法,即只用一个箭头指向圆圈,并附上标签。但是,圆圈向右移动得太远,以至于第二个圆圈根本看不见。任何帮助都将不胜感激!
\documentclass{beamer}
\mode<presentation>
{
\usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{rose} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
%\usepackage[TS1,T1]{fontenc}
\usepackage[T1]{fontenc}
\usepackage{verbatim}
%\usepackage[dvipsnames]{xcolor}
%% packages I am adding
%\usepackage{colortbl}
\usepackage[customcolors,beamer]{hf-tikz} %for beautiful inline highlighted math. Thanks Claudio!
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{tikzmark, calc,decorations.pathmorphing,decorations.pathreplacing, patterns}
\usetikzlibrary{arrows.meta, positioning, quotes}
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{matrix,overlay-beamer-styles}
\usepackage{amsmath}
\usetikzlibrary{fit,tikzmark}
\usepackage{skull}
\usepackage{nccmath} %for \medmath command to fit long eqns in tcolorbox
\usepackage[skins]{tcolorbox}
\tcbuselibrary{theorems}
\usepackage{makecell} %for the thead command to break up header
\usepackage{array, booktabs, longtable}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
%\tikzstyle{every picture}+=[remember picture, overlay]
\usetikzlibrary{overlay-beamer-styles}
\usepackage[absolute,overlay]{textpos}
\AtBeginSection[]{
\begin{frame}
\vfill
\centering
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
\usebeamerfont{title}\insertsectionhead\par%
\end{beamercolorbox}
\vfill
\end{frame}
}
\newcommand\fiteq[1]{%
\sbox{\mybox}{$\displaystyle#1$}%
\ifdim\wd\mybox>.85\textwidth\resizebox{.85\textwidth}{!}{\usebox{\mybox}}%
\else\usebox{\mybox}\fi%
}
\newtcbtheorem[]{mydef}{Problem Statement}{colframe=white, colback=white}{ps}
\resetcounteronoverlays{tcb@cnt@mydef}
%% start1
\begin{document}
\begin{frame}[t]{title}
\begin{mydef}{}{probStatement}
Here is some math
\begin{equation*}
\tcboxmath[colframe=red, colback=white, left = 0.5 mm, right=0.5 mm, top = 0.35mm, bottom = 0.35mm]
{f(x) = ??, g(x) \leq P(x), h(x) \geq ???}
\end{equation*}
\end{mydef}
\begin{tikzpicture}[
packnode/.style = {
rounded corners,
draw = green,
thick,
fill= white,
inner ysep=2pt,
inner xsep=1pt,
align = center
},
packcircle/.style={
circle,
minimum size = 120pt,
draw = black,
thick,
dashed}]
\coordinate (c) at (2.2, 7);
\node(bigcircle) at (c) [style=packcircle, visible on=<5->]{};
\coordinate (cCovering) at (8.5, 7);
\draw[black, thick, visible on=<6->](cCovering) circle (45 pt);
\node [above, left = of bigcircle, xshift = - 3cm, minimum width=0pt, style = packnode, visible on = <6->] (mypacknode) {label \\ this};
\draw [stealth-,out=250,in=150, visible on = <6->] (bigcircle) to (mypacknode.north west);%%%%%%
\end{tikzpicture}
\end{frame}
\end{document}
答案1
您只能看到一个标签的原因是您在左圆圈的最左边有一个额外的节点,因此并非所有内容都适合一页。所以我减少了一些距离。至于指向不等号的箭头,这是 的工作tikzmark
。
\documentclass{beamer}
\mode<presentation>
{
\usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{rose} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
%\usepackage[TS1,T1]{fontenc}
\usepackage[T1]{fontenc}
\usepackage{verbatim}
%\usepackage[dvipsnames]{xcolor}
%% packages I am adding
%\usepackage{colortbl}
\usepackage[customcolors,beamer]{hf-tikz} %for beautiful inline highlighted math. Thanks Claudio!
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{arrows.meta, positioning, quotes}
\usetikzlibrary{overlay-beamer-styles}
\usepackage{amsmath}
\usepackage{nccmath} %for \medmath command to fit long eqns in tcolorbox
\usepackage[skins]{tcolorbox}
\tcbuselibrary{theorems}
\usepackage{makecell} %for the thead command to break up header
\usepackage{array, booktabs, longtable}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
%\tikzstyle{every picture}+=[remember picture, overlay]
\usetikzlibrary{overlay-beamer-styles}
\usepackage[absolute,overlay]{textpos}
\AtBeginSection[]{
\begin{frame}
\vfill
\centering
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
\usebeamerfont{title}\insertsectionhead\par%
\end{beamercolorbox}
\vfill
\end{frame}
}
\newcommand\fiteq[1]{%
\sbox{\mybox}{$\displaystyle#1$}%
\ifdim\wd\mybox>.85\textwidth\resizebox{.85\textwidth}{!}{\usebox{\mybox}}%
\else\usebox{\mybox}\fi%
}
\newtcbtheorem[]{mydef}{Problem Statement}{colframe=white, colback=white}{ps}
\resetcounteronoverlays{tcb@cnt@mydef}
%% start1
\begin{document}
\begin{frame}[t]{title}
\begin{mydef}{}{probStatement}
Here is some math
\begin{equation*}
\tcboxmath[colframe=red, colback=white, left = 0.5 mm, right=0.5 mm, top = 0.35mm, bottom = 0.35mm]
{f(x) = ??, g(x) \tikzmarknode{leq}{\leq} P(x)\;,\quad
h(x) \tikzmarknode{geq}{\geq} ???}
\end{equation*}
\end{mydef}
\begin{tikzpicture}[remember picture,
packnode/.style = {
rounded corners,
draw = green,
thick,
fill= white,
inner ysep=2pt,
inner xsep=1pt,
align = center
},
packcircle/.style={
circle,
minimum size = 120pt,
draw = black,
thick,
dashed}]
\coordinate (c);
\begin{scope}[visible on=<5->]
\node(bigcircle) at (c) [style=packcircle]{};
\draw[stealth-,overlay] (bigcircle) to[out=120,in=-90]
node[pos=0.2,left]{$\lambda_1$}(leq);
\end{scope}
%
\begin{scope}[visible on=<6->]
\node[black, thick,circle,inner sep=0pt,draw,
minimum size=45pt,right=2em of bigcircle](cCovering){};
\draw[stealth-,overlay] (cCovering) to[out=45,in=-90]
node[midway,above]{$\lambda_2$} (geq);
\node [above, left=2em of bigcircle, minimum width=0pt, style =
packnode, visible on = <6->] (mypacknode) {label \\ this};
\draw [stealth-,out=250,in=150, visible on = <6->,looseness=1.5] (bigcircle)
to (mypacknode.north west);%%%%%%
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}
另一个版本中,圆圈关于页面中心对称。也就是说,连接圆圈的最短线的中点水平位于页面中间。
\documentclass{beamer}
\mode<presentation>
{
\usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
\usecolortheme{rose} % or try albatross, beaver, crane, ...
\usefonttheme{default} % or try serif, structurebold, ...
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
%\usepackage[TS1,T1]{fontenc}
\usepackage[T1]{fontenc}
\usepackage{verbatim}
%\usepackage[dvipsnames]{xcolor}
%% packages I am adding
%\usepackage{colortbl}
\usepackage[customcolors,beamer]{hf-tikz} %for beautiful inline highlighted math. Thanks Claudio!
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{arrows.meta, positioning, quotes}
\usetikzlibrary{overlay-beamer-styles}
\usepackage{amsmath}
\usepackage{nccmath} %for \medmath command to fit long eqns in tcolorbox
\usepackage[skins]{tcolorbox}
\tcbuselibrary{theorems}
\usepackage{makecell} %for the thead command to break up header
\usepackage{array, booktabs, longtable}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}
%\tikzstyle{every picture}+=[remember picture, overlay]
\usetikzlibrary{overlay-beamer-styles}
\usepackage[absolute,overlay]{textpos}
\AtBeginSection[]{
\begin{frame}
\vfill
\centering
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
\usebeamerfont{title}\insertsectionhead\par%
\end{beamercolorbox}
\vfill
\end{frame}
}
\newcommand\fiteq[1]{%
\sbox{\mybox}{$\displaystyle#1$}%
\ifdim\wd\mybox>.85\textwidth\resizebox{.85\textwidth}{!}{\usebox{\mybox}}%
\else\usebox{\mybox}\fi%
}
\newtcbtheorem[]{mydef}{Problem Statement}{colframe=white, colback=white}{ps}
\resetcounteronoverlays{tcb@cnt@mydef}
%% start1
\begin{document}
\begin{frame}[t]{title}
\begin{mydef}{}{probStatement}
Here is some math
\begin{equation*}
\tcboxmath[colframe=red, colback=white, left = 0.5 mm, right=0.5 mm, top = 0.35mm, bottom = 0.35mm]
{f(x) = ??, g(x) \tikzmarknode{leq}{\leq} P(x)\;,\quad
h(x) \tikzmarknode{geq}{\geq} ???}
\end{equation*}
\end{mydef}
\begin{tikzpicture}[overlay,remember picture,
packnode/.style = {
rounded corners,
draw = green,
thick,
fill= white,
inner ysep=2pt,
inner xsep=1pt,
align = center
},
packcircle/.style={
circle,
minimum size = 120pt,
draw = black,
thick,
dashed}]
\begin{scope}[visible on=<5->]
\node[style=packcircle,left=1em of current page.center,
yshift=-4em](bigcircle) {};
\draw[stealth-] (bigcircle) to[out=120,in=-90]
node[pos=0.2,above]{$\lambda_1$}(leq);
\end{scope}
%
\begin{scope}[visible on=<6->]
\node[black, thick,circle,inner sep=0pt,draw,
minimum size=45pt,right=2em of bigcircle](cCovering){};
\draw[stealth-] (cCovering) to[out=45,in=-90]
node[midway,right]{$\lambda_2$} (geq);
\node [above, left=3em of bigcircle.240, minimum width=0pt, style =
packnode, visible on = <6->] (mypacknode) {label \\ this};
\draw [stealth-, visible on = <6->] (bigcircle)
to[out=-100,in=-40,looseness=1.5] (mypacknode.-45);%%%%%%
\end{scope}
\end{tikzpicture}
\end{frame}
\end{document}