2

I am writing my bachelor thesis and my supervisor gave me a word template. I like LaTeX though and will convert the Word Template into a LaTeX template. I usually managed to do this, but now I am kind of stuck. I have tried to create an indent of 1.5cm between section title and section number with this command:

\usepackage{titlesec} \titlespacing*{\section}{0pt}{38pt}{10pt}
\titleformat{\section}{\normalfont\fontsize{14}{17}\bfseries}{\thesection}{1.5cm}{}
\titleformat{\subsection}{\normalfont\fontsize{12}{15}\bfseries}{\thesubsection}{1.5cm}{} 
\titleformat{\subsubsection}{\normalfont\fontsize{12}{15}\bfseries}{\thesubsubsection}{1.5cm}{}

This creates a 1.5cm space between my section number and section title, so it looks like this:

enter image description here

I want to copy this word setting:

enter image description here

So that it looks like this:

enter image description here

I have read through the titlesec documentation but haven't found anything that helps me. How can I achieve the desired margins between section number and section title?

1
  • 1
    So 1.5cm should be the distance between the left margin and the beginning of the sections titles?
    – Bernard
    Commented Sep 16, 2020 at 18:34

1 Answer 1

2

Is this what you want?

\documentclass{article}

\usepackage{titlesec}
\titlespacing*{\section}{0pt}{38pt}{10pt}
\titleformat{\section}{\sffamily\fontsize{14}{17}\bfseries}{\makebox[1.5cm][l]{\thesection}}{0pt}{}
\titleformat{\subsection}{\sffamily\fontsize{12}{15}\bfseries}{\makebox[1.5cm][l]{\thesubsection}}{0pt}{}
\titleformat{\subsubsection}{\sffamily\fontsize{12}{15}\bfseries}{\makebox[1.5cm][l]{\thesubsubsection}}{0pt}{}
\usepackage{lipsum}

\begin{document}

\setcounter{section}{1}\sffamily

\section{Background and theory}
\lipsum[2]

\subsection{B \& T subsection}
\lipsum[3]

\subsection{B \& T subsubsection. A very long title, spreading over two lines}
\lipsum[4]

\end{document} 

enter image description here

1
  • That is actually what I wanted, thank you a lot!!! :D Commented Sep 17, 2020 at 12:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .