[Tex/LaTex] Remove indent of first paragraph when using titlesec package

indentationsectioningtitlesec

I use the titlesec to format section in book class. The section pos to leftmargin, but when I compiled, the firs paragraph have indent. How to remove indent automatically.

\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\normalfont\vspace{12pt}
    \titlerule*[.6em]{\bfseries.}%
    \vspace{6pt}%
    \sffamily\bfseries\filleft}
{\thesection\\}{.5em}{}[]
\titlespacing{\section}{7pc}{1.5ex plus .1ex minus .2ex}{1pc}

enter image description here

Best Answer

You have to use the starred version of \titlespacing.

\titlespacing*{\section}{7pc}{1.5ex plus .1ex minus .2ex}{1pc}

Code:

\documentclass{book}
\usepackage{titlesec}
\titleformat{\section}[leftmargin]
{\normalfont\vspace{12pt}
    \titlerule*[.6em]{\bfseries.}%
    \vspace{6pt}%
    \sffamily\bfseries\filleft}
{\thesection\\}{.5em}{}[]
\titlespacing*{\section}{7pc}{1.5ex plus .1ex minus .2ex}{1pc}
\begin{document}
  \section{Some section here}
  Some text here Some text here Some text here Some text here Some text here Some text here Some text here
\end{document}

enter image description here