希望你一切顺利。我想设置 Beamer(citep 和 citet)中 cite 命令的颜色属性(例如蓝色),但我不知道该怎么做。我该怎么做?这是我的代码。
\documentclass[xcolor=dvipsnames,t]{beamer}
\definecolor{mikadoyellow}{rgb}{1.0, 0.77, 0.05}
\definecolor{yaleblue}{rgb}{0.06, 0.3, 0.57}
\usetheme{warsaw}
\usefonttheme{serif}
\setbeamerfont{section in head/foot}{family=\sffamily}
\setbeamerfont{subsection in head/foot}{family=\sffamily}
\setbeamerfont{author in head/foot}{family=\sffamily}
\setbeamerfont{title in head/foot}{family=\sffamily}
\setbeamercolor*{palette primary}{use=structure,fg=black,bg=red}
\setbeamercolor*{palette quaternary}{fg=white,bg=black}
%\usepackage[spanish]{babel}
\usepackage{multirow}
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{gensymb}
\usepackage{xcolor}
\usepackage{hyperref}
\justifying
\usefonttheme{professionalfonts}
\usepackage[none]{hyphenat}
\usepackage{cancel}
\usepackage{tikz}
\usepackage[round]{natbib}
\usepackage{color}
\usepackage{colortbl}
%\let\oldcite=\citet
%\let\oldcite=\citep
%\renewcommand{\citet}[1]{\textcolor[rgb]{0,0,1}{\oldcite{#1}}}
%\renewcommand{\citep}[1]{\textcolor[rgb]{0,0,1}{\oldcite{#1}}}
%\def\@citet#1#2{{\hypersetup{linkcolor=blue!black}[{#1\if@tempswa , #2\fi}]}}
\newcommand{\textunderscript}[1]{$_{\text{#1}}$}
\setbeamersize{text margin left=20pt,text margin right=20pt}
\title[Title 2]{Title}
\author{Author}
\date{\today}
\begin{document}
\sloppy
{
\addtobeamertemplate{headline}{%
\setbeamercolor{section in head/foot}{use=palette quaternary, fg=palette quaternary.bg}
}{}
\begin{frame}
\titlepage
\end{frame}
}
%-------------------------START----------------------------
\section{Problem definition}
\subsection{Introduction}
\frame{
\citep{Ansari2014} and \citet{Ansari2014}
}
\begin{frame}[allowframebreaks]
\bibliographystyle{apalike}
\bibliography{ref_qualify}
\end{frame}
\end{document}
提前致谢
答案1
您几乎在代码注释中找到答案,请尝试进行以下微小修改:
\let\oldcitet=\citet
\let\oldcitep=\citep
\renewcommand{\citet}[1]{\textcolor[rgb]{0,0,1}{\oldcitet{#1}}}
\renewcommand{\citep}[1]{\textcolor[rgb]{0,0,1}{\oldcitep{#1}}}
完整 MWE:
\documentclass[xcolor=dvipsnames,t]{beamer}
\definecolor{mikadoyellow}{rgb}{1.0, 0.77, 0.05}
\definecolor{yaleblue}{rgb}{0.06, 0.3, 0.57}
\usetheme{Warsaw}
\usefonttheme{serif}
\setbeamerfont{section in head/foot}{family=\sffamily}
\setbeamerfont{subsection in head/foot}{family=\sffamily}
\setbeamerfont{author in head/foot}{family=\sffamily}
\setbeamerfont{title in head/foot}{family=\sffamily}
\setbeamercolor*{palette primary}{use=structure,fg=black,bg=red}
\setbeamercolor*{palette quaternary}{fg=white,bg=black}
\usepackage{multirow}
\usepackage{ragged2e}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{gensymb}
\justifying
\usefonttheme{professionalfonts}
\usepackage[none]{hyphenat}
\usepackage{cancel}
\usepackage{tikz}
\usepackage[round]{natbib}
\usepackage{colortbl}
\let\oldcitet=\citet
\let\oldcitep=\citep
\renewcommand{\citet}[1]{\textcolor[rgb]{0,0,1}{\oldcitet{#1}}}
\renewcommand{\citep}[1]{\textcolor[rgb]{0,0,1}{\oldcitep{#1}}}
\newcommand{\textunderscript}[1]{$_{\text{#1}}$}
\setbeamersize{text margin left=20pt,text margin right=20pt}
\begin{document}
\frame{
\citep{moore:related} and \citet{moore:related}
}
\begin{frame}[allowframebreaks]
\bibliographystyle{apalike}
\bibliography{biblatex-examples}
\end{frame}
\end{document}
无关:
你不需要
\usepackage{xcolor}
\usepackage{hyperref}
\usepackage{color}
因为 beamer 已经提供了这些功能。