![框架标题文本的字体和位置](https://linux22.com/image/460160/%E6%A1%86%E6%9E%B6%E6%A0%87%E9%A2%98%E6%96%87%E6%9C%AC%E7%9A%84%E5%AD%97%E4%BD%93%E5%92%8C%E4%BD%8D%E7%BD%AE.png)
根据此主题中的答案:
投影仪幻灯片上 frametitle 和 framesubtitle 下方的水平线
我复制并修改了它,但我需要的是(如下图所示)将框架标题的字体更改为 Arial Black,以及位置,我尝试了很多次,但不幸的是无法做到。非常感谢您的帮助。代码如下:
\documentclass[xcolor={dvipsnames},aspectratio=1610]{beamer}
\setbeamercolor{frametitle}{fg=Black}
\setbeamercolor{lower separation line head}{bg=red}
\makeatletter
\setbeamertemplate{frametitle}{%
\nointerlineskip%
\vskip0.3cm%
\begin{beamercolorbox}[wd=\paperwidth,leftskip=.3cm,rightskip=.7cm plus1fil,vmode]{frametitle}%
\begin{minipage}{\dimexpr\paperwidth-4.6cm\relax}%
\hspace{0.6cm}
\vspace{0.1cm}
\usebeamerfont*{frametitle}\insertframetitle%
\ifx\insertframesubtitle\@empty%
\strut\par%
\else
\par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
\fi%%
\end{minipage}%
\hspace{0.6cm}
\vspace{-0.3cm}
\begin{minipage}{2.5cm}%
\hfill\vspace{-0.3cm}
\hfill
\includegraphics[height=1.2cm]{example-image-b}%
\end{minipage}%
\end{beamercolorbox}%
\vskip1ex
\begin{beamercolorbox}[colsep=1.5pt,wd=\textwidth]{lower separation line head}
\end{beamercolorbox}
}
\makeatother
\usepackage{tikz}
\begin{document}
\begin{frame}
\frametitle{title}
\end{frame}
\end{document}
答案1
为了使用 Arial Black 作为标题,您可以切换到 lualatex 或 xelatex 并使用 fontspec 包。这样您就可以使用计算机上安装的任何字体,例如 Arial Black。
对于定位,我建议指定两个小页面的高度,并将内容对齐到底部
% !TeX TS-program = lualatex
\documentclass[xcolor={dvipsnames},aspectratio=1610]{beamer}
\setbeamercolor{frametitle}{fg=Black}
\setbeamercolor{lower separation line head}{bg=red}
\usepackage{fontspec}
\newfontfamily{\arialblack}{Arial Black}
\setbeamerfont{frametitle}{family=\arialblack}
\makeatletter
\setbeamertemplate{frametitle}{%
\nointerlineskip%
\vskip0.3cm%
\begin{beamercolorbox}[wd=\textwidth]{frametitle}%
\begin{minipage}[t][1.2cm][b]{\dimexpr\paperwidth-4.6cm\relax}%
\usebeamerfont*{frametitle}\insertframetitle%
\ifx\insertframesubtitle\@empty%
\strut\par%
\else
\par{\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
\fi%%
\end{minipage}%
\hfill%
\begin{minipage}[t][1.2cm][b]{2.5cm}
\hfill\includegraphics[height=1.2cm]{example-image-b}%
\end{minipage}%
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt,wd=\textwidth]{lower separation line head}
\end{beamercolorbox}
}
\makeatother
\usepackage{tikz}
\begin{document}
\begin{frame}
\frametitle{title}
content
\end{frame}
\end{document}