1

Look at the code below:

 % Preview source code

%% LyX 2.3.0 created this file.  For more info, see http://www.lyx.org/.
%% 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,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
 {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}
  {\begin{tcolorbox}[drop large lifted shadow=black,halign=center]
    \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:

enter image description here

What Part I is not at the center like Simple?

Thank you!

  • 2
    \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
6

Use only

\begin{tcolorbox}[drop large lifted shadow=black,halign=center]
{Part~\thepart\\#1}
\end{tcolorbox}

enter image description here

  • 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
  • 1
    @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.