我的beamer
演示文稿只有三个部分。目前它们在幻灯片上的间距相等,但我想压缩它们,以便它们均匀分布在标题的左侧。
现在它看起来像:
Section 1 ---------------------------- Section 2---------------------------Section 3
我希望它看起来像
Section 1-------Section 2-------Section 3
有没有办法自定义顶部导航栏的水平宽度?提前谢谢您!
\documentclass[compress]{beamer}
\useoutertheme[footline=authortitle,subsection=false]{miniframes}
\begin{document}
\section{Section 1}
\subsection{Subsection 1}
\frame{}\frame{}\frame{}
\subsection{Subsection 2}
\frame{}\frame{}
\section{Section 2}
\subsection{Subsection 1}
\frame{}\frame{}
\subsection{Subsection 2}
\frame{}\frame{}\frame{}
\section{Section 3}
\subsection{Subsection 1}
\frame{}\frame{}
\subsection{Subsection 2}
\frame{}\frame{}\frame{}
\end{document}
答案1
是的,这是可能的。下面我将介绍两个选项:第一个比较简单,带有排序代码,但取决于您给出导航栏所需的总宽度;第二个为您提供了更多的灵活性和自由度(因为您可以随意控制部分之间的分隔),但它需要更复杂的修改。
在此选项中,您可以重新定义
headline
模板,由外部主题实现miniframes
,因此\insertnavigation
不采用整个\paperwidth
;例如,使用0.5\paperwidth
(更改标有 的行中的此值以% Change here
满足您的需要):\documentclass[compress]{beamer} \useoutertheme[footline=authortitle,subsection=false]{miniframes} \makeatletter \defbeamertemplate*{headline}{myminiframes theme} {% \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head} \end{beamercolorbox} \begin{beamercolorbox}{section in head/foot} \vskip2pt\insertnavigation{.5\paperwidth}\vskip2pt % Change here \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} } \makeatother \begin{document} \section{Section 1} \subsection{Subsection 1} \frame{}\frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{} \section{Section 2} \subsection{Subsection 1} \frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{}\frame{} \section{Section 3} \subsection{Subsection 1} \frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{}\frame{} \end{document}
最终的标题是:
在此选项中,您需要重新定义一些 beamer 内部结构:
\sectionentry
和\insertnavigation
(原始定义在 中beamerbasenavigation.sty
)。通过更改\sectionsep
(默认为20pt
),您可以在导航栏中按所需方式分隔各部分:\documentclass[compress]{beamer} \useoutertheme[footline=authortitle,subsection=false]{miniframes} \newlength\sectionsep \setlength\sectionsep{20pt}% default 1.875ex plus 1fill \makeatletter \def\sectionentry#1#2#3#4#5{% section number, section title, page \ifnum#5=\c@part% \beamer@section@set@min@width \box\beamer@sectionbox\hskip\sectionsep%original: 1.875ex plus 1fill% \beamer@xpos=0\relax% \beamer@ypos=1\relax% \setbox\beamer@sectionbox= \hbox{\def\insertsectionhead{#2}% \def\insertsectionheadnumber{#1}% \def\insertpartheadnumber{#5}% {% \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}% \ifnum\c@section=#1% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}% \else% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}% \fi}% }% \ht\beamer@sectionbox=1.875ex% \dp\beamer@sectionbox=0.75ex% \fi\ignorespaces} \def\insertnavigation#1{% \vbox{{% \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}% \beamer@xpos=0\relax% \beamer@ypos=1\relax% \hbox to #1{\hskip.3cm\setbox\beamer@sectionbox=\hbox{\kern1sp}% \ht\beamer@sectionbox=1.875ex% \dp\beamer@sectionbox=0.75ex% \hskip-\sectionsep% original -1.875ex plus 1fill \global\beamer@section@min@dim\z@ \dohead%\hskip\sectionsep% \beamer@section@set@min@width \box\beamer@sectionbox\hfill\hfill %\hfill%\hskip.3cm }% }}} \makeatother \begin{document} \section{Section 1} \subsection{Subsection 1} \frame{}\frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{} \section{Section 2} \subsection{Subsection 1} \frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{}\frame{} \section{Section 3} \subsection{Subsection 1} \frame{}\frame{} \subsection{Subsection 2} \frame{}\frame{}\frame{} \end{document}
最终的标题是: