TransWikia.com

Beamer: use glyphs from smaller font size, but enlarge

TeX - LaTeX Asked by japreiss on June 19, 2021

Like most full-featured typefaces, Computer Modern has different versions for different display sizes. Smaller sizes have a wider aspect ratio, heavier serifs, and less variation between horizontal and vertical strokes. These features make text more legible at small sizes.

Sample of different sizes of Computer Modern.

Beamer defaults to an 11-point font. In my opinion, this is too big. I want those legibility features from smaller sizes. However, I think the overall size of Beamer’s fonts is good. Selecting documentclass[8pt]{beamer} results in too many characters per line.

How can I tell Beamer to use the glyphs of a smaller size of Computer Modern, but enlarge them to (roughly) the same size as default?

2 Answers

Consider this minimal example that uses the default of 11pt font and a 43 (or 4:3 aspect ratio, or 12.8cm x 9.6cm page dimension):

documentclass{beamer}
  
usetheme{Warsaw}

begin{document}

begin{frame}
  frametitle{There Is No Largest Prime Number - 11pt}
  framesubtitle{The proof uses textit{reductio ad absurdum}.}
  begin{theorem}
    There is no largest prime number.
  end{theorem}
  begin{proof}
    begin{enumerate}
      item<1-| alert@1> Suppose $p$ were the largest prime number.
      item<2-> Let $q$ be the product of the first $p$ numbers.
      item<3-> Then $q+1$ is not divisible by any of them.
      item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime number not in the first $p$ numbers.qedhere
    end{enumerate}
  end{proof}
end{frame}

end{document}

You can choose the 8pt font option, and resize the page to have a similar aspect ratio, but slightly smaller (by a scaling factor of 8/11 thanks to xfp):

documentclass[8pt]{beamer}

usepackage{xfp}
makeatletter
% Taken from beamer.cls' default geometry settings
% http://mirrors.ctan.org/macros/latex/contrib/beamer/base/beamer.cls
geometry{%
  papersize={fpeval{beamer@paperwidth*8/11}pt,fpeval{beamer@paperheight*8/11}pt},
  hmargin=fpeval{8/11}cm,% 1cm
  vmargin=0cm,%
  head=fpeval{0.5*8/11}cm,% 0.5cm
  headsep=0pt,%
  foot=fpeval{0.5*8/11}cm% 0.5cm
}
makeatother
  
usetheme{Warsaw}

begin{document}

begin{frame}
  frametitle{There Is No Largest Prime Number - 8pt}
  framesubtitle{The proof uses textit{reductio ad absurdum}.}
  begin{theorem}
    There is no largest prime number.
  end{theorem}
  begin{proof}
    begin{enumerate}
      item<1-| alert@1> Suppose $p$ were the largest prime number.
      item<2-> Let $q$ be the product of the first $p$ numbers.
      item<3-> Then $q+1$ is not divisible by any of them.
      item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime number not in the first $p$ numbers.qedhere
    end{enumerate}
  end{proof}
end{frame}

end{document}

Here's a rough visual of the difference:

enter image description here

You may have to change other lengths as well just because the scaling doesn't translate unilaterally to font-related concepts. Visually, however, it suffices to be very similar in display.

Answered by Werner on June 19, 2021

The simplest way to do this is to use the OpticalSize= font feature, from fontspec, and a font that supports it, such as Latin Modern or the TeX Gyre series. This has none of the side-effects of shrinking the document size.

There is really no reason not to use modern software with beamer, since you aren’t submitting a beamer presentation to a publisher who requires you to use PDFTeX.

documentclass{beamer}
tracinglostchars=2
usetheme{Warsaw}
usefonttheme{professionalfonts}
usepackage{unicode-math}

defaultfontfeatures{ Ligatures=TeX, OpticalSize=20 }

setmainfont{Latin Modern Roman}
setsansfont{Latin Modern Sans}
setmathfont{Latin Modern Math}
setmathfont{XITS Math}[range=QED, Scale=MatchUppercase]

renewcommandqedsymbol{ensuremath{QED}}

begin{document}

begin{frame}
  frametitle{There Is No Largest Prime Number - 20pt}
  framesubtitle{The proof uses textit{reductio ad absurdum}.}
  begin{theorem}
    There is no largest prime number.
  end{theorem}
  begin{proof}
    begin{enumerate}
      item<1-| alert@1> Suppose $p$ were the largest prime number.
      item<2-> Let $q$ be the product of the first $p$ numbers.
      item<3-> Then $q+1$ is not divisible by any of them.
      item<1-> But $q + 1$ is greater than $1$, thus divisible by some prime number not in the first $p$ numbers.qedhere
    end{enumerate}
  end{proof}
end{frame}

end{document}

20pt sample

And mutatis mutandis:

8pt sample

Additional use of setmathfont[range=... can get you sans-serif math letters, too.

Answered by Davislor on June 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP