0

Is there an automatic way to achieve the same indentation for a long section title? Automatic in the sense that I don't have to manually put \newline in the section title.

enter image description here

MWE:

\documentclass[10pt, oneside, bibliography=totoc, captions=tableheading, numbers=noenddot, headinclude, listof=totoc, toc=indentunnumbered]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[osf]{newpxtext}

\makeatletter
    \renewcommand{\sectionlinesformat}[4]{\Ifstr{#1}{section}{\formatsectionnumber{#3}\hspace{\marginparsep}\MakeLowercase{#4}}{\Ifstr{#1}{subsection}{\formatsectionnumber{#3}\hspace{\marginparsep}#4}}}
    \newcommand*{\formatsectionnumber}[1]{{\scshape#1}}
\makeatother

\setkomafont{section}{\large\fontfamily{qpl}\selectfont\normalfont\lsstyle\scshape}

\begin{document}
    \chapter{test}
    \section{Präsentation über die Anforderungen der Medical Device Regulation}
\end{document}

1 Answer 1

1

Use \@hangfrom:

\documentclass[10pt, oneside, bibliography=totoc, captions=tableheading, numbers=noenddot, headinclude, listof=totoc, toc=indentunnumbered]{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{microtype}
\usepackage[osf]{newpxtext}

\makeatletter
\renewcommand{\sectionlinesformat}[4]{%
  \Ifstr{#1}{section}
    {\@hangfrom{\formatsectionnumber{#3}\hspace{\marginparsep}}{\MakeLowercase{#4}}}
    {\Ifstr{#1}{subsection}
      {\@hangfrom{\formatsectionnumber{#3}\hspace{\marginparsep}}{#4}}
      {}% argument added, but what should be done for subsubsections and similar headings?
    }%
}
\newcommand*{\formatsectionnumber}[1]{{\scshape#1}}
\makeatother

\setkomafont{section}{\large\fontfamily{qpl}\selectfont\normalfont\lsstyle\scshape}

\begin{document}
    \chapter{test}
    \section{Präsentation über die Anforderungen der Medical Device Regulation}
\end{document}

enter image description here

You must log in to answer this question.

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