I had a friend help me change the \paragraph
section to include a line break after the end of the section title. However the end result is a ragged section that isn't justified and if the title is too long and requires more than one line it ends up away from the margin.
Is there a better way to achieve a justified \paragraph
(or \subparagraph
) with a line break, and on another note a way to control the line spacing between the \paragraph
and the text?
MWE:
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{setspace}
\usepackage{kpfonts}
\usepackage[T1]{fontenc}
\usepackage[left=2.5cm,right=2.5cm,top=3cm,bottom=3cm]{geometry}
\doublespacing
\setcounter{secnumdepth}{5} %
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{-3.25ex \@plus -1ex \@minus -0.2ex}%
{0.01pt}%
{\raggedsection\normalfont\sectfont\nobreak\size@paragraph}%
}
\makeatother
\begin{document}
\chapter{Testing begins}
\section{Going deeper}
\paragraph{Testing an unnecessarily long title to see what happens with the end of the paragraph margin, whether it aligns to the text margin or not}
\lipsum[1]
\end{document}
Best Answer
Simply remove
\raggedsection
from your definition.MWE