# How to make a line break at the title of the parts?

As a continuation of this question: How to center a tcolorbox at a part title at KOMA-script article, if you see the But note of this answer this solution is good only if I don't break lines, i.e., I can put the whole title in one line.

So, my question is, how can I do the same but with line breaks?

Here is a MWE:

\documentclass{scrartcl}
\usepackage{tcolorbox}
\renewcommand*{\raggedpart}{\centering}
\renewcommand*{\partformat}{\partname~\thepart\autodot\enskip}
\renewcommand\partlineswithprefixformat[3]{%
\tcbox[center,width=\linewidth/2]{\underline{#2#3}}%
}
%\usepackage{showframe}% to see the page areas
\begin{document}
\part{The quick brown fox jumped over the lazy dog''}
\end{document}


## 1 Answer

You can e.g. use a \parbox inside. But don't use underline then, at first it doesn't work with line breaks, and at second it would look horrible if you have lines everywhere.

\documentclass{scrartcl}
\usepackage{tcolorbox}
\renewcommand*{\raggedpart}{\centering}
\renewcommand*{\partformat}{\partname~\thepart\autodot\enskip}
\renewcommand\partlineswithprefixformat[3]{%
\tcbox[center,width=\linewidth/2]{\parbox{0.5\linewidth}{%
\centering#2#3\par\vspace{-0.5\baselineskip}\hrulefill}}%
}
%\usepackage{showframe}% to see the page areas
\begin{document}
\part{The quick brown fox jumped over the lazy dog''}

\part{Short}
\end{document}


• As I wrote, it would look horrible and I don't want to spent my time to check if one can implement it with soul or ulem (but even if it works, it will probably break as soon as you add your hebrew). – Ulrike Fischer Mar 13 at 18:26