frametitle 和 framessubtitle 的大写窄字体

frametitle 和 framessubtitle 的大写窄字体

今天开始学习 beamer。我正在尝试弄清楚如何将框架标题设置为全部大写,以及窄字体

我只是随机挑选了一个 http://www.tug.dk/FontCatalogue/paratypesansnarrow/来测试它。

这种事可能吗?

\documentclass{beamer}
\usepackage[default,regular,black]{sourceserifpro}
\usepackage[T1]{fontenc}
\usepackage{PTSans} % PTSansNarrow
\usepackage{PTSansNarrow} % PTSansNarrow
\mode<presentation>
{
    \usetheme{default}
    \usecolortheme{default}
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{caption}[numbered]
}    
\setbeamercolor{frametitle}{fg=black!50}
\setbeamerfont{frametitle}{size=\footnotesize}
%\setbeamertemplate{frametitle}{
%      \expandafter\MakeUppercase\expandafter\insertframetitle
%}

\setbeamerfont{frametitle}{size=\footnotesize,family=\fontfamily{PTSansNarrow}\selectfont}

\begin{document}

\begin{frame}
\frametitle{Main title}
\framesubtitle{Subtitle}
Text for document.
\end{frame}

\end{document}

我收到的错误如下:

LaTeX Font Warning: Font shape `T1/PTSansNarrow/m/n' undefined
(Font)              using `T1/cmr/m/n' instead on input line 36.

[1{/usr/local/texlive/2016/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./beamer_test2.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

我认为这些形状与窄有关(即 /n == 窄?)

答案1

我的个人观点:我认为这么窄的字体不适合演示,很难阅读。

\documentclass{beamer}
\usepackage[T1]{fontenc}
\usepackage{PTSansNarrow} % PTSansNarrow
\mode<presentation>
{
    \usetheme{default}
    \usecolortheme{default}
    \setbeamertemplate{navigation symbols}{}
    \setbeamertemplate{caption}[numbered]
}    
\setbeamercolor{frametitle}{fg=black!50}
\setbeamerfont{frametitle}{size=\footnotesize}

\makeatletter
\setbeamertemplate{frametitle}{%
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.3cm,left,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-1ex%
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    \strut\MakeUppercase{\insertframetitle}\strut\par%
    {%
      \ifx\insertframesubtitle\@empty%
      \else%
      {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
      \fi
    }%
    \vskip-1ex%
    \if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
  \end{beamercolorbox}%
}
\makeatother

\setbeamerfont{frametitle}{size=\footnotesize}

\begin{document}

\begin{frame}
\frametitle{Main title}
\framesubtitle{Subtitle}
Text for document.
\end{frame}

\end{document}

在此处输入图片描述

相关内容