我正在尝试注释幻灯片中表格中的单个条目。我的问题是“tag”一词出现在正确的 y 位置,但其 x 位置却位于幻灯片的正中央。我尝试了xshift = ???
很多值,但它就是不动。我改编了 @Gonzalo Medina 的回答中箭头的代码,但我显然在集成中犯了一些基本错误,因此我不太明白我想要什么。再次澄清一下,我希望对“tag”一词有更多的控制权,以便它的位置更接近(在 x 轴上)单词“diverse”,因为它正在注释。此外,如果我可以将“tag”括在小括号中,我会很高兴tcolorbox
。谢谢!
我想补充一点,我最初有一个更精简的版本(仅包含我需要的软件包)这幻灯片)按预期工作;但是,当与我的演示文稿的其余部分(其中包含以下代码中的所有包)集成时,我得到了这个错误位置的错误。所以这是一些包交互错误。
\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%
}
%% start1
\begin{document}
\begin{frame}{Title}
\tikzset{rowhl/.style={
set fill color = white,
set border color = red,
above left offset={-0.01,0.37},
below right offset={0.1,-0.09},
},}
\begin{table}[htbp]
\centering
\resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally
\begin{tabular}{c c c c c c}
\toprule
\multicolumn{2}{c}{\textbf{Cost}} &
\multicolumn{1}{c}{\textbf{Team}} & \multicolumn{3}{c}{\textbf{Features}} \\
\cmidrule(lr){1-2}\cmidrule(lr){4-6}
\thead{\begin{tabular}{@{}c@{}}initial \\ cost \end{tabular}} & \thead{\begin{tabular}{@{}c@{}}secondary \\ cost \end{tabular}} & & \multicolumn{1}{c}{scale}
& \multicolumn{1}{c}{impact}
& \multicolumn{1}{c}{\thead{\begin{tabular}{@{}c@{}}diverse\tikzmark{B}\\ selection \end{tabular}}}\\
\midrule
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$y1$ & $y2$ & name 1 + name 2 & \checkmark & \checkmark & \checkmark\\
\tikzmarkin<2->[rowhl]{aa} $z1$ & $z2$ & name 1 + name 2 +name 3 + name 4 & \checkmark & \checkmark & \checkmark \tikzmarkend{aa} \\
$v1$ & $v2$ & name 5 + name 8 + name 9 & & \checkmark & \checkmark \\
$w1$ & $w2$ & name 1 + name 3 + name 5 & \checkmark & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
\bottomrule
\end{tabular}}
\begin{tikzpicture}[remember picture,overlay]
\node [right=5cm,above=6cm,minimum width=0pt] at (pic cs:b) (B) {tag};
\draw [<-,out=5,in=180] ([xshift=140pt, yshift=115pt]{pic cs:b}) to (B);
\end{tikzpicture}
\caption{teams and costs}
\label{MyTable}
\vspace{-4mm}
\end{table}
%%%%%%%%
\end{frame}
\end{document}
答案1
有两个问题。
- 您“从外部”重新缩放表格。这会破坏
tikz
/的节点定位机制tikzmark
。通常,当您在 上使用 或 之类的东西时,记住\resizebox
的坐标位置将会关闭。唯一可以想象的方法是将图片作为 的一部分。即使这样,也可以构造失败的情况,但在这里这是一种可能性。\scalebox
tikzpicture
remember picture
overlay
\resizebox
- 我也看不到名称的 tikz 标记
b
。但您可能\tikzmarknode
无论如何都想要一个。
\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} % gets loaded by beamer and tikz
%\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%
}
%% start1
\begin{document}
\begin{frame}{Title}
\tikzset{rowhl/.style={
set fill color = white,
set border color = red,
above left offset={-0.01,0.37},
below right offset={0.1,-0.09},
},}
\begin{table}[htbp]
\centering
\resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally
\begin{tabular}{c c c c c c}
\toprule
\multicolumn{2}{c}{\textbf{Cost}} &
\multicolumn{1}{c}{\textbf{Team}} & \multicolumn{3}{c}{\textbf{Features}} \\
\cmidrule(lr){1-2}\cmidrule(lr){4-6}
\thead{\begin{tabular}{@{}c@{}}initial \\ cost \end{tabular}} & \thead{\begin{tabular}{@{}c@{}}secondary \\ cost \end{tabular}} & & \multicolumn{1}{c}{scale}
& \multicolumn{1}{c}{impact}
& \multicolumn{1}{c}{\thead{\begin{tabular}{@{}c@{}}\tikzmarknode{b}{diverse}\\ selection \end{tabular}}}\\
\midrule
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$y1$ & $y2$ & name 1 + name 2 & \checkmark & \checkmark & \checkmark\\
\tikzmarkin<2->[rowhl]{aa} $z1$ & $z2$ & name 1 + name 2 +name 3 + name 4 & \checkmark & \checkmark & \checkmark \tikzmarkend{aa} \\
$v1$ & $v2$ & name 5 + name 8 + name 9 & & \checkmark & \checkmark \\
$w1$ & $w2$ & name 1 + name 3 + name 5 & \checkmark & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
\bottomrule
\end{tabular}
\begin{tikzpicture}[remember picture,overlay]
\node [right=0.5cm,above=2cm,minimum width=0pt] (B) at (b) {tag};
\draw [stealth-,out=5,in=180] (b) to (B);
\end{tikzpicture}}
\caption{teams and costs}
\label{MyTable}
\vspace{-4mm}
\end{table}
%%%%%%%%
\end{frame}
\end{document}
答案2
我非常喜欢薛定谔猫的答案,但我同时(第一次!)找到了另一个令我感到自豪的解决方案,因此我也会在这里发布我的解决方案。
below left
我通过使用相对于来改变了定义位置的方式current page.north east
。代码如下。
\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%
}
%% start1
\begin{document}
\begin{frame}{Title}
\tikzset{rowhl/.style={
set fill color = white,
set border color = red,
above left offset={-0.01,0.37},
below right offset={0.1,-0.09},
},}
\begin{table}[htbp]
\centering
\resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally
\begin{tabular}{c c c c c c}
\toprule
\multicolumn{2}{c}{\textbf{Cost}} &
\multicolumn{1}{c}{\textbf{Team}} & \multicolumn{3}{c}{\textbf{Features}} \\
\cmidrule(lr){1-2}\cmidrule(lr){4-6}
\thead{\begin{tabular}{@{}c@{}}initial \\ cost \end{tabular}} & \thead{\begin{tabular}{@{}c@{}}secondary \\ cost \end{tabular}} & & \multicolumn{1}{c}{scale}
& \multicolumn{1}{c}{impact}
& \multicolumn{1}{c}{\thead{\begin{tabular}{@{}c@{}}diverse\tikzmark{B}\\ selection \end{tabular}}}\\
\midrule
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$y1$ & $y2$ & name 1 + name 2 & \checkmark & \checkmark & \checkmark\\
\tikzmarkin<2->[rowhl]{aa} $z1$ & $z2$ & name 1 + name 2 +name 3 + name 4 & \checkmark & \checkmark & \checkmark \tikzmarkend{aa} \\
$v1$ & $v2$ & name 5 + name 8 + name 9 & & \checkmark & \checkmark \\
$w1$ & $w2$ & name 1 + name 3 + name 5 & \checkmark & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
$x1$ & $x2$ & name 1 + name 2 + name 3 & & \checkmark & \\
\bottomrule
\end{tabular}}
\begin{tikzpicture}[remember picture,overlay,
tabletag/.style = {
rounded corners,
draw = blue,
thick,
fill= white,
inner ysep=2pt,
inner xsep=1pt,
align = center
}]
\node at (pic cs:b) (B) [below left= 1 cm and 2 cm of current page.north east, style = tabletag] {tag};
\draw [<-,out=5,in=0] ([xshift=140pt, yshift=115pt]{pic cs:b}) to (B.east);
\end{tikzpicture}
\caption{teams and costs}
\label{MyTable}
\vspace{-4mm}
\end{table}
%%%%%%%%
\end{frame}
\end{document}