パーツのタイトルで改行するにはどうすればいいですか?

パーツのタイトルで改行するにはどうすればいいですか?

この質問の続きとして:KOMA スクリプトの記事で tcolorbox をパーツタイトルの中央に配置する方法、あなたがしかし、注意してくださいこの答えこの解決策は、行を分割しない、つまりタイトル全体を 1 行にまとめることができる場合にのみ有効です。

そこで質問なのですが、改行を加えて同じことをするにはどうすればいいのでしょうか?

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

たとえば、内部で \parbox を使用できます。ただし、その場合は下線を使用しないでください。まず、改行では機能しませんし、どこにでも線があると見栄えが悪くなります。

\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}

ここに画像の説明を入力してください

関連情報