0

I am writing a latex template for presentation slides using beamer class.

I want to design the style of title and subtitle of an arbitrary frame, in terms of their color, font size, and location. I don't know how to tune the parameters in beamer specifically to title and subtitle objects, so I defined two textblock in the part of \defbeamertemplate*.

And I also want to set the main text at 3.5 cm below the top edge of the slide.

I present my code below. The outcome is not nice. Because if I add more contents in the main text, the first line of the main text moves above, and overlaps with title and subtitle lines, see the two screenshots below.

Do you know how to keep the first line in the main text 3.5 cm below the top edge of the slide? Maybe using textblocks for title and subtitle is not elegant at all. Any suggestion is welcomed.

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}

\defbeamertemplate*{frametitle}{}[1][]
{
    \begin{textblock*}{12cm}(0.5cm,1cm)
    {\color{gray} \fontsize{36}{43.2} \selectfont \insertframetitle}
    \end{textblock*}
    \begin{textblock*}{12cm}(0.5cm,2.5cm)
    {\color{gray} \fontsize{20}{24} \selectfont \insertframesubtitle}
    \end{textblock*}
}

\begin{document}

\begin{frame} 
\frametitle{Bulleting and Number} 
\framesubtitle{As An Example}    
This is line should be 3.5 cm below the top edge of the slide.
    \begin{itemize} 
    \item adfas
        \begin{itemize}
        \item afdfa
            \begin{itemize}
            \item adfadsfa
            \item adsfa
            \end{itemize}    
        \end{itemize}
    \end{itemize}

    This is how to add numbered list.
    \begin{enumerate}
        \item Use number
        \item Another number
        \begin{enumerate}[I]
            \item Use Letter
            \item Another letter
            \begin{enumerate}[a]
                \item Use 
                \item Use
            \end{enumerate}
        \end{enumerate}
    \end{enumerate}
\end{frame}

\end{document}

enter image description here enter image description here

2

Instead of a textblock I would go the traditional beamer route and put the frametitle inside a beamercolorbox. To adjust the vertical position to fit your requirements, modify the values of the \vskips.

\documentclass{beamer}

\usepackage[absolute,overlay]{textpos}

\setbeamerfont{frametitle}{size=\fontsize{36}{43.2}}
\setbeamerfont{framesubtitle}{size=\fontsize{20}{24}}
\setbeamercolor{frametitle}{fg=gray}
\setbeamercolor{framesubtitle}{fg=gray}

\makeatletter
\setbeamertemplate{frametitle}{%
  \ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
  \@tempdima=\textwidth%
  \advance\@tempdima by\beamer@leftmargin%
  \advance\@tempdima by\beamer@rightmargin%
  \begin{beamercolorbox}[sep=0.5cm,left,wd=\the\@tempdima]{frametitle}
    \usebeamerfont{frametitle}%
    \vbox{}\vskip-0.25ex%
    \if@tempswa\else\csname beamer@fteleft\endcsname\fi%
    \strut\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

\begin{document}

\begin{frame} 
\frametitle{Bulleting and Number} 
\framesubtitle{As An Example}    
This is line should be 3.5 cm below the top edge of the slide.
    \begin{itemize} 
    \item adfas
        \begin{itemize}
        \item afdfa
            \begin{itemize}
            \item adfadsfa
            \item adsfa
            \end{itemize}    
        \end{itemize}
    \end{itemize}

    This is how to add numbered list.
    \begin{enumerate}
        \item Use number
        \item Another number
        \begin{enumerate}[I]
            \item Use Letter
            \item Another letter
            \begin{enumerate}[a]
                \item Use 
                \item Use
            \end{enumerate}
        \end{enumerate}
    \end{enumerate}
\end{frame}

\end{document}

enter image description here

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.