4

I have got a simple problem concerning multi-line chapter/section titles, that I could not fix.

This is how it is:

enter image description here

and this is how I want it to be:

enter image description here

(I want the second line of the title to line up with the first one)

I have read somehow relevant answers who use the titlesec package. As far as possible I want to avoid that. I read a few pages in the KOMA guide but without a solution. Please tell me, if you know some KOMA-options or KOMA-commands to fix this.

Thank you in advance.

edit: I am sorry, but I forgott the probably most important thing: used \newline or \\ because the hypertension was ugly.

MWE: I noticed, that I made a mistake in the description of my problem. I used \\ or \newline to break the line. Here the MWE:

\documentclass[%
a4paper, 
11pt
]{scrreprt}

\usepackage{lipsum}
\begin{document}
    \section{Title long enough to flow in the second line\\ and indent matching the previous line}
    \lipsum[1]
\end{document}
famura
  • 93
  • Please, provide minimal working example which show your problem. – Zarko Oct 05 '15 at 10:22
  • 1
    If you compile `\documentclass{scrartcl} \usepackage{lipsum}

    \begin{document} \section {Title long enough to flow in the second line and indent matching the previous line} \lipsum[1] \end{document}` you get what you desired. So, we need a MWE.

    –  Oct 05 '15 at 10:34
  • I noticed, that I made a mistake in the description of my problem. I used \ or \newline to break the line. Here the MWE: \documentclass[% a4paper, 11pt ]{scrreprt}

    \usepackage{lipsum} \begin{document} \section{Title long enough to flow in the second line\ and indent matching the previous line} \lipsum[1] \end{document}

    – famura Oct 05 '15 at 12:31
  • See also https://tex.stackexchange.com/questions/491339/indent-wrapped-chapter-title | https://tex.stackexchange.com/questions/522359/indent-for-second-line-in-long-chapter-title | Reverse question https://tex.stackexchange.com/questions/628624/justify-section-number-and-multi-line-section-title – user202729 Jan 01 '22 at 00:57

2 Answers2

3

Using \newline instead \\ works for me:

\documentclass{scrreprt}

\usepackage{lipsum}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Title long enough to flow in the second line\newline and indent matching the previous line}
\lipsum[1]
\end{document}

enter image description here

But note that the same line break will be in the table of Contents. To avoid this use the optional argument of \section:

\documentclass{scrreprt}

\usepackage{lipsum}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section
  [Title long enough to flow in the second line and indent matching the previous line]
  {Title long enough to flow in the second line\newline and indent matching the previous line}
\lipsum[1]
\end{document} 
esdd
  • 85,675
  • Ok. It works in my or your MWE, but not in my "real" document. How could I have changed that (not on purpose). Do you know some packages, that change this behaviour. (I did not use titlesec for now) – famura Oct 06 '15 at 05:54
  • You have to expand your MWE a little bit so that it shows this problem with \newline too. If you are German then you can read the instructions in http://texwelt.de/wissen/fragen/569/was-ist-ein-vollstandiges-minimalbeispiel-oder-kurz-vm-und-wie-erstelle-ich-dieses/570 – esdd Oct 06 '15 at 06:39
1

Check this.

\documentclass{article}
\usepackage{lipsum}
\usepackage{titlesec}

\titleformat{name=\section}
  {\normalfont\Large\bfseries}{\thesection}{1em}{\hspace{0em}}{}
  \begin{document}
  \section {Title long enough to flow in the second line and indent matching the previous line}
  \lipsum[1]
  \end{document}

enter image description here

  • I noticed, that I made a mistake in the description of my problem. I used \ or \newline to break the line. Here the MWE: \documentclass[% a4paper, 11pt ]{scrreprt}

    \usepackage{lipsum} \begin{document} \section{Title long enough to flow in the second line\ and indent matching the previous line} \lipsum[1] \end{document} I don't want to use the titlesec package if it is not necessary...

    – famura Oct 05 '15 at 12:33