4

I want to change my equation reference color to \usebeamercolor[fg]{structure}. I use it as {\usebeamercolor[fg]{structure}\ref{eqn1}} but I want to make this as my default color and just use \eqref{eqn1} to get the same output.

Also, where can I find the list of colors that beamer uses? For example, for example block header, alert block header, theorem block header.

\documentclass[10pt]{beamer}

\usepackage{amsfonts}


\usetheme{Warsaw}
\usecolortheme{whale}

\begin{document}

\begin{frame}{}

\begin{equation}
y^{\prime}=p(x)y\label{eqn1}
\end{equation}
{\usebeamercolor[fg]{structure}\eqref{eqn1}} is a linear differential equation of first order.

\end{frame}

\end{document}
  • 1
    Can you make a minimal example to play with? – egreg Feb 28 '15 at 21:18
2

Just redefine \eqref to incorporate the color change:

\documentclass[10pt]{beamer}

\usepackage{amsfonts}

\usetheme{Warsaw}
\usecolortheme{whale}

\makeatletter
\renewcommand\eqref[1]{%
  \textup{\usebeamercolor[fg]{structure}\tagform@{\ref{#1}}}%
}

\begin{document}

\begin{frame}{}

\begin{equation}
y'=p(x)y\label{eqn1}
\end{equation}
\eqref{eqn1} is a linear differential equation of first order.

\end{frame}

\end{document}

enter image description here

  • Can I also edit this for \ref and \cite? – bkarpuz Feb 28 '15 at 22:00
  • @bkarpuz That's more difficult, because \ref and \cite are not really supported by beamer. And \cite may depend on the bibliography package manager you use, for instance natbib or biblatex. In my opinion \ref and \cite should be used very sparingly in a beamer document. – egreg Feb 28 '15 at 22:04
2

You could redefine the internal macro \tagform@ to tell it to render its output in blue (or whatever color you prefer).

I'd consult chapter 17, "Colors", of the beamer user guide for information about all colors that beamer and its various styles use.

enter image description here

\documentclass{beamer}
\makeatletter   % add "\color{blue}" to argument of "\maketag@@@"
\def\tagform@#1{\maketag@@@{\color{blue}(\ignorespaces#1\unskip\@@italiccorr)}}
\makeatother
\usetheme{Warsaw}
\usecolortheme{whale}

\begin{document}

\begin{frame}{}
\begin{equation} \label{eqn1}
y'=p(x)y 
\end{equation}

\eqref{eqn1} is a linear differential equation of the first order.
\end{frame}
\end{document}
  • I just want to change \eqref color not the equation color. Is that possible? – bkarpuz Feb 28 '15 at 21:53
  • @bkarpuz - Visual cues are least likely to be misinterpreted if they are used consistently: If you want to color an equation number in a cross-reference, it's helpful to your audience if the original equation number uses the same color. – Mico Feb 28 '15 at 22:05
  • My idea is just to make clickable links colored. – bkarpuz Mar 1 '15 at 7:06
  • 1
    To make all cross-references colored, you're better off simply loading the hyperref package with the option colorlinks. – Mico Mar 1 '15 at 7:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.