2

Good Evening,

as I am new to this whole Tex thing, making bigger adjustments to the presets still poses a problem. Basically, I want to change the setting for the headings, so they look like this:

enter image description here

I dont know how to align the name of the heading with the text below and how to add an indent to the heading: I don't even know how to approach this. Gooogle didn't exactly deliver.

I hope someone can help.

  • 2
    While Google didn't deliver, could you deliver? That is, provide us with some frame of reference in the form of a minimal working example (MWE)? – Werner Jul 13 '15 at 16:02
4

Here's an option for the standard classes, using the titlesec package:

enter image description here

The code:

\documentclass{article}
\usepackage{titlesec}
\usepackage{lipsum}% just for the example

\newlength\TitleOverhang
\setlength\TitleOverhang{1.5cm}

\newcommand\Overhang[1]{%
  \llap{\makebox[\TitleOverhang][l]{#1}}%
}

\titleformat{\section}
  {\normalfont\Large\bfseries}{\Overhang{\thesection}}{0em}{}
\titleformat{\subsection}
  {\normalfont\large\bfseries}{\Overhang{\thesubsection}}{0em}{}
\titleformat{\subsubsection}
  {\normalfont\normalsize\bfseries}{\Overhang{\thesubsubsection}}{0em}{}

\begin{document}

\section{A test section}
\subsection{A test subsection}
\lipsum[4]
\subsubsection{A test subsubsection}
\lipsum[4]
\subsection{Another test subsection}
\lipsum[4]

\end{document}

Changinf the value for \TitleOverhang (default=1.5cm), you can easily control the distance from the numbers to the left margin. I only provided code down to \subsubsection; for lower sectional units you could use

\titleformat{\paragraph}[runin]
  {\normalfont\normalsize\bfseries}{\Overhang{\theparagraph}}{0em}{}
\titleformat{\subparagraph}[runin]
  {\normalfont\normalsize\bfseries}{\Overhang{\thesubparagraph}}{0em}{}
\titlespacing*{\subparagraph} 
  {0pt}{3.25ex plus 1ex minus .2ex}{1em}
  • Thank you very much, this is exactly what I was looking for. – Anton Hinneck Jul 13 '15 at 17:27

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.