I would like to use part of the answer to question TikZ, avoiding uneccessary ad-hoc coordinates calculation as the title of a section. How can I use such tikzpicture as the title of a section?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{
tikzmark,
backgrounds
}
\newcommand\constraint[1]{\textsc{#1}}
\begin{document}
\section{how to include the tikzpicture below as the title of this section?}
\begin{tikzpicture}[remember picture]
\node (ctr) {\constraint{\subnode{i}{increasing}\subnode{a}{\_}\subnode{m}{max}\subnode{b}{\_}\subnode{p}{peak}}};
\begin{scope}[on background layer]
\fill[brown!20] (i.north west) rectangle (a.south);
\fill[pink!20] (a.south) rectangle (m.north east);
\fill[violet!20] (b.north |- p.north) rectangle (p.south east);
\end{scope}
\end{tikzpicture}
\end{document}


\strut, see updated answer. – Henri Menke Sep 02 '18 at 11:28