我想将beamersplit
和miniframes
主题结合起来。例如,我想让迷你框架出现在标题栏的右半部分(出现子部分的地方)。如果有任何子部分,我会将迷你框架放在子部分标题的下方或旁边。这是示例文档。
\documentclass[compress,aspectratio=43]{beamer}
\useoutertheme{miniframes}
\useoutertheme{split}
%\setbeamertemplate{headline}[miniframes theme]
\usecolortheme{whale}
\begin{document}
\section{First Section}
\frame{} \frame{} \frame{}
\section{Second Section}
\subsection{sub1}
\frame{} \frame{} \frame{}
\subsection{sub2}
\frame{} \frame{} \frame{}
\end{document}
我不会问这是否可能,因为使用 TeX 一切皆有可能,而是问是否有人可以帮助我:)
为了说明我的意思,以下是标题miniframes
:
这些是split
:
我想要类似这样的模型:
答案1
这似乎按我的预期工作。这有点儿不靠谱,而且只在compress
有选项的情况下才有效。
\documentclass[compress,aspectratio=43]{beamer}
\useoutertheme{miniframes}
\useoutertheme{split}
\usecolortheme{whale}
% For convenience, move this to a style or theme file
\makeatletter
\newcount\beamer@xoff
\newcount\beamer@prev@section
\newcount\beamer@prev@miniframes
\beamer@xoff=0
\beamer@prev@section=0
\beamer@prev@miniframes=0
\def\insertsubsectionnavigationhorizontalminiframes#1#2#3{%
\hbox to #1{{%
\usebeamerfont{subsection in head/foot}\usebeamercolor[fg]{subsection in head/foot}%
\beamer@currentsubsection=0%
\def\sectionentry##1##2##3##4##5{}%
\def\slideentry##1##2##3##4##5##6{%
\ifnum##1>\beamer@prev@section%
\beamer@xoff=##3\relax%
\beamer@prev@miniframes=0\relax%
\fi
\ifnum##6=\c@part\ifnum##1=\c@section%
\ifnum##2>\beamer@currentsubsection%
\beamer@xoff=0\relax%
\beamer@currentsubsection=##2%
\box\beamer@sectionbox\hskip1.875ex plus1fill%
\ifnum\beamer@prev@miniframes>0\relax%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by \beamer@prev@miniframes%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 2pt%
\ifnum##2>1%
\advance\beamer@tempdim by 1.875ex%
\else
\advance\beamer@tempdim by -\beamer@boxsize%
\fi
\else
\beamer@tempdim=0pt%
\fi
\setbox\beamer@sectionbox=
\hbox{\def\insertsubsectionhead{\kern\beamer@tempdim##5}%
\def\insertsectionheadnumber{##1}%
\def\insertsubsectionheadnumber{##2}%
\def\insertpartheadnumber{##6}%
\ifnum\c@subsection=##2%
\beamer@link(##4){{\usebeamertemplate{subsection in head/foot}}}\else%
\beamer@link(##4){{\usebeamertemplate{subsection in head/foot shaded}}}\fi}%
\ht\beamer@sectionbox=1.875ex%
\dp\beamer@sectionbox=0.75ex%
\else%
\beamer@prev@miniframes=##3%
\fi%
\setbox0=\hbox{\insertsectionhead\unskip}\ifdim\wd0>0pt\ifnum##3>0%
\beamer@xpos=##3\relax%
\advance\beamer@xpos by -\beamer@xoff%
\hbox to 0pt{%
\beamer@tempdim=0.5pt%
\raise\beamer@tempdim\hbox{%
\ifnum##2>0%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by -\beamer@boxsize%
\advance\beamer@tempdim by 2pt%
\advance\beamer@tempdim by \wd\beamer@sectionbox%
\else%
\beamer@tempdim=\beamer@boxsize%
\multiply\beamer@tempdim by\beamer@xpos%
\advance\beamer@tempdim by 1.875ex%
\fi%
\kern\beamer@tempdim\hbox{\beamer@link(##4){%
\usebeamerfont{mini frame}%
\ifnum\c@section=##1%
\ifnum\c@subsection=##2%
\usebeamercolor[fg]{mini frame}%
\ifnum\c@subsectionslide=##3%
\usebeamertemplate{mini frame}%
\else%
\usebeamertemplate{mini frame in current subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
\else%
\usebeamercolor{mini frame}%
\usebeamertemplate{mini frame in other subsection}%
\fi%
}}}\hskip-10cm plus 1fil%
}\fi\fi%
\else%
\fakeslideentry{##1}{##2}{##3}{##4}{##5}{##6}%
\fi\fi%
\beamer@prev@section=##1%
\ignorespaces}%
#2\hskip.3cm\setbox\beamer@sectionbox=\hbox{}%
\hskip-1.875ex plus-1fill\dohead%
\box\beamer@sectionbox\hfil\hskip.3cm%
#3}}}
\setbeamercolor{mini frame}{parent=subsection in head/foot}
\ifbeamer@compress
\defbeamertemplate*{headline}{split theme miniframes}
{%
\leavevmode%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{section in head/foot}%
\insertsectionnavigationhorizontal{.5\paperwidth}{\hskip0pt plus1filll}{}%
\end{beamercolorbox}%
\begin{beamercolorbox}[wd=.5\paperwidth,ht=2.5ex,dp=1.125ex]{subsection in head/foot}%
\insertsubsectionnavigationhorizontalminiframes{.5\paperwidth}{}{\hskip0pt plus1filll}%
\end{beamercolorbox}%
}
\else
\defbeamertemplatealias{headline}{split theme miniframes}{split theme}
\setbeamertemplate{headline}[split theme miniframes]
\fi
\makeatother
% This is to enable the feature
\setbeamertemplate{headline}[split theme miniframes]
\begin{document}
\frame{\titlepage}
\frame{\tableofcontents} % no miniframes in the front matter (good)
\section{First Section}
\frame{} \frame{} \frame{} % miniframes without subsections (good)
\section{Second Section}
\subsection{Subsection 1}
\frame{} \frame{}
\subsection{Subsection 2}
\frame{} \frame{} \frame{}
\section{Third Section} % correct miniframes with mixed sections/subsections
\frame{} \frame{} \frame{}
\subsection{Subsection 3}
\frame{} \frame{} \frame{}
\section*{} % no miniframes in back matter (good)
\frame{End}
\end{document}
答案2
有一个特殊主题可用于结合拆分和迷你框架外部主题,称为splitwithminiframes
。它可从http://mirrors.ctan.org/macros/latex/contrib/beamer-contrib/themes/beamerauxtheme/themes/beamerouterthemesplitwithminiframes.sty
警告:它不会识别该compress
选项
\documentclass[aspectratio=43]{beamer}
\useoutertheme{splitwithminiframes}
\usecolortheme{whale}
\begin{document}
\section{First Section}
\frame{} \frame{} \frame{}
\section{Second Section}
\subsection{sub1}
\frame{} \frame{} \frame{}
\subsection{sub2}
\frame{} \frame{} \frame{}
\end{document}