0

I want to adjust the title indentation for all the section and subsection titles as shown in the image. How can I achieve this using the titlesec or other similar packages?

This is a minimal version of my current code.

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}

[...]

\usepackage{geometry} \geometry{ a4paper, left=3.5cm, right=2cm, top=3.5cm, bottom=2cm }

[...]

\begin{document} \section{Introduction} \subsection{Background} \subsubsection{Machine Reading Comprehension (MRC)} MRC is a subfield.........

[...]

\end{document}

What I want: enter image description here

What I have: enter image description here

I am using a documentclass{report} and my section titles are in the left edge of the paper by default. But I would like to indent them 3.5mm from the left edge of the paper as shown in the above image.

Ingmar
  • 6,690
  • 5
  • 26
  • 47

2 Answers2

1

enter image description here

\documentclass{article}
\usepackage{titlesec}
%1inch=25,4mm
\titlelabel{{\hspace*{1cm}\makebox[1cm][l]{\thetitle}}}
%\usepackage{indentfirst}
\usepackage{lipsum}
\usepackage{showframe}
\begin{document}
    \section{foo}
    \hspace*{25.4mm}\lipsum[1]
    \section{bar}
    \subsection{foo bar}
    \lipsum[1]
\end{document}
js bibra
  • 21,280
1

Welcome to TEX.SE! I use titlesec package to meet this requirement.

\documentclass{report}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage[showframe]{geometry}
\geometry{
a4paper,
left=3.5cm,
right=2cm,
top=3.5cm,
bottom=2cm
}

\titleformat{\chapter}{\normalfont\huge\bfseries}{\thechapter .}{3.5mm}{} \titlespacing{\chapter}{3.5mm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex} \titleformat{\section}{\normalfont\Large\bfseries}{\thesection .}{3.5mm}{} \titlespacing{\section}{3.5mm}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex} \titleformat{\subsection}{\normalfont\large\bfseries}{\thesubsection .}{3.5mm}{} \titlespacing*{\subsection}{3.5mm}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex} \begin{document} \chapter{Introduction} \section{Background} \subsection{Machine Reading} \lipsum[1] \end{document}

enter image description here

I got the length value from texdoc titlesec sec 9.2 "Standard Classes".

Syvshc
  • 1,328