我需要根据概览图中突出显示的条目突出显示我的 Beamer 导航的特定条目。为此,我需要从之内框架环境。问题:当前解决方案需要手动调整对齐方式。这可以被认为是黑客行为。一个更干净的解决方案精确的非常感谢原始位置的对齐。提前感谢您的想法和建议!
\documentclass[t]{beamer}
\usetheme{Singapore}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\section{Section}
\subsection{Subsection}
\begin{frame}[c]
\frametitle{Title}
\framesubtitle{Subtitle}
%
\begin{beamerboxesrounded}[]{}
The intention is to redraw the navigation from \emph{within} the frame environment to e.\,g. allow highlights of specific sections. The problem: The current solution needs a manual adjustment of the alignment. What can be considered as hacky. A cleaner solution for the \emph{exact} alignment at the original position would be highly appreciated.
\end{beamerboxesrounded}
%
\begin{tikzpicture}[remember picture,overlay]%
{\node[anchor=north west,text width=\paperwidth] at ($(current page.north west) + (0ex,0ex)$) {%
\begin{beamercolorbox}[ignorebg,wd=\paperwidth]{section in head/foot}%
\usebeamerfont{headline}\insertnavigation{\paperwidth}%
\end{beamercolorbox}};}%
\end{tikzpicture}
%
\end{frame}
\end{document}
答案1
部分解决方案
下面的代码将手动间距减少到仅一维,但除非您使用某种技术(例如\tikzmark
实际记录导航栏的位置),否则调整垂直方向的间距似乎是必要的,因为原始导航栏不在框架的最顶部。
miniframe 主题中标题的原始定义是
\defbeamertemplate*{headline}{miniframes theme}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}{section in head/foot}
\vskip2pt\insertnavigation{\paperwidth}\vskip2pt
\end{beamercolorbox}%
\ifbeamer@theme@subsection%
\begin{beamercolorbox}[colsep=1.5pt]{middle separation line head}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
\usebeamerfont{subsection in head/foot}\insertsubsectionhead
\end{beamercolorbox}%
\fi%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line head}
\end{beamercolorbox}
}
如你所见,这个定义包括
- 手动间距,例如
\vskip2pt
- 框架顶部的分隔线和
- 颜色框的边距
这个空间必须以某种方式得到补偿。
\documentclass[t]{beamer}
\usetheme{Singapore}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{calc,positioning}
\begin{document}
\section{Section}
\subsection{Subsection}
\section{Section}
\subsection{Subsection}
\begin{frame}[c]
\frametitle{Title}
\framesubtitle{Subtitle}
%
\begin{beamerboxesrounded}[]{}
The intention is to redraw the navigation from \emph{within} the frame environment to e.\,g. allow highlights of specific sections. The problem: The current solution needs a manual adjustment of the alignment. What can be considered as hacky. A cleaner solution for the \emph{exact} alignment at the original position would be highly appreciated.
\end{beamerboxesrounded}
\begin{tikzpicture}[remember picture,overlay]%
{\node[text width=\paperwidth] at (current page.north) {%
\vskip13.25pt%
\usebeamerfont{headline}\insertnavigation{\paperwidth}%
};
}%
\end{tikzpicture}
\end{frame}
\end{document}