如何自訂側邊欄突出顯示部分

如何自訂側邊欄突出顯示部分

我正在準備一個主題如下的簡報:

\useoutertheme[height=0pt,width=3cm,left]{sidebar}
\usecolortheme{dove,sidebartab}

我想更改突出顯示的部分/小節的字體顏色,並使其變為粗體:

\documentclass{beamer}

\useoutertheme[height=0pt,width=3cm,left]{sidebar}
\usecolortheme{dove,sidebartab}

\setbeamercolor{section in sidebar}{fg=white, bg=black}
\setbeamerfont{section in sidebar}{series=\bfseries}

\begin{document}

\section{Section 1}

\section{Subsection 1.1}

\begin{frame}
    abc
\end{frame} 

\section{Subsection 1.2}

\section{Section 2}

\section{Subsection 2.1}

\section{Subsection 2.2}

\begin{frame}
    abc
\end{frame} 

\end{document}

不幸的是,\setbeamerfont{section in sidebar}{series=\bfseries}使每個部分/小節都變成粗體,而不僅僅是突出顯示的部分。

在此輸入影像描述

答案1

你想要修改\setbeamercolor{section in sidebar}{fg=blue, bg=red}

\documentclass{beamer}

\useoutertheme[height=0pt,width=3cm,left]{sidebar}
\usecolortheme{dove,sidebartab}

\setbeamercolor{section in sidebar}{fg=blue, bg=red}



\begin{document}

\section{test}

\begin{frame}
    abc
\end{frame} 

\section{testtest}

\begin{frame}
    abc
\end{frame} 

\end{document}

在此輸入影像描述


若要將字體變更回非粗體,您可以執行以下操作:

\documentclass{beamer}

\useoutertheme[height=0pt,width=3cm,left]{sidebar}
\usecolortheme{dove,sidebartab}

%Colours
\setbeamercolor{section in sidebar}{fg=blue, bg=red}

% Fonts
\setbeamerfont{section in sidebar}{series=\bfseries}
\setbeamerfont{section in sidebar shaded}{series=\normalfont}

\makeatletter
\setbeamertemplate{section in sidebar shaded}
{%
  \vbox{%
    \vskip1ex%
    \beamer@sidebarformat{3pt}{section in sidebar shaded}{\usebeamerfont{section in sidebar shaded}\insertsectionhead}%
  }%
}
\makeatother

\begin{document}

\section{Section 1}

\begin{frame}
    abc
\end{frame} 


\section{Subsection 1.1}

\begin{frame}
    abc
\end{frame} 

\section{Subsection 1.2}

\section{Section 2}

\section{Subsection 2.1}

\section{Subsection 2.2}

\begin{frame}
    abc
\end{frame} 

\end{document}

在此輸入影像描述

相關內容