我在投影仪幻灯片顶部使用导航栏。问题是圆圈不在中心。我如何才能让它们相对于部分标题居中?
我的代码是
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[demo]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shadows}
\usepackage[bars]{beamerthemetree}%Beamer theme v 2.2
\usepackage{beamerthemebars}
\usepackage{ifthen}
\usepackage{multimedia}
\mode<presentation>
\usepackage{ragged2e}
\usepackage{etoolbox}
\apptocmd{\frame}{\justifying}{}{}
\usepackage{multicol}
\addtobeamertemplate{block begin}{}{\justifying}
%Theme commands
\setbeamerfont{headline}{size=\footnotesize}
\setbeamerfont{section in head/foot}{size=\tiny}
%\setbeamersize{text margin left=10pt,text margin right=10pt}
\newcommand\Wider[2][3em]{%
\makebox[\linewidth][c]{%
\begin{minipage}{\dimexpr\textwidth+#1\relax}
\raggedright#2
\end{minipage}%
}%
}
\setbeamercovered{highly dynamic}
\usetheme{Ilmenau}% Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%{miniframes}%%Beamer Outer Theme-circles on top
\usefonttheme{serif}
\useinnertheme{circles} %rectangle bullet points instead of circle ones
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
\usefonttheme{professionalfonts}%math in english
%
\newcommand*\oldmacro{}%Pages at the bottom right corner
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\insertframenumber\,}
\newenvironment<>{varblock}[2][.9\textwidth]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
\beamertemplatenavigationsymbolsempty
\begin{document}
\section{Introduction}
\subsection{1.1}
\frame{Empty}
\subsection{1.2}
\frame{Empty}
\subsection{1.3}
\frame{Empty}
\subsection{1.4}
\frame{Empty}
\end{document}
我的输出是
答案1
不要认为这是一个答案,但我想给你一些东西来玩,以防你需要这样做现在。不幸的是,我本周没有时间研究它,但我可能可以帮你入门,因为我已经为我的母校以及我目前工作的公司创建了自定义 Beamer 主题。我与 tex.se 的其他人交谈过,他们对 Beamer 内部结构更熟悉。希望他们能尽快发布完整的答案。
我不会改变beamerouterthemedefault.sty
,如果你不想创建自己的主题(供重复使用),我会坚持使用它,etoolbox
因为你已经在使用它了。使用etoolbox
临时更改一些代码beamerbasenavigation.sty
将改变迷你框架的位置。作为证明,你可以将其添加到你的序言中(完整代码如下):
\makeatletter
\newlength{\random@spacing}
\newlength{\another@spacing}
\patchcmd{\slideentry}{
\multiply\beamer@tempdim by\beamer@xpos
\advance\beamer@tempdim by -\beamer@boxsize
\advance\beamer@tempdim by 1pt}{
\multiply\beamer@tempdim by\beamer@xpos
\advance\beamer@tempdim by -\beamer@boxsize
\advance\beamer@tempdim by 1pt
\setlength{\random@spacing}{22pt}
\divide\random@spacing by #1
\setlength{\another@spacing}{3pt}
\multiply\another@spacing by #1
\advance\random@spacing by \another@spacing
\advance\beamer@tempdim by \random@spacing}{}{}
\makeatother
应该产生这样的结果:
您可以看到,迷你框架已根据其所属部分移动了不同的量。显然,这只是您要寻找的答案的一部分,因为迷你框架的位置尚未与相应部分标题的长度相关联。请注意,\insertsectionhead
此处使用将使用当前幻灯片因此,对于所有小框架组来说,它将是相同的值,并且它们都将移动相同的量,而不管它们上方的标题的长度。
您可以调整和22pt
中的值来更改与不同部分标题相对应的迷你框架的位置。您可以更改数学运算,或者如果您迫切需要一次性解决方案,甚至可以插入条件/if 语句。\setlength{\random@spacing}{22pt}
3pt
\setlength{\another@spacing}{3pt}
这应该可以让您大致了解所涉及的内容,但希望我们能很快得到另一个答案,这应该适用于一般意义。您的示例与附加部分如下:
\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[demo]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,shadows}
\usepackage[bars]{beamerthemetree}%Beamer theme v 2.2
\usepackage{beamerthemebars}
\usepackage{ifthen}
\usepackage{multimedia}
\mode<presentation>
\usepackage{ragged2e}
\usepackage{etoolbox}
\apptocmd{\frame}{\justifying}{}{}
\usepackage{multicol}
\addtobeamertemplate{block begin}{}{\justifying}
%Theme commands
\setbeamerfont{headline}{size=\footnotesize}
\setbeamerfont{section in head/foot}{size=\tiny}
%\setbeamersize{text margin left=10pt,text margin right=10pt}
\newcommand\Wider[2][3em]{%
\makebox[\linewidth][c]{%
\begin{minipage}{\dimexpr\textwidth+#1\relax}
\raggedright#2
\end{minipage}%
}%
}
\setbeamercovered{highly dynamic}
\usetheme{Ilmenau}% Beamer theme v 3.0
\useoutertheme[subsection=true]{smoothbars}%{miniframes}%%Beamer Outer Theme-circles on top
%-----the only change to the code is here:
\makeatletter
\newlength{\random@spacing}
\newlength{\another@spacing}
\patchcmd{\slideentry}{
\multiply\beamer@tempdim by\beamer@xpos
\advance\beamer@tempdim by -\beamer@boxsize
\advance\beamer@tempdim by 1pt}{
\multiply\beamer@tempdim by\beamer@xpos
\advance\beamer@tempdim by -\beamer@boxsize
\advance\beamer@tempdim by 1pt
\setlength{\random@spacing}{22pt}
\divide\random@spacing by #1
\setlength{\another@spacing}{3pt}
\multiply\another@spacing by #1
\advance\random@spacing by \another@spacing
\advance\beamer@tempdim by \random@spacing}{}{}
\makeatother
%-----
\usefonttheme{serif}
\useinnertheme{circles} %rectangle bullet points instead of circle ones
\setbeamercolor{navigation symbols dimmed}{fg=red!80!black}
\setbeamercolor{navigation symbols}{fg=red!80!black}
\usefonttheme{professionalfonts}%math in english
%
\newcommand*\oldmacro{}%Pages at the bottom right corner
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\insertframenumber\,}
\newenvironment<>{varblock}[2][.9\textwidth]{%
\setlength{\textwidth}{#1}
\begin{actionenv}#3%
\def\insertblocktitle{#2}%
\par%
\usebeamertemplate{block begin}}
{\par%
\usebeamertemplate{block end}%
\end{actionenv}}
\beamertemplatenavigationsymbolsempty
\begin{document}
\section{Experimental Set-Up}
\subsection{1.1}
\frame{Empty}
\subsection{1.2}
\frame{Empty}
\subsection{1.3}
\frame{Empty}
\section{Analysis-How to}
\subsection{1.1}
\frame{Empty}
\subsection{1.2}
\frame{Empty}
\subsection{1.3}
\frame{Empty}
\subsection{1.4}
\frame{Empty}
\subsection{1.5}
\frame{Empty}
\section{Preliminary Results}
\subsection{1.1}
\frame{Empty}
\subsection{1.2}
\frame{Empty}
\subsection{1.3}
\frame{Empty}
\subsection{1.4}
\frame{Empty}
\section{Conclusion}
\end{document}
答案2
这似乎有效beamerouterthemedefault.sty
。我留给其他人来修改默认主题,因为我对 pgfplots 了解不多:
\newbox\secheadsize
\defbeamertemplate*{mini frame}{default}
{%
\setbox\secheadsize=\hbox{\usebeamerfont{section in head/foot}\insertsectionhead}
\begin{pgfpicture}{-.25\wd\secheadsize}{0pt}{0.1cm}{0.1cm}
\pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
\pgfusepath{fill,stroke}
\end{pgfpicture}%
}
[action]
{
\setbeamersize{mini frame size=0.14cm,mini frame offset=.03cm}
}
\defbeamertemplate*{mini frame in current section}{default}
{%
\begin{pgfpicture}{0pt}{0pt}{0.1cm}{0.1cm}
\pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
\pgfusepath{stroke}
\end{pgfpicture}%
}
\defbeamertemplate*{mini frame in current subsection}{default}
{%
\setbox\secheadsize=\hbox{\usebeamerfont{section in head/foot}\insertsectionhead}
\begin{pgfpicture}{-.25\wd\secheadsize}{0pt}{0.1cm}{0.1cm}
\pgfpathcircle{\pgfpoint{0.05cm}{0.05cm}}{0.05cm}
\pgfusepath{stroke}
\end{pgfpicture}%
}
您必须复制/修改beamerouterthemedefault.sty
并搜索\defbeamertemplate*{mini frame}{default}
,识别我更改的块并用我的代码替换它或手动插入坐标。