# Add margin left to \section and \subsection

I am looking for a way to change the margin form the left of the titles in LaTeX. I´ve added a picture to clarify my concern:

Is there a way, to change the margins of the titles of the sections, and only the titles, and not the entire paragraph below?

• Could you please add information on which document class you are using? – leandriis Oct 5 '17 at 9:37

For standard classes (not KOMA script classes as leandriis has pointed out) you can use the titlesec package to change the format and spacing of sections, subsections and so on. See page 4 for an explanation of \titleformat and \titlespacing and their optional arguments which I have not shown here for simplicity.

I have changed the <left> argument of the \titlespacing command to an arbitry value of 1em (which is usually 0). Change it however you want. The other values in the code below are taken from subsection 9.2. Standard Classes on page 23 and should be the values usually used by LaTeX.

The example below indents sections. Indenting subsections and subsubsections works in the same way.

\documentclass{article}

\usepackage{titlesec}

%\titleformat
%   {\section} % <command>
%   {\normalfont\Large\bfseries} % <format>
%   {\thesection} % <label>
%   {1em} % <sep>
%   {} % <before-code>

\titlespacing* % starred version: first paragraph is not indented
{\section} % <command>
{1em} % <left>
{3.5ex plus 1ex minus .2ex} % <before-sep>
{2.3ex plus .2ex} % <after-sep>

\usepackage{blindtext}

\begin{document}
\section{Test}
\blindtext
\end{document}


• Could you please add the document class you have used to test your solution? For me it works fine with standard classes, however due to the incompatibility with the titlesec package, it does not work with KOMA script classes. Information on how to indent sectioning heading using KOMA scriptclasses can be found for example here: tex.stackexchange.com/a/227936/134144 – leandriis Oct 5 '17 at 9:45
• @leandriis thanks for the hint. I have edited my answer. – jakun Oct 6 '17 at 9:55
• @Lebyproc I am glad if I could help. If the answer has answered your question please accept it. – jakun Oct 6 '17 at 9:58