# Positioning tikz drawings under text

I am pretty new to latex and tikz, so this might be a simple question, however I am not really able to position my tikz drawing how I want it. So I defined my own section command, and what I want i simple: below the section title, I want a fading line. This is what I did so far:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}

\usepackage{xcolor}
\usepackage{tikz}

\newcommand{\mysection}[1]{

\begin{flushleft}  %I want it at the left border of the paper
\large \sffamily \bfseries \color{blue} #1
\tikz \filldraw[red, rounded corners = 0.6mm, path fading = east] (0,0) rectangle (\textwidth, 1.3mm);
\end{flushleft}
}

\begin{document}

\mysection{First one}
\end{document}


However for me this still looks ugly, because the rectangle is not below the text (the vertical space between is to big). I thought I could change it by changing the coordinates of (0,0) onto negative values, but this is not working.

• Welcome to TeX SX! Your sections won't be numbered? Or only the unnumbered section will have this layout? – Bernard Jul 29 '18 at 13:53
• Tikz normally moves the origin to fit the space. [overlay] will place the origin at the baseline of the current position in the text. Also, \noindent is generally sufficient. – John Kormylo Jul 29 '18 at 13:53
• Be aware that your section command won't update the table of contents, the headers and allows a page break after it. – Ulrike Fischer Jul 29 '18 at 13:58
• It is on purpose, that the sections are not numbered, but thank you for the helpful comment about the toc. So I should add overlay and it would reposition it? Or I misunderstood what you are trying to say.... anyways that is not changing my final result :/ – beginner_of_beginner Jul 29 '18 at 14:05

Here is a simple solution with titlesec:

\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{tikz}