如何删除下图所示的边距?标题没有任何定义(我只定义了页脚)。框架标题的所有定义选项是:
\setbeamerfont{frametitle}{size={\large}}
\setbeamerfont{framesubtitle}{size={\footnotesize}}
梅威瑟:
\documentclass[10pt]{beamer}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{english}
\setmainfont{CMU Serif}
\DeclareMathOperator*{\argminB}{argmax}
\setbeamersize{text margin left=10pt, text margin right=5pt}
\usefonttheme{professionalfonts}
\setbeamerfont{frametitle}{size={\large}}
\setbeamerfont{framesubtitle}{size={\footnotesize}}
\setbeamerfont{block title}{size=\small}
%spacing between lines
\usepackage{setspace}
%remove navigation symbols
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{frametitle continuation}{}
%new colors
\definecolor{back}{rgb}{0.98, 0.98,0.98 }
\definecolor{2green}{rgb}{0, 0.16, 0.26}
\definecolor{anti-flashwhite}{rgb}{0.95, 0.95, 0.96}
\definecolor{green-for-code}{rgb}{0, 0.6, 0}
\usepackage{multirow}
%defining colors of elements
\setbeamercolor{frametitle}{fg=white, bg=2green}
\setbeamercolor{section in toc}{fg=2green}
\setbeamercolor{title}{fg=2green}
\setbeamercolor{enumerate item}{fg=2green}
\setbeamercolor{enumerate subitem}{fg=2green}
\setbeamercolor{itemize item}{fg=2green}
\setbeamercolor{itemize subitem}{fg=2green}
\setbeamercolor{description item}{fg=2green}
\setbeamercolor{block title}{fg = white, bg = 2green!60}
\setbeamercolor{block body}{fg = black, bg = anti-flashwhite}
\setbeamercolor{caption name}{fg=2green}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
%templates for elements
\defbeamertemplate{description item}{align left}{\insertdescriptionitem \hfill}
\setbeamertemplate{description item}[align left]
\setbeamertemplate{enumerate item}{\textbf{\theenumi}.}
%defining the footline
\setbeamertemplate{footline}
{
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=0.9\paperwidth,ht=10ex,dp=1ex,right] {subsection in head/foot}%
\color{2green}{\insertsection} \hspace*{0ex}
\end{beamercolorbox}
}%
\hbox{%
\begin{beamercolorbox}[wd=0.1\paperwidth,ht=10ex,dp=1ex,right] {subsection in head/foot}%
\color{2green}{\insertframenumber{}} / \inserttotalframenumber \hspace*{5ex}
\end{beamercolorbox}
}%
\vskip0pt%
}
\title{Title}
\subtitle{subTitle}
\author{}
\date{}
\begin{document}
%---------------------------%
{
\setbeamertemplate{footline}{}
\begin{frame}
\titlepage
\end{frame}
}
\section{Sectio}
\subsection{subsection}
%---------------------------%
\begin{frame}[fragile]{\insertsubsection}
\begin{block}{}
Text
\end{block}
\begin{itemize}
\item item1
\item item1
\end{itemize}
\end{frame}
%---------------------------%
\end{document}
答案1
问题在于单位pt
不是固定长度,而是取决于当前字体大小。这意味着如果 frametitle 考虑了边距,则此边距的大小与计算 frametitle 在框架上的位置时的大小不同。
为了避免这个问题,请使用固定单位来定义你的边距,例如cm
。
\documentclass{beamer}
\setbeamersize{text margin left=0.3cm, text margin right=0.3cm}
\setbeamercolor{frametitle}{fg=white, bg=black}
\begin{document}
\begin{frame}{Test}
text
\end{frame}
\end{document}