框架标题线和页脚线的长度相同

框架标题线和页脚线的长度相同

如何确保两条红线的长度相同?

我正在学习使用 beamer,我想修改一些东西。如图所示,即使我使用类似的代码,两条红线的长度也不相同:

在此处输入图片描述

\setbeamertemplate{frametitle}{
    \vskip0.3cm
    \usebeamerfont*{frametitle}\insertframetitle
    \vskip-1.5ex
    \begin{beamercolorbox}[colsep=0.75pt, wd=\textwidth]{lower separation line head}
    \end{beamercolorbox}
}


\setbeamertemplate{navigation symbols}{}% Remove navigation


\setbeamertemplate{footline}{
    \begin{beamercolorbox}[colsep=0.75pt, wd=\textwidth]{upper separation line foot}
    \end{beamercolorbox}
    \vskip0.3cm
}

完整代码如下

\documentclass{beamer}
\usepackage[utf8]{inputenc}

%\usepackage{utopia} %font utopia imported

%\usetheme{Madrid}
%\usecolortheme{default}

%------------------------------------------------------------
%This block of code defines the information to appear in the
%Title page
\title[About Beamer] %optional
{About the Beamer class in presentation making}

\subtitle{A short story}

\author[Arthur, Doe] % (optional)
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

\institute[VFU] % (optional)
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2014] % (optional)
{Very Large Conference, April 2014}

%\logo{\includegraphics[height=1.5cm]{lion-logo.jpg}}

%End of title page configuration block
%------------------------------------------------------------



%------------------------------------------------------------
%The next block of commands puts the table of contents at the 
%beginning of each section and highlights the current section:

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}
%------------------------------------------------------------

\setbeamercolor{lower separation line head}{bg=red}
\setbeamercolor{upper separation line foot}{bg=red}

\setbeamertemplate{frametitle}{
    \vskip0.3cm
    \usebeamerfont*{frametitle}\insertframetitle
    \vskip-1.5ex
    \begin{beamercolorbox}[colsep=0.75pt, wd=\textwidth]{lower separation line head}
    \end{beamercolorbox}
}


\setbeamertemplate{navigation symbols}{}% Remove navigation


\setbeamertemplate{footline}{
    \begin{beamercolorbox}[colsep=0.75pt, wd=\textwidth]{upper separation line foot}
    \end{beamercolorbox}
    \vskip0.3cm
}


\begin{document}

%The next statement creates the title page.
\frame{\titlepage}


%---------------------------------------------------------
%This block of code is for the table of contents after
%the title page
\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}
%---------------------------------------------------------


\section{First section}

%---------------------------------------------------------
%Changing visivility of the text
\begin{frame}
\frametitle{Sample frame title}
This is a text in second frame. For the sake of showing an example.

\begin{itemize}
    \item<1-> Text visible on slide 1
    \item<2-> Text visible on slide 2
    \item<3> Text visible on slides 3
    \item<4-> Text visible on slide 4
\end{itemize}
\end{frame}

%---------------------------------------------------------

\end{document}

答案1

脚注没有正常的文本边距,但您可以手动补偿这些长度:

\documentclass{beamer}
\usepackage[utf8]{inputenc}

%\usepackage{utopia} %font utopia imported

%\usetheme{Madrid}
%\usecolortheme{default}

%------------------------------------------------------------
%This block of code defines the information to appear in the
%Title page
\title[About Beamer] %optional
{About the Beamer class in presentation making}

\subtitle{A short story}

\author[Arthur, Doe] % (optional)
{A.~B.~Arthur\inst{1} \and J.~Doe\inst{2}}

\institute[VFU] % (optional)
{
  \inst{1}%
  Faculty of Physics\\
  Very Famous University
  \and
  \inst{2}%
  Faculty of Chemistry\\
  Very Famous University
}

\date[VLC 2014] % (optional)
{Very Large Conference, April 2014}

%\logo{\includegraphics[height=1.5cm]{lion-logo.jpg}}

%End of title page configuration block
%------------------------------------------------------------



%------------------------------------------------------------
%The next block of commands puts the table of contents at the 
%beginning of each section and highlights the current section:

\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}
%------------------------------------------------------------

\setbeamercolor{lower separation line head}{bg=red}
\setbeamercolor{upper separation line foot}{bg=red}

\setbeamertemplate{frametitle}{
    \vskip0.3cm
    \usebeamerfont*{frametitle}\insertframetitle
    \vskip-1.5ex
    \begin{beamercolorbox}[colsep=0.75pt, wd=\textwidth]{lower separation line head}
    \end{beamercolorbox}
}


\setbeamertemplate{navigation symbols}{}% Remove navigation


\setbeamertemplate{footline}{%
    \hspace*{1cm}%
    \begin{beamercolorbox}[colsep=0.75pt, wd=\dimexpr\textwidth-2cm\relax]{upper separation line foot}
    \end{beamercolorbox}
    \vskip0.3cm
}


\begin{document}

%The next statement creates the title page.
\frame{\titlepage}


%---------------------------------------------------------
%This block of code is for the table of contents after
%the title page
\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}
%---------------------------------------------------------


\section{First section}

%---------------------------------------------------------
%Changing visivility of the text
\begin{frame}
\frametitle{Sample frame title}
This is a text in second frame. For the sake of showing an example.

\begin{itemize}
    \item<1-> Text visible on slide 1
    \item<2-> Text visible on slide 2
    \item<3> Text visible on slides 3
    \item<4-> Text visible on slide 4
\end{itemize}
\end{frame}

%---------------------------------------------------------

\end{document}

在此处输入图片描述

相关内容