与其他词不一致的词

与其他词不一致的词

我该如何修复以下代码中与其余单词不一致的“单词”?

\documentclass[10pt,xcolor={dvipsnames,table}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}


\mode<presentation>
{
  %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
  \setbeamercovered{transparent}
  \usefonttheme{serif}
  \usecolortheme{crane}
}

\usepackage{tikz}

\setbeamercovered{dynamic}

\setbeamertemplate{items}[circle]


\begin{document}

\begin{frame}
Consider the equation
\begin{equation*}
A = B \hspace*{0.5cm} \tikz[baseline,remember picture]{
\node[fill=blue!20,opacity=.6,anchor=base,align=center,font=\color{blue}\tiny] (t1) {My Theorem (...)};
}
\end{equation*}
This \tikz[remember picture, baseline=-.5ex] \node (n1) {word}; is a little misplaced.
\begin{tikzpicture}[overlay,remember picture]
    \draw<1->[->,blue,opacity=.6] (n1) -- (t1);
\end{tikzpicture} 

\end{frame}

\end{document}

答案1

随着baseline=-.5ex你移动 tikzpicture 的基线。这也会移动节点内的单词。

正如之前所说:查看tikzmark库或hf-tikz包,而不是手动摆弄基线和对齐。这样你就不会遇到这样的问题。

\documentclass[10pt,xcolor={dvipsnames,table}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}


\mode<presentation>
{
  %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]
  \setbeamercovered{transparent}
  \usefonttheme{serif}
  \usecolortheme{crane}
}

\usepackage{tikz}

\setbeamercovered{dynamic}

\setbeamertemplate{items}[circle]

\usetikzlibrary{tikzmark}


\begin{document}

\begin{frame}
Consider the equation
\begin{equation*}
A = B \hspace*{0.5cm} \tikz[baseline,remember picture]{
\node[fill=blue!20,opacity=.6,anchor=base,align=center,font=\color{blue}\tiny] (t1) {My Theorem (...)};
}
\end{equation*}
This  \tikzmarknode{n1}{word} is a little misplaced.
\begin{tikzpicture}[overlay,remember picture]
    \draw<1->[->,blue,opacity=.6] (n1.north) -- (t1);
\end{tikzpicture} 

\end{frame}

\end{document}

在此处输入图片描述

相关内容