I'm looking for a way to use transparency/opacity to highlight a particular area in a TikZ figure I generated. To be more specific, I have a TikZ figure that illustrates the relationship between several concepts. After I have shown this figure for the first time, I want to reuse it later in my document when I discuss specific concepts in more detail. To make clear which concept of the figure is discussed, I want to highlight the relevant part of the figure. It would be nice if there was a way in which I could leave the relevant part of the figure unchanged and make the rest of the figure somewhat faded using opacity. Is there a simple way to do this?
Update: Here's an MWE:
\documentclass[10pt]{article}
\usepackage{tikz}
\usepackage{fancyhdr}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[
opacity=0.5,
box/.style={rectangle,draw=black,
minimum size=1cm,text width=2.2cm,text centered,font=\small}]
%%% coordinates
\coordinate (CM) at ( 0.0, 3.0);
\coordinate (DM) at ( 0.0, 6.0);
\coordinate (MM) at ( 0.0, 9.0);
\coordinate (PR) at ( 0.0,12.0);
%%% nodes
\node[box] (cm) at (CM) {box 1};
\node[box] (dm) at (DM) {box 2};
\node[box] (mm) at (MM) {box 3};
\node[box] (pr) at (PR) {box 4};
%%% arrows
\draw[->] (dm.south) --
node[fill=white,align=center,text width=3.5cm,font=\small]
{\textsl{proc 1}} (cm.north);
\begin{scope}[opacity=1.0]
\draw[->] (mm.south) --
node[fill=white,align=center,text width=3.3cm,font=\small]
{\textsl{proc 2}} (dm.north);
\end{scope}
\draw[->] (pr.south) --
node[fill=white,align=center,text width=3.5cm,font=\small]
{\textsl{proc 3}} (mm.north);
\end{tikzpicture}
\end{document}
This does not quite do what I want because: (1) I would like to be able to specify a circle or rectangle that contain the highlighted portion of the figure, rather than having to explicitly select which commands should not be in the background. (2) Ideally, I would like to not have to modify the basic source for the figure so I can keep it in a separate file and simply input it and add the command to select the portion to be highlighted. (3) The text superimposed on the arrows works fine because of the white background when there is no opacity. But with opacity, the white background no longer covers the arrow. Is there an easier solution rather than drawing the arrows in two pieces?


opacity=0.5to thetikzpictureoptions to make everything slightly transparent, and setopacity=1for those parts of your drawing that you want highlighted. – Jake Aug 30 '12 at 8:18