# customization of section with tikz and titlesec

i'm trying to customize the title of sections in my document using the packages tikz and titlesec.

Unfortunately, that does not work and i need some help to solve my problem.

I get this error :

! Argument of \tikz@next has an extra }.
<inserted text>
\par
l.25 \section{Problem}
I've run across a }' that doesn't seem to match anything.


Here is my code :

\documentclass[a4paper, 11pt]{article}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{titlesec}
\usepackage[x11names]{xcolor}
\usepackage{tikz}
\titleformat{\section}
{%
\tikz[anchor=base,baseline,outer sep=0pt]
}{0em}{}

\begin{document}
\tikz[anchor=base,baseline,outer sep=0pt]

\section{Problem}

\end{document}


• Welcome to TeX.SX! Is that the exact error you get when running your MWE? It ran perfectly fine without any errors or warnings here (up to date MikTeX 2.9). Maybe your TeX distribution needs updating. (I'm a bit confused because the error message mentions line 25, while your MWE only has 24 lines.) – moewe Oct 7 '15 at 8:21
• you can use \begin{tikzpicture}...\end{tikzpicture} – touhami Oct 7 '15 at 14:58

It ran fine for me too, but you can try the following simpler code to get the same result with tcolorbox (which anyway relies on tikz):

\documentclass[a4paper, x11names, 11pt]{article}
\usepackage[francais]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tcolorbox}
\usepackage{titlesec}

\titleformat{\section}
`