dimanche 30 novembre 2014

Draw on background rectangle


I have the following code:



\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}

\begin{document}
\begin{tikzpicture}[framed, background rectangle/.style={draw=black!15,fill=black!5,rounded corners=1ex}]
\node (a) at (1,1) {a};
\end{tikzpicture}
\end{document}


It produces:


picture1


Now I want to have an ellipse on the top darker line like:


picture2


My problem is that this ellipse should be predefined by some definition which gets at #1 some text to be drawn inside the ellipse. Finally I want to save the "style" (maybe its an option I couldn't get it by long research) as mybackground. So my aim is to write:



\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{backgrounds}

\begin{document}
\begin{tikzpicture}[mybackground=#1]
\node (a) at (1,1) {a};
\end{tikzpicture}
\end{document}


To get the same result but now it should get #1 and write it in the ellipse.





Aucun commentaire:

Enregistrer un commentaire