0

I would like to highlight a text with a node where the node frame would appear in background and where the node label would appear in foreground (the text itself being in the middle of both).

For now, I managed to work with a solution that split the node frame and the node label in two distinct code, one take place before the text and the other one after the text (thus having a default depth determined by the position in the code).

But, I am not really happy with this solution because you split in two constructs that are semantically linked to each other. So, I wonder if there is a simple way to force the node frame and the node label to be, respectively, in background and foreground.

Here is a stripped down example of my current code:

\documentclass[10pt,a4paper]{beamer}
\usepackage{tikz}

\begin{document}

 \begin{frame}
   \frametitle{Example}

   \onslide<2->{%
     \tikz[overlay]{%
       \node[rectangle,draw,thick,text centered,rounded corners,
            minimum height=1.35cm,minimum width=10.5cm,fill=blue!35]
       at (5.85,-1.5) {};
     }
   }
   \vfill

   \begin{itemize}
   \item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
     vitae pharetra nisl. Class aptent taciti sociosqu ad litora
     torquent per conubia nostra, per inceptos himenaeos.
   \vfill

   \item Donec ullamcorper bibendum sem. Nulla venenatis non augue ac
     cursus. Pellentesque nec nisl ut ligula pellentesque porttitor eu
     rutrum lectus.
   \vfill

   \item Sed lacinia augue sit amet tempus lobortis. Suspendisse
     varius, libero ac consectetur varius, nisi est aliquam arcu, id
     varius nisl dolor sit amet odio.
   \end{itemize}
   \vfill

   \onslide<2->{%
     \tikz[overlay]{%
       \node at (5.85,5.45) {\Huge\bfseries Lorem Ipsum};
     }
   }
 \end{frame}
\end{document}

First Slide Second Slide

2

labels have a special anchor point which is center. This center is main node center, therefore it's easy to place a label on the foreground while node contents is in background, add label={[font=\Huge\bfseries]center:Loren Ipsum} to node options.

\documentclass[10pt,a4paper]{beamer}
\usepackage{tikz}

\begin{document}

 \begin{frame}
   \frametitle{Example}

   \onslide<2->{%
     \tikz[overlay]{%
       \node[rectangle,draw,thick,text centered,rounded corners,
            minimum height=1.35cm,minimum width=10.5cm,fill=blue!35,
            label={[font=\Huge\bfseries]center:Loren Ipsum}]%<---------------
       at (5.85,-1.5) {};
     }
   }
   \vfill

   \begin{itemize}
   \item Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
     vitae pharetra nisl. Class aptent taciti sociosqu ad litora
     torquent per conubia nostra, per inceptos himenaeos.
   \vfill

   \item Donec ullamcorper bibendum sem. Nulla venenatis non augue ac
     cursus. Pellentesque nec nisl ut ligula pellentesque porttitor eu
     rutrum lectus.
   \vfill

   \item Sed lacinia augue sit amet tempus lobortis. Suspendisse
     varius, libero ac consectetur varius, nisi est aliquam arcu, id
     varius nisl dolor sit amet odio.
   \end{itemize}
   \vfill

%   \onslide<2->{%
%     \tikz[overlay]{%
%       \node at (5.85,5.45) {\Huge\bfseries Lorem Ipsum};
%     }
%   }
 \end{frame}
\end{document}

enter image description here

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.