在 Beamer 中向标题页添加背景图像时,作者和机构不显示

在 Beamer 中向标题页添加背景图像时,作者和机构不显示

我正在尝试将背景图像添加到 Beamer Talk 的标题页。我尝试使用此处提供的解决方案仅使用 Beamer 在标题页上创建背景图像。但是我遇到了一些我不明白的问题。这是我的 MWE。

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{libertine} % or any other font package (or none)
\newcommand*\quotefont{\fontfamily{LinuxLibertineT-TLF}} % selects Libertine for quote font
\usepackage{tikz}
\usefonttheme[onlylarge]{structurebold}
\setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
\setbeamertemplate{navigation symbols}{}

\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}

\pgfdeclareimage[width=\paperwidth]{mybackground}{bigdata410}

\setbeamertemplate{title page}{   
        \begin{picture}(0,0) 
            \put(-30,-163){%
                \pgfuseimage{mybackground}
            } 
            \put(0,-110.7){%
                \begin{minipage}[b][45mm][t]{226mm}
                    \usebeamerfont{title}{\inserttitle\par}
                \end{minipage}
            }  
            \end{picture}
    } 
\title{Lost in data}
\author[Author et al.\@]{Author}
\institute{University of }
\date{}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}
\end{document}

我的问题是

  • 标题未居中
  • 标题页上未显示作者和机构
  • 如果我注释掉 libertine 字体行,我会得到

    LaTeX 字体警告:字体形状“T1/cmss/m/n”的大小 <4> 不可用(字体)大小 <5> 在输入行 44 上替换。

    (我似乎可以使用 \usepackage{lmodern} 解决最后一个问题,但我不确定我是否喜欢该字体。)

非常感谢您的帮助。

答案1

如果您想要做的只是在标题页的背景中添加图像,那么链接答案中描述的方法并不是最合适的方法,因为设置模板title page需要设置模板的所有元素及其属性(这是您的问题的一部分(见下文))。

更方便的方法是在本地(组内)设置模板background canvas

\documentclass{beamer}

\setbeamercolor{background canvas}{bg=black}
\setbeamercolor{normal text}{fg=white}
\setbeamercolor{title}{fg=white}

\title{The title}
\author{The Author}
\institute{The Institute}

\begin{document}

\begingroup
\setbeamertemplate{background canvas}{%
\includegraphics[width=\paperwidth,height=\paperheight]{mushrooms}}
\begin{frame}
\maketitle
\end{frame}
\endgroup

\begin{frame}
test
\end{frame}

\end{document}

在此处输入图片描述

但是,如果您想通过从头开始设置模板来彻底更改标题页模板,那么:

  1. 您的标题未居中,因为您当前的设置没有告诉 LaTeX 您希望它居中;事实上,minipage您使用的标题太大了,您可以通过暂时禁用颜色并为其设置框架来看到这一点:

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{libertine} % or any other font package (or none)
    \newcommand*\quotefont{\fontfamily{LinuxLibertineT-TLF}} % selects Libertine for quote font
    \usepackage{tikz}
    \usefonttheme[onlylarge]{structurebold}
    \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
    \setbeamertemplate{navigation symbols}{}
    
    %\setbeamercolor{background canvas}{bg=black}
    %\setbeamercolor{normal text}{fg=white}
    
    \pgfdeclareimage[width=\paperwidth]{mybackground}{bigdata410}
    
    \setbeamertemplate{title page}{   
            \begin{picture}(0,0) 
                \put(-30,-163){%
        %            \pgfuseimage{mybackground}
                } 
                \put(0,-110.7){%
                \centering
                    \frame{\begin{minipage}[b][45mm][t]{226mm}
                    \centering
                        \usebeamerfont{title}{\inserttitle\par}
                    \end{minipage}}
                }  
                \end{picture}
        } 
    \title{Lost in data}
    \author[Author et al.\@]{Author}
    \institute{University of }
    \date{}
    
    \begin{document}
    
    \begin{frame}
      \titlepage
    \end{frame}
    \end{document}
    

    在此处输入图片描述

    更改226mm为并在 内部\textwidth使用:\centeringminipage

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{libertine} % or any other font package (or none)
    \newcommand*\quotefont{\fontfamily{LinuxLibertineT-TLF}} % selects Libertine for quote font
    \usepackage{tikz}
    \usefonttheme[onlylarge]{structurebold}
    \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
    \setbeamertemplate{navigation symbols}{}
    
    %\setbeamercolor{background canvas}{bg=black}
    %\setbeamercolor{normal text}{fg=white}
    
    \pgfdeclareimage[width=\paperwidth]{mybackground}{bigdata410}
    
    \setbeamertemplate{title page}{   
            \begin{picture}(0,0) 
                \put(-30,-163){%
        %            \pgfuseimage{mybackground}
                } 
                \put(0,-110.7){%
                    \frame{\begin{minipage}[b][45mm][t]{\textwidth}
                        \centering
                        \usebeamerfont{title}{\inserttitle\par}
                    \end{minipage}}
                }  
                \end{picture}
        } 
    \title{Lost in data}
    \author[Author et al.\@]{Author}
    \institute{University of }
    \date{}
    
    \begin{document}
    
    \begin{frame}
      \titlepage
    \end{frame}
    
    \end{document}
    

    在此处输入图片描述

    也许您还想降低高度?

  2. 由于您对标题页模板的设置没有相应的插入内容,因此没有标题或机构;您希望此信息出现在哪里?在所需位置使用\insertauthor\insertinstitution例如:

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{libertine} % or any other font package (or none)
    \newcommand*\quotefont{\fontfamily{LinuxLibertineT-TLF}} % selects Libertine for quote font
    \usepackage{tikz}
    \usefonttheme[onlylarge]{structurebold}
    \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
    \setbeamertemplate{navigation symbols}{}
    
    \setbeamercolor{background canvas}{bg=black}
    \setbeamercolor{normal text}{fg=white}
    
    \pgfdeclareimage[width=\paperwidth]{mybackground}{bigdata410}
    
    \setbeamertemplate{title page}{   
            \begin{picture}(0,0) 
                \put(-30,-163){%
                    \pgfuseimage{mybackground}
                } 
                \put(0,-110.7){%
                    \frame{\begin{minipage}[b][45mm][t]{\textwidth}
                        \centering
                        \usebeamerfont{title}{\inserttitle\par}\vfill
                        \usebeamerfont{author}{\insertauthor\par}\vfill
                        \usebeamerfont{institute}{\insertinstitute\par}
                    \end{minipage}}
                }  
                \end{picture}
        } 
    \title{Lost in data}
    \author[Author et al.\@]{Author}
    \institute{University of }
    \date{}
    
    \begin{document}
    
    \begin{frame}
      \titlepage
    \end{frame}
    
    \end{document}
    

    在此处输入图片描述

    对设置满意后,删除(或注释掉)命令\frame

    \documentclass{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{libertine} % or any other font package (or none)
    \newcommand*\quotefont{\fontfamily{LinuxLibertineT-TLF}} % selects Libertine for quote font
    \usepackage{tikz}
    \usefonttheme[onlylarge]{structurebold}
    \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
    \setbeamertemplate{navigation symbols}{}
    
    \setbeamercolor{background canvas}{bg=black}
    \setbeamercolor{normal text}{fg=white}
    
    \pgfdeclareimage[width=\paperwidth]{mybackground}{bigdata410}
    
    \setbeamertemplate{title page}{   
            \begin{picture}(0,0) 
                \put(-30,-163){%
                    \pgfuseimage{mybackground}
                } 
                \put(0,-110.7){%
                    \begin{minipage}[b][45mm][t]{\textwidth}
                        \centering
                        \usebeamerfont{title}{\inserttitle\par}\vfill
                        \usebeamerfont{author}{\insertauthor\par}\vfill
                        \usebeamerfont{institute}{\insertinstitute\par}
                    \end{minipage}%
                }  
                \end{picture}
        } 
    \title{Lost in data}
    \author[Author et al.\@]{Author}
    \institute{University of }
    \date{}
    
    \begin{document}
    
    \begin{frame}
      \titlepage
    \end{frame}
    
    \end{document}
    

    在此处输入图片描述

  3. 有多种方法可以解决此警告;加载包含缺失字体大小的字体(lmodern例如)或使用\let\Tiny\tiny

相关内容