我使用Matthias Vogelgesang 的新 LaTeXbeamer
主题(请参阅mtheme
http://bloerg.net/2014/09/20/a-modern-beamer-theme.html)。
由于某些章节的标题较长,我尝试分解标题,\newline
但这似乎是不可能的。
有人知道有办法打破这个主题中的章节标题吗?
答案1
这里的问题是,章节标题包含在 TikZ 中,\node
而 TikZ 中没有规定文本跨越多行。这个问题可以通过多种方式轻松解决,也许更简单的方法是text width=<length>
向节点添加一个选项,如以下简单示例所示:
\documentclass[10pt, compress]{beamer}
\usetheme{m}
\makeatletter
\def\progressbar@sectionprogressbar{%
{\usebeamercolor{palette primary}%
\progressbar@tmpcounta=\insertframenumber
\progressbar@tmpcountb=\inserttotalframenumber
\progressbar@tmpdim=\progressbar@pbwd
\divide\progressbar@tmpdim by 100
\multiply\progressbar@tmpdim by \progressbar@tmpcounta
\divide\progressbar@tmpdim by \progressbar@tmpcountb
\multiply\progressbar@tmpdim by 100
\makebox[\textwidth][c]{
\begin{tikzpicture}[tight background]
\node[anchor=west, fg, inner sep=0pt,text width=\linewidth] at (0pt, 0pt) {\insertsectionHEAD};
\draw[anchor=west, fg!20, fill=fg!20, inner sep=0pt]
(2pt, -16pt) rectangle ++ (\progressbar@pbwd, \progressbar@pbht);
\draw[anchor=west, fg, fill=fg, inner sep=0pt]
(2pt, -16pt) rectangle ++ (\progressbar@tmpdim, \progressbar@pbht);
\end{tikzpicture}%
}
} % end usebeamercolor{palette primary}
}
\makeatother
\begin{document}
\section{Elements and some other longer text so the title spans several lines}
\begin{frame}
test
\end{frame}
\end{document}
的原始定义\progressbar@sectionprogressbar
是
\node[anchor=west, fg, inner sep=0pt] at (0pt, 0pt) {\insertsectionHEAD};
我的例子中的修改版本是
\node[anchor=west, fg, inner sep=0pt,text width=\linewidth] at (0pt, 0pt) {\insertsectionHEAD};
带有章节标题的结果框架(请注意,现在允许并自动换行):