我想在 Beamer 中使用彩色引文。我使用了以下代码,
\documentclass[12pt]{beamer}
\usetheme{CambridgeUS}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[T1]{fontenc}
\usefonttheme[onlymath]{serif}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{lmodern}
\usepackage{color}
%\usepackage{multimedia}
%\usepackage{movie15}
%\usepackage{tikz}
%\tikzset{
% every overlay node/.style={
% draw=black,anchor=north west,
% },
%}
%\def\tikzoverlay{%
% \tikz[baseline,overlay]\node[every overlay node]
%}%
%%for Justifying in itemised
\usepackage{ragged2e}
\let\olditem=\item%
\renewcommand{\item}{\olditem \justifying}%
%--------------------------------------------------
%for objective theorm enviroment
\makeatletter
\def\th@mystyle{%
\normalfont % body font
\setbeamercolor{block title example}{bg=red!80,fg=white}
\setbeamercolor{block body example}{bg=red!20,fg=black}
\def\inserttheoremblockenv{exampleblock}
}
\makeatother
\theoremstyle{mystyle}
\newtheorem*{Objective}{Objective}
%%-------------------------
\usepackage{csquotes}% Recommended
\usepackage[backend=biber,
style=authoryear,
]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{DP.bib}
\makeatletter
\let\abx@macro@citeOrig\abx@macro@cite
\renewbibmacro{cite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@citeOrig%
}%
}
\let\abx@macro@parenciteOrig\abx@macro@parencite
\renewbibmacro{parencite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@parenciteOrig%
}%
}%
\let\abx@macro@textciteOrig\abx@macro@textcite
\renewbibmacro{textcite}{%
\bibhyperref{%
\let\bibhyperref\relax\relax%
\abx@macro@textciteOrig%
}%
}%
\makeatother
%\usepackage[colorlinks]{hyperref}
\hypersetup{colorlinks,
citecolor=blue,
linkcolor=.,
menucolor=white,
filecolor=pink,
anchorcolor=yellow
}
\begin{document}
\begin{frame}{Multiple Model Switching Controllers}
\begin{itemize}
\item \textcite{greytak2007exponentially} gave control scheme which switches between Manifold Convergence Controller and LQR controller for underactuated Autonomous Surface Vessel (river) with just a propeller and rudder.
\item \textcite{hassani2012multiple} proposed multiple model adaptive controller consisting of four LQG controller. The controller switching occurs to compensate for different sea state.
\item \textcite{brodtkorb2014dynamic} demonstrated a control scheme with four different PID and sensor based observer for switching between them. Switching logic is based on spectral analysis of motion.
\item \textcite{hassani2013novel} simulated used Robust Multiple Model Adaptive Dynamic Positioning switching Controller designed using mixed $ \mu $ methodology for different sea state.
\end{itemize}
\end{frame}
\end{document}
问题是使用时结束的括号\textcite{}
颜色与超链接不同。可能是什么问题。我在 sharelatex 上这样做。
答案1
基于https://tex.stackexchange.com/a/25972/36296你可以使用:
\documentclass[12pt]{beamer}
\usetheme{CambridgeUS}
\usepackage[english]{babel}
\usepackage{csquotes}% Recommended
\usepackage[backend=biber,
style=authoryear,
]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{\jobname.bib}
\hypersetup{colorlinks,
citecolor=blue,
linkcolor=.,
menucolor=white,
filecolor=pink,
anchorcolor=yellow
}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@book{knuth,
author = {Knuth, Donald E.},
title = {The {\TeX} book},
date = 1984,
maintitle = {Computers \& Typesetting},
volume = {A},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
langid = {english},
langidopts = {variant=american},
sortyear = {1984-1},
sorttitle = {Computers & Typesetting A},
indexsorttitle= {The TeXbook},
indextitle = {\protect\TeX book, The},
shorttitle = {\TeX book}
}
@article{einstein,
author = {Einstein, A.},
title = {Die Grundlage der allgemeinen Relativitätstheorie},
journal = {Annalen der Physik},
volume = {354},
number = {7},
doi = {10.1002/andp.19163540702},
pages = {769--822},
year = {1916}
}
\end{filecontents*}
\DeclareCiteCommand{\textcite}
{\boolfalse{cbx:parens}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\printnames{labelname}%
\printtext{ (\printfield{year}\printtext{)}}}}
{\ifbool{cbx:parens}
{\bibcloseparen\global\boolfalse{cbx:parens}}
{}%
\multicitedelim}
{\usebibmacro{textcite:postnote}}
\begin{document}
\begin{frame}{Multiple Model Switching Controllers}
\begin{itemize}
\item \textcite{einstein} gave control scheme which switches between Manifold Convergence Controller and LQR controller for underactuated Autonomous Surface Vessel (river) with just a propeller and rudder.
\end{itemize}
\end{frame}
\end{document}
请注意,您既不需要color
也不graphicx
需要 beamer,因为 beamer 已经提供了此功能。