# Why the text at the box not in the center?

Look at the code below:

 % Preview source code

%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english,hebrew]{article}
\usepackage{fontspec}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{5}
\setlength{\parindent}{0bp}
\usepackage{color}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

\makeatletter

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{theorem}
\theorembodyfont{\upshape}

% The following chunk fixes export with XeTeX.
% It is needed because polyglossia is used by default
% and \make@lr is only defined by babel.
\@ifundefined{make@lr}
{\def\make@lr#1{\begingroup
\toks@=\expandafter{#1}%
\edef\x{\endgroup
\def\noexpand#1{\noexpand\@number{\the\toks@}}}%
\x}}{\relax}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage[many]{tcolorbox}
\usepackage[framemethod=TikZ,framemethod=pstricks]{mdframed}
\tcbset{enhanced,colback=red!5!white,
boxrule=0pt,
colframe=blue!75!black,fonttitle=\bfseries}
\titleformat{\part}
{\normalfont\bfseries\Huge\selectfont}
{}{0pt}
\center{Part\hskip0.7em\thepart\newline#1}\end{tcolorbox}}[]

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{english}[variant=american]%

\part{Simple}

\end{english}%
\tableofcontents{}
\end{document}


This is the result:

What Part I is not at the center like Simple?

Thank you!

• \center is not a command with an argument; remove it and also the related braces; \newline is known to not work as maybe expected in a center context. By the way, loading mdframed with two methods doesn't make much sense; since tcolorbox is much more powerful than mdframed, it's probably better to avoid mdframed. – egreg Jul 29 '18 at 21:16
• @egreg, yes, but sometimes mdframed is much more simple... This is why I prefer to load it also :) – heblyx Jul 30 '18 at 8:18

\begin{tcolorbox}[drop large lifted shadow=black,halign=center]

• Thank you!! BTW when you say "Use only" what do you mean? To do it only at { } or to other thing? (Because I want to do with it more:) ) – heblyx Jul 29 '18 at 19:00
• @heblyx, it means to use only that code inside tcolorbox. So, replace what is inside. The other part of your code has no relation with that. – Sigur Jul 29 '18 at 19:08