3

Is there an easy way to align the text block with a section title? It should look like this:

1      Introduction
       This is an example text.

1.1    Section
       This text should also be intended.

1.1.1  Subsection
       \ldots :)

PS: I am using the scrreprt documentclass.

6

Redefine \chapterformat and \@seccntformat appropriately; change the length \mylen according to your needs:

\documentclass{scrreprt}
\usepackage{lipsum}

\newlength\mylen
\setlength\mylen{2cm}

\renewcommand*{\chapterformat}{%
  \llap{\protect\makebox[\mylen][l]{\chapappifchapterprefix{\nobreakspace}\thechapter\autodot\hfill}}%
}
\makeatletter
\def\@seccntformat#1{\llap{\protect\makebox[\mylen][l]{\csname the#1\endcsname\autodot\hfill}}}
\makeatother

\begin{document}

\chapter{Introduction}
\lipsum[4]
\section{Text Section}
\lipsum[4]
\subsection{Text Subsection}
\lipsum[4]

\end{document}

enter image description here

  • I forgot to mention that i need this for sections, too. There seems to be no \sectionformat to set. – klingt.net Jun 12 '13 at 13:02
  • @klingt.net Just sections or also subsections, subsubsections? – Gonzalo Medina Jun 12 '13 at 13:06
  • Even sub- and subsubsections, but they should not be intended more than the chapter. – klingt.net Jun 12 '13 at 13:07
  • @klingt.net please see my updated answer. – Gonzalo Medina Jun 12 '13 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.