[Tex/LaTex] Section indent or leftmargin

indentationsectioningtitlesec

I use the titlesec package for decoration sections and subsections. But i do not know how to change leftmargin or indent for this.
Look at the picture, the green line is where i want to move the section.

I use this code

\documentclass[a4paper, 14pt]{extreport}
\usepackage{titlesec}

\titleformat{\section}{}{\thesection}{14pt}{}

enter image description here

Best Answer

A layout as you'd like can be obtained by

\documentclass{report}
\usepackage{indentfirst}
\usepackage{titlesec}
\usepackage{lipsum}

\newlength{\normalparindent}
\AtBeginDocument{\setlength{\normalparindent}{\parindent}}

\titleformat{name=\section}[block]
  {\LARGE}
  {\hspace*{\normalparindent}\thesection}
  {1em}
  {}

\titleformat{name=\section,numberless}[block]
  {\LARGE}
  {}
  {0pt}
  {\hspace*{\normalparindent}}

\begin{document}

\section{Lorem Ipsum Dolor}
\lipsum[1]

\section*{Nam Dui Ligula}
\lipsum[2]

\end{document}

It's necessary to specify the numberless variant, otherwise the indentation would not be respected for unnumbered sections. Adjust the size (I used \LARGE) and the spacing between the number and the title (I used 1em).

The definition and setting of \normalparindent is necessary because the value of \parindent is not available (better, it's set to zero) when LaTeX is typesetting a section title.


enter image description here


Note. I don't like such a layout at all.

Related Question