4

Nowhere have I been able to see an example of using a color other than a shade of gray to color the labels revealed in LaTeX by \usepackage{showkeys}.

For example, suppose I want labels to be revealed in a (light) green and the refs to those labels to be labeled in a (light) red or, better yet, a (light) pink. How does one do this?

I'm well aware that \usepackage{show keys} "colors" the keys — but unfortunately the color is always gray. How change that?

5

The package showkeys uses following code

\let\SK@refcolor\relax
\let\SK@labelcolor\relax
\DeclareOption{color}{\AtEndOfPackage{%
  \RequirePackage{color}%
  \definecolor{refkey}{gray}{.75}%
  \definecolor{labelkey}{gray}{.75}%
  \def\SK@refcolor{\color{refkey}}%
  \def\SK@labelcolor{\color{labelkey}}}}

in order to set the colour. refkey and labelkey are both set to a light gray 'colour'. It is sufficient to use a different definition of the refkey and labelkey colours.

\documentclass{article}

\usepackage[color]{showkeys}

\definecolor{refkey}{rgb}{0,0,1}
\definecolor{labelkey}{rgb}{0,1,0}
\begin{document}
\section{My nice section}\label{foosection}


In \ref{foosection} we saw that\dots
\end{document}

enter image description here

  • thanks! That's what other posts here and elsewhere seem never to have gotten around to showing explicitly. – murray Jul 29 '16 at 15:49
  • @murray: Sometimes (or very often? ;-)) it's necessary to dive into the .sty file ;-) – user31729 Jul 29 '16 at 15:50
  • Now I need to figure out what named colors are available. I'm using pdflatex from TeXShop's menu system and haven't a clue what driver is being used. Or is there some other way to find out? – murray Jul 29 '16 at 15:56
  • @murray: See the xcolor documentation: There's a lot of information which colour names are available. You can name your colours of course yourself as you like – user31729 Jul 29 '16 at 15:58
  • Will using package xcolor cause any difficulty in that usepackage[color]{showkeys} already automatically causes package color to be loaded? – murray Jul 29 '16 at 16:21

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.