I want to create a beamer template with a horizontal rule below every frame title.
The line should start just below the first letter of the title and extend until the very end of the frame.
Desired result:
The solution should be flexible enough to handle different font sizes and long titles spanning two lines. However, the vertical position of rule should not adapt to the height of the characters used in the frame title (e.g., whether or not the characters extend below to the baseline).
To clarify:
To create a rule
spanning the entire width of the frame, I use \makebox[\linewidth][l]{\rule{\paperwidth}{0.4pt}}
, as suggested by others. An undesired side-effect of using \makebox
is that it behaves differently from \hrule
, e.g., it has a different height.
I solved the problem of fluctuating positioning of the rule by using \vphantom{g}
in the frame title, but another solution might be more elegant.
\documentclass[t,9pt]{beamer}
\setbeamertemplate{frametitle}{%
\usebeamerfont{frametitle}\insertframetitle%
\vphantom{g}% To avoid fluctuations per frame
%\hrule% Uncomment to see desired effect, without a full-width hrule
\makebox[\linewidth][l]{\rule{\paperwidth}{0.4pt}}%
}
\begin{document}
\begin{frame}{Frame Title}
Frame contents.
\end{frame}
\end{document}
How do I get the desired result of a line below the frame title running until the right end of the frame?
Best Answer
I understand that you looking for:
Edit If you like to have less vertical space after horizontal rule, than try the following:
which gives