调整标题模板中的行距

调整标题模板中的行距

headline如何调整模板内的行距?

baselineskip考虑下面的代码,如果它在普通框架内使用,我可以通过修改来控制行距\fontsize{size}{baselineskip}

但是如果我尝试在模板中使用它headline,更改baselineskip并不会有什么区别。

\documentclass[t]{beamer}

% Fonts
\setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}

% Headline
\setbeamertemplate{headline}{%
    \begin{minipage}[b][0mm][t]{85mm}%
        \usebeamerfont{title}{%
            \inserttitle
        }%
    \end{minipage}%     
}

\title{Really long title to test all the three possible lines is not yet long enough but know}

  \begin{document}

    \begin{frame}[t]
    \end{frame}

    \setbeamertemplate{headline}{}
    \begin{frame}[t]
            \begin{minipage}[b][0mm][t]{85mm}%
                \usebeamerfont{title}{%
                    \inserttitle
                }%
            \end{minipage}% 
    \end{frame}

  \end{document}

在此处输入图片描述


我也尝试过答案https://tex.stackexchange.com/a/66208/36296,但行距保持不变。

\documentclass[t]{beamer}

\def\beamer@typesetheadorfoot#1{% typeset the head or footline
    {\parskip0pt %\offinterlineskip%
        \hbox{%
            \hskip-\Gm@lmargin%
            \hbox{%
                \vbox{%
                    \@tempdima=\textwidth%
                    \textwidth=\paperwidth%
                    \hsize=\textwidth%
                    \def\\{,}%
                    \usebeamertemplate***{#1}%
                }}%
                \hskip-\Gm@rmargin%
            }}\hfil%
        }


% Fonts
\setbeamerfont{title}{series=\bfseries,size=\fontsize{16}{24}}

% Headline
\setbeamertemplate{headline}{%
    \begin{minipage}[b][0mm][t]{85mm}%
        \usebeamerfont{title}{%
            \linespread{3.}
            \inserttitle \par
        }%
    \end{minipage}%     
}

\title{Really long title to test all the three possible lines is not yet long enough but know}

  \begin{document}

    \begin{frame}[t]
    \end{frame}

    \setbeamertemplate{headline}{}
    \begin{frame}[t]
            \begin{minipage}[b][0mm][t]{85mm}%
                \usebeamerfont{title}{%
                    \inserttitle
                }%
            \end{minipage}% 
    \end{frame}

  \end{document}

答案1

在插入标题模板beamer问题之前\offinterlineskip,这会阻止您希望实现的基线更改。您可以使用以下方法恢复通常的行距行为\normalbaselines

示例输出

\documentclass[t]{beamer}

% Fonts
\setbeamerfont{title}{series=\bfseries,size*={16}{24}}

% Headline
\setbeamertemplate{headline}{%
   \begin{minipage}[b][0mm][t]{85mm}%
     \normalbaselines
     \usebeamerfont{title}
     \inserttitle
   \end{minipage}
}

\title{Really long title to test all the three possible lines is not
yet long enough but know}

\begin{document}

\begin{frame}[t]
\end{frame}

\end{document}

beamer排版标题的命令在\beamer@typesetheadorfoot中定义beamerbasecomponents.sty

相关内容