如何将tikzpicture
元素的字体颜色更改为特定的值beamercolor
,例如block title
?——例如:
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame{
\begin{tikzpicture}
\draw (0, 5) node (n1) [text=block title] {I should be the same color as block text.};
\draw (0, 0) node (n2) {I should be plain black text.};
\path (n1) edge (n2);
\end{tikzpicture}
}
\end{document}
答案1
您可以使用。这里font={\usebeamercolor[fg]{block title}}
使用的原因据我所知,它本质上插入了一个,因此您不能直接将其用作颜色名称。font
\usebeamercolor
\color{<color name>}
\documentclass{beamer}
\usepackage{tikz}
\begin{document}
\frame{
\begin{tikzpicture}
\draw (0, 5) node (n1) [font={\usebeamercolor[fg]{block title}}] {I should be the same color as block text.};
\draw (0, 0) node (n2) {I should be plain black text.};
\path (n1) edge (n2);
\end{tikzpicture}
}
\end{document}