\section 中的彩色引文

\section 中的彩色引文

我正在尝试使用 opaline 样式在章节标题中添加引文(是的,我知道有些人认为这是一个坏主意,但我们现在先不讨论这个问题)。如果我输入

\section{Section Heading \citep{...}}

一切都很好。但是如果我把

\section{Section Heading \textcolor{...}{\cite{...}}}

然后我收到一个错误:

...
Argument of \
@gobble has an extra }.
<inserted text> 
                \par 
l.1 ... \textcolor{Magenta!50}{\citep{Li:2013uq}}}

我也试过

\section{Section Heading} \section{Section Heading \textcolor{...}{\cite{...}}

在这种情况下,它会将引用移至下一页的开头。

有什么办法可以做到我想做的事吗,还是徒劳无功?

更新:根据要求,我正在添加 MWE。

\documentclass[table,xcolor=pdftex,dvipsnames]{beamer}
\usetheme{Madrid}
\usecolortheme{whale}

\usepackage[square]{natbib}

\begin{document}

\title{Presentation Title}
\author{Author}
\institute{Institution}
\date{}

\frame{\titlepage}

\section*{Outline}
         \begin{frame}
             \frametitle{Outline}
           \tableofcontents
         \end{frame}

\section{Section 1}

\section{Section 2 \citep{ov11}}  %This works
\frame{
    \frametitle{A Sample Frame}}

\section{Section 3 \textcolor{Magenta}{\citep{ov11}}}  %This gives error

\bibliographystyle{apalike-url}
\begin{thebibliography}{}

\bibitem[{\"O}zsu and Valduriez, 2011]{ov11}
{\"O}zsu, M.~T. and Valduriez, P. (2011).
\newblock {\em Principles of Distributed Database Systems}.
\newblock Springer, 3rd edition.
\newblock Previous two editions of the book were published by Prentice-Hall in
  1991 and 1999, respectively.

\end{thebibliography}

\end{document}

答案1

您需要\protect以下命令\textcolor

\documentclass[table,xcolor=pdftex,dvipsnames]{beamer}
\usetheme{Madrid}
\usecolortheme{whale}

\usepackage[square]{natbib}

\begin{document}

\title{Presentation Title}
\author{Author}
\institute{Institution}
\date{}

\frame{\titlepage}

\section*{Outline}
         \begin{frame}
             \frametitle{Outline}
           \tableofcontents
         \end{frame}

\section{Section 1}

\section{Section 2 \citep{ov11}}  %This works
\frame{
    \frametitle{A Sample Frame}}

\section{Section 3 \protect\textcolor{Magenta}{\citep{ov11}}}  %This gives error

\bibliographystyle{apalike-url}
\begin{thebibliography}{}

\bibitem[{\"O}zsu and Valduriez, 2011]{ov11}
{\"O}zsu, M.~T. and Valduriez, P. (2011).
\newblock {\em Principles of Distributed Database Systems}.
\newblock Springer, 3rd edition.
\newblock Previous two editions of the book were published by Prentice-Hall in
  1991 and 1999, respectively.

\end{thebibliography}

\end{document}

结果:

在此处输入图片描述

相关内容