1

I want to customize the frametitle in a beamer presentation. I have a problem with the linespacing, so I use the size*-version.

The declaration is size*={<fontsize in pt>}{<baselineskip>}. However, I don't want to fix the fontsize of the frametitle, so I need to convert the fontsize (e.g. \huge) to pt.

Here is an example:

\setbeamerfont{frametitle}{%
  size*={%
    \fontsize2pt{\huge}%
  }{1.5ex},%
  shape=\scshape%
}

Is there an easy way to do this?

  • It is not clear to me what the problem is. Can you please elaborate on what are you trying to do? Do you want to chenage just the value for the baselineskip, but keeping the default font size? – Gonzalo Medina Mar 13 '14 at 12:59
  • Yes, I still want the font size to be relative to the other text. – aagaard Mar 13 '14 at 13:08
  • But, if you set the font size in pt, the size will be fixed. I am a little confused with your description. In any case, I've provided an answer below. Please let me know if something like that is what you need. – Gonzalo Medina Mar 13 '14 at 13:17
  • Not if you let it depend on the \large, \Large or \huge macros. The font size will change according to what you pick as the default font size of the beamer. – aagaard Mar 13 '14 at 13:39
  • Ah, I think I now understand what you are trying to achieve. Please take a look at my updated answer and let me know if something like that is what you need. – Gonzalo Medina Mar 13 '14 at 23:02
2

Using \f@size you can build a command that allows you to get the value in pt units of the current font; you can then use this value for your definition. Use \myfontsize to get the pt value of the font size declared in the mandatory argument; this length is stored in \myftsize which you can then use in the first argument of size*:

\documentclass{beamer}

\newlength\myftsize
\makeatletter
\newcommand\myfontsize[1]{%
  \begingroup
  #1
  \global\setlength\myftsize{\f@size pt}%
  \endgroup
}
\makeatother

\myfontsize{\huge}
\setbeamerfont{frametitle}{%
  size*={\myftsize}{1.5ex},
  shape=\scshape
}

\begin{document}

\begin{frame}
\frametitle{Test frame}
test
\end{frame}

\end{document}

enter image description here

  • Yes, this was exactly what I was looking for! There may be a better way around this, but it works in my case. Thanks. – aagaard Mar 14 '14 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.