5

i want to break my section heading in a new line.

\section{Underactuated mechanical systems \\ with servo constraints}

But the new line does not align with the first word Underactuated but align with the Section number 4.1. It looks not good.

\documentclass[
openright,
listof=totoc,
bibliography=totoc,
two‌​side,
fontsize=12pt,
e‌​nglish,
parskip=half,‌​
headinclude,
footincl‌​ude=false,
headseplin‌​e,DIV17,
BCOR16mm,
num‌​bers=noenddot,
2.1hea‌​dlines,
appendixprefi‌​x,
cleardoublepage=em‌​pty]
{scrbook}
David Carlisle
  • 757,742

2 Answers2

9

Use \newline:

\documentclass{scrbook}
\begin{document}
\section
  [Underactuated mechanical systems with servo constraints]
  {Underactuated mechanical systems \newline with servo constraints}
\end{document}

enter image description here

Or you can redefine \sectionlinesformat to measure the width of the section number and use a \parbox for the section title text:

\documentclass{scrbook}
\newdimen\sectionnumberwidth
\newbox\sectionnumber
%\renewcommand\raggedsection{\raggedleft}
\makeatletter
\renewcommand\sectionlinesformat[4]{%
  \sbox\sectionnumber{\hskip#2#3}%
  \setlength\sectionnumberwidth{\wd\sectionnumber}%
  \@hangfrom%
    {\usebox\sectionnumber}%
    {\parbox[t]{\dimexpr\textwidth-\sectionnumberwidth\relax}{\raggedsection #4}}%
}
\makeatother
\begin{document}
\tableofcontents
\section
  [Underactuated mechanical systems with servo constraints]
  {Underactuated mechanical systems \\ with servo constraints}
\end{document}

BTW: Use DIV=17 and BCOR=16mm instead of the obsolete options DIV17 and BCOR16mm.

\documentclass[
%openright,% default
listof=totoc,
bibliography=totoc,
%twoside,% default
fontsize=12pt,
english,
parskip=half,
headinclude,
footinclude=false,
headsepline,
DIV=17,% <- changed
BCOR=16mm,% <- changed
numbers=noenddot,
headlines=2.1,% <- changed
appendixprefix,
%cleardoublepage=empty% default
]
{scrbook}
esdd
  • 85,675
4

A solution that does not require to go into the details of scrbook is

\section
  [Underactuated mechanical systems with servo constraints]%
  {\parbox[t]{15em}{Underactuated mechanical systems with servo constraints}}

The optional argument is needed for the table of contents and page headings.

enter image description here

\documentclass[12pt]{scrbook}
\begin{document}
\setcounter{chapter}{4}
\section
  [Underactuated mechanical systems with servo constraints]%
  {\parbox[t]{15em}{Underactuated mechanical systems with servo constraints}}
\end{document}
gernot
  • 49,614
  • @PeterYang Please unaccept my answer and accept the answer of esdd instead, it is definitely the better one. – gernot Mar 07 '17 at 11:03