KOMA スクリプトの記事で tcolorbox をパーツタイトルの中央に配置する方法

KOMA スクリプトの記事で tcolorbox をパーツタイトルの中央に配置する方法

パートタイトルを中央に配置しようとしています。
これは MWE です:

  % Preview source code

%% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,twocolumn,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setlength{\parindent}{0bp}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth

\def\@outputdblcol{%
  \if@firstcolumn
    \global \@firstcolumnfalse
    \global \setbox\@leftcolumn \box\@outputbox
  \else
    \global \@firstcolumntrue
    \setbox\@outputbox \vbox {%
      \hb@xt@\textwidth {%
      \kern\textwidth \kern-\columnwidth %**
      \hb@xt@\columnwidth {%
         \box\@leftcolumn \hss}%
      \kern-\textwidth %**
      \hfil
      {\normalcolor\vrule \@width\columnseprule}%
      \hfil
      \kern-\textwidth  %**
      \hb@xt@\columnwidth {%
         \box\@outputbox \hss}%
      \kern-\columnwidth \kern\textwidth %**
    }%
  }%
  \@combinedblfloats
  \@outputpage
  \begingroup
  \@dblfloatplacement
  \@startdblcolumn
  \@whilesw\if@fcolmade \fi
  {\@outputpage
    \@startdblcolumn}%
  \endgroup
  \fi
}
\@mparswitchtrue

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair}

\usepackage{adforn}
\usepackage{tcolorbox}
\setkomafont{part}{\itshape}
\setkomafont{partnumber}{}
\renewcommand*{\partformat}{חלק~ :\thepart~~}
\renewcommand\partheadmidvskip{}
\renewcommand\partlineswithprefixformat[3]{\hfill\begin{center}\fontsize{20pt}{20pt}\selectfont{\begin{tcolorbox}[center]\underline{\adforn{36} 
            #2#3 \adforn{64}}\end{tcolorbox}}\end{center}\hfill}
\AtBeginDocument{\renewcommand*{\raggedpart}{\centering}}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}

\part{שלום}
\end{document}

出力は次のようになります。
ここに画像の説明を入力してください

多くのコマンドを試しましたが (MWE で確認できます)、ボックスはまだ右側にあります。

中央に移動するにはどうすればいいかご存知ですか?

重要な注意: tcolorbox を削除すると正常に動作します (タイトルが中央に移動します) - 問題はカラー ボックスを追加するときに発生します。

答え1

単純にする:

\documentclass{scrartcl}
\usepackage{tcolorbox}
\renewcommand*{\raggedpart}{\centering}
\renewcommand*{\partformat}{\partname~\thepart\autodot\enskip}
\renewcommand\partlineswithprefixformat[3]{%
  \tcbox{\underline{#2#3}}%
}
%\usepackage{showframe}% to see the page areas
\begin{document}
\part{Testpart}
\end{document}

中央パーツボックス

またはtwocolumnドキュメントクラスのオプションを使用します:

\documentclass[twocolumn]{scrartcl}
\usepackage{tcolorbox}
\renewcommand*{\raggedpart}{\centering}
\renewcommand*{\partformat}{\partname~\thepart\autodot\enskip}
\renewcommand\partlineswithprefixformat[3]{%
  \tcbox{\underline{#2#3}}%
}
%\usepackage{showframe}% to see the page areas
\begin{document}
\twocolumn[\part{Testpart}]
\end{document}

ただし、注意: この提案は、改行が必要ない場合にのみ機能します。また、\twocolumn常に新しいページが開始されます。

関連情報