![Beamer 演示(大都市主题) - \frametitle & \framesubtitle](https://linux22.com/image/403811/Beamer%20%E6%BC%94%E7%A4%BA%EF%BC%88%E5%A4%A7%E9%83%BD%E5%B8%82%E4%B8%BB%E9%A2%98%EF%BC%89%20-%20%5Cframetitle%20%26%20%5Cframesubtitle.png)
我使用的 beamer 主题metropolis
不支持framesubtitles
。因此我使用 添加了它\addtobeamertemplate
。不幸的是,我对 latex 不太熟悉。
这是我的问题:
- framesubtitle 没有与 frametitle 左对齐。我该如何实现?(更一般地:如何更改标题和副标题的对齐方式)
- frametitle 和 framesubtitle 之间的垂直间距非常小。如何增加间距?
这是我的代码的最小工作示例:
\documentclass[8pt]{beamer}
\usetheme[block=fill]{metropolis}
\usepackage[utf8]{inputenc}
% Add framesubtitle to template
\setbeamercolor{framesubtitle}{fg=mDarkTeal}
\addtobeamertemplate{frametitle}{}{%
\ifx\insertframesubtitle\@empty\else%
\usebeamerfont{framesubtitle}%
\usebeamercolor[fg]{framesubtitle}%
%\vskip3pt
\insertframesubtitle%
\fi%
}
\begin{document}
\section{Chapter X}
\begin{frame}{Header 1}
\framesubtitle{Subheader 2}
Some text here!
\end{frame}
\end{document}
谢谢!
答案1
仅举例:主标题在右边,副标题在左边:
\documentclass[8pt]{beamer}
\usetheme[block=fill]{metropolis}
\makeatletter
\setbeamercolor{framesubtitle}{fg=mDarkTeal}
\defbeamertemplate*{frametitle}{myframetitle}{%
\nointerlineskip
\begin{beamercolorbox}[%
wd=\paperwidth,%
sep=0pt,%
leftskip=\metropolis@frametitle@padding,
rightskip=\metropolis@frametitle@padding,
]{frametitle}%
\metropolis@frametitlestrut@start
\quad\insertframetitle%%%%%%%%%%%%%%%%%%%%%%
\nolinebreak
\metropolis@frametitlestrut@end
\end{beamercolorbox}\par
\usebeamerfont{framesubtitle}%
\usebeamercolor[fg]{framesubtitle}%
\vskip3pt
\hspace*{-2.5\metropolis@frametitle@padding}%
\insertframesubtitle
}
\makeatother
\setbeamertemplate{frametitle}[myframetitle]
\begin{document}
\section{Chapter X}
\begin{frame}{Header 1}
\framesubtitle{Subheader 2}
Some text here!
\end{frame}
\end{document}