I am currently workin on a big tikz figure and I want to place a section heading inside a box, which leads to a problem. A minimal example is here:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=0cm,bmargin=0cm,lmargin=0cm,rmargin=0cm,headheight=0cm,headsep=0cm,footskip=0cm}
\usepackage{color}
\usepackage{titlesec}
\titleformat{\section}[runin]{\normalfont}{}{1em}{before}[after]
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\section{testsection}
\begin{tikzpicture}[inner sep=1pt, scale=1]%
\node[inner sep=2pt, text width=94mm,draw] (0,0){\section{xxx in section yyy}};
\end{tikzpicture}%
\end{document}
The result does not match my expectation. I was expecting, that the section heading is placed inside the box as depicted in the following figure:

The section heading is inside the box, if I replace the titlesec package option "runin" by "hang". But then, the section heading is sourrounded by spaces and boxes and I want to get rid of them, so that the section heading can freely be used as text in the tikz-environment.
Any hints are appreciated.


\titleformat. – Salim Bou Jul 23 '15 at 10:13