我正在尝试自定义主题,但也想使用它hyperref
来获取快速链接,以便于导航。但是,hyperref
似乎要将所有内容的颜色替换为其linkcolor
选项。
MWE 显示章节和小节标题的颜色是蓝色,但我实际上将它们设置为橙色和白色。
答案在更改超链接颜色会改变投影仪部分标题的颜色建议不使用\hypersetup
,但我还是想使用它,因为彩色方程式引用可以更容易地快速找到方程式并查看它们在文本中的使用位置。我可以正常启用链接着色但排除章节和小节吗?
这是我想要的结果
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\setbeamercolor{palette primary}{fg=black, bg=LemonChiffon2}
\setbeamercolor{palette secondary}{fg=white, bg=DarkOrange2}
\setbeamercolor{palette tertiary}{fg=black, bg=white}
\setbeamercolor{palette quaternary}{fg=black, bg=white}
\useoutertheme[]{miniframes}
\setbeamercolor{section in head/foot}{fg=DarkOrange2}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{section in head/foot shaded}[default][30]
\useinnertheme{inmargin}
\setbeamersize{sidebar width left=1cm, sidebar width right=1cm}
\setbeamersize{text margin left=0.5mm, text margin right=0.5mm}
\setbeamercovered{transparent=30}
\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}
\begin{document}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents
\end{frame}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents
\end{frame}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents
\end{frame}
\end{document}
答案1
您可以禁用标题模板中的链接颜色:
\documentclass[aspectratio=169, xcolor={x11names}]{beamer}
\usecolortheme{seahorse}
\setbeamercolor{palette primary}{fg=black, bg=LemonChiffon2}
\setbeamercolor{palette secondary}{fg=white, bg=DarkOrange2}
\setbeamercolor{palette tertiary}{fg=black, bg=white}
\setbeamercolor{palette quaternary}{fg=black, bg=white}
\useoutertheme[]{miniframes}
\setbeamercolor{section in head/foot}{fg=DarkOrange2}
\setbeamercolor{subsection in head/foot}{fg=white}
\setbeamertemplate{section in head/foot shaded}[default][30]
\useinnertheme{inmargin}
\setbeamersize{sidebar width left=1cm, sidebar width right=1cm}
\setbeamersize{text margin left=0.5mm, text margin right=0.5mm}
\setbeamercovered{transparent=30}
\usepackage{hyperref}
\hypersetup{linkcolor=DodgerBlue3, colorlinks=true}
\makeatletter
\newcommand\disablecolorlinks{\def\HyColor@UseColor##1{}}
\makeatletter
\addtobeamertemplate{headline}{\disablecolorlinks{}}{}
\begin{document}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents
\begin{equation}
a
\label{eq}
\end{equation}
\end{frame}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents \ref{eq}
\end{frame}
\section{My Section}
\subsection{My Subsection}
\begin{frame}
contents
\end{frame}
\end{document}