我该如何微调这个回忆录代码。我想做以下事情,如附图所示。
\documentclass[11pt,openany]{memoir}
\usepackage[none]{hyphenat}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage{framed}
\usepackage{tikz}
\usepackage{lmodern}
\usepackage{mdframed}
\usepackage{longtable}
\usepackage{mathtools}
\usepackage{glossaries}
\usepackage{makeidx}
\usepackage{hyphenat} % I use it to prevent hyphenation of table of contents items
%\usepackage{avant} % Use the Avantgarde font for headings
\usepackage{mathptmx}
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{smartdiagram}
\usesmartdiagramlibrary{additions}
\usepackage[most]{tcolorbox}
\usepackage{cleveref}
\tcbuselibrary{skins}
\RequirePackage{amsthm}
\usetikzlibrary{arrows}
\usepackage{tikz,lipsum}
\tcbuselibrary{skins,breakable}
\colorlet{MainGrey}{white!50!black}
\newcommand{\OwnerOne}{\textarabic{الكاتب المخضرم}
\geometry{
paperwidth=6.125in,
paperheight=9.25in,
top=0.75in, % Top margin
bottom=0.75in, % Bottom margin
left=0.75in, % Left margin
right=0.5in, % Right margin
inner=0.75in,
outer=0.5in,
headheight=14pt, % Header height
footskip=0.35in, % Space from the bottom margin to the baseline of the footer
headsep=0.35in, % Space from the top margin to the baseline of the header
twoside,
bindingoffset=0.13in
%showframe, % Uncomment to show how the type block is set on the page
}
\newcommand{\RedBarLength}{3em}
\newsavebox{\ChpNumBox}
\newsavebox{\ChpContBox}
\makeatletter
\newcommand*{\thickhrulefill}{%
\leavevmode\leaders\hrule height 3\p@ \hfill \kern \z@}
\newcommand*\BuildChpNum[3]{%
\begin{tabular}[t]{@{}c@{}}
\makebox[0pt][c]{#1\strut} \\[.5ex]
\colorbox{MainGrey}{%
\rule[-\RedBarLength-(#3)]{0pt}{0pt}%
\rule{1ex}{0pt}\color{white}#2\strut
\rule{.8ex}{0pt}}%
\end{tabular}}
\makechapterstyle{BoxedChapNum}{%
\renewcommand{\chapnamefont}{\large\scshape}
\setlength{\beforechapskip}{-30pt}
\setlength{\midchapskip}{10pt}
\setlength{\afterchapskip}{30pt}
\renewcommand{\printchaptername}{}
\renewcommand{\chapternamenum}{}
\renewcommand{\printchapternum}{%
% \startcontents[chapters]
% \sbox{\ChpContBox}{%
% \parbox{\linewidth}{%
% \printcontents[chapters]{}{1}{\color{blue}}%
% }}%
\sbox{\ChpNumBox}{%
\BuildChpNum{\color{black}\bfseries\chapnamefont\@chapapp}%
{\chapnumfont\HUGE\thechapter}%
{\ht\ChpContBox+\dp\ChpContBox}%
}}
% \renewcommand{\printchapternonum}{%
% \startcontents[chapters]
% \sbox{\ChpContBox}{%
% \parbox{\linewidth}{%
%% \printcontents[chapters]{}{1}{}% Useless?
% }}%
% \sbox{\ChpNumBox}{%
% \BuildChpNum{\chapnamefont\vphantom{\@chapapp}}%
% {\chapnumfont\hphantom{\thechapter}}%
% {\ht\ChpContBox+\dp\ChpContBox}%
% }}
\renewcommand{\afterchapternum}{}
\renewcommand{\printchaptertitle}[1]{%
\usebox{\ChpNumBox}\hfill
\parbox[t]{\hsize-\wd\ChpNumBox-1em}{%
\raggedleft\vspace{\midchapskip}%
{\color{MainGrey}\thickhrulefill}\\[10pt]
{\chaptitlefont\LARGE\textcolor{black}{\nohyphens{##1}}}\par\vspace*{10pt}
\renewcommand\cftsectionpagefont{\itshape\color{black}}
\renewcommand\cftsubsectionpagefont{\itshape\color{black}}
\renewcommand\cftsectionfont{\color{black}}
\renewcommand\cftsubsectionfont{\color{black}}
% \printcontents[chapters]{}{1}{}%
}}%
}
% ---------------- Styling parts ------------------
\renewcommand{\partnamefont}{\HUGE\scshape\centering\MakeLowercase}
\renewcommand{\partnumfont}{\HUGE\scshape\centering\MakeLowercase}
\renewcommand{\printparttitle}{\HUGE\scshape\centering\MakeLowercase}
\renewcommand{\printpartname}{\HUGE\color{black}}
\makeatother
\renewenvironment{leftbar}{%
\def\FrameCommand{\textcolor{black}{\vrule width 2pt depth 6pt}\hspace*{15pt}}%
\MakeFramed{\advance\hsize-\width\FrameRestore}}%
{\endMakeFramed}
% a command to circle the part numbers
\newcommand\Circle[1]{\tikz[overlay,remember picture]
\node[draw=black, circle, text width=18pt,line width=1pt,align=center] {#1};}
% redefinition of the name of the ToC
\renewcommand\printtoctitle[1]{\HUGE\bfseries#1}
\makeatletter
% redefinitions for part entries
\renewcommand\cftpartfont{\huge\bfseries\hfill}
\renewcommand\partnumberline[1]{%
\hbox to \textwidth{\hss\Circle{\textcolor{black}{#1}}\hss}%
\vskip3.5ex\par\hfill\color{black}}
\renewcommand*\cftpartformatpnum[1]{\hfill}
\renewcommand\cftpartafterpnum{\vskip1ex}
% redefinitions for chapter entries
\renewcommand\chapternumberline[1]{\raggedleft\mbox{\LARGE\@chapapp~#1}\par\noindent\Large}
%\renewcommand\chapternumberline{\Large}
\renewcommand\cftchapterfont{}
\cftsetindents{chapter}{0pt}{0em}
\renewcommand\cftchapterpagefont{\Huge\bfseries\color{black}}
\newcommand*{\l@mychap}[3]{%
\def\@chapapp{\color{black}#3}
\vskip1ex%
\par\noindent\begin{minipage}{\textwidth}%
\parbox{4.5em}{%
\hfill{\cftchapterpagefont#2}%
}\hspace*{1.5em}%
\parbox{\dimexpr\textwidth-4.5em-15pt\relax}{%
\leftbar\cftchapterfont{\color{black}#1}\hspace{1sp}\endleftbar%
}%
\end{minipage}\par%
}
\renewcommand*{\l@chapter}[2]{%
\l@mychap{#1}{#2}{\chaptername}%
}
\renewcommand*{\l@appendix}[2]{%
\l@mychap{#1}{#2}{\appendixname}%
}
% redefinitions for section entries
\renewcommand\cftsectionfont{\color{black}}
\renewcommand\cftsectionpagefont{\itshape\color{black}}
\renewcommand\cftsectionleader{\nobreak}
\renewcommand\cftsectiondotsep{\cftnodots}
\renewcommand\cftsectionafterpnum{\hspace*{\fill}}
\setlength\cftsectionnumwidth{12em}
\cftsetindents{section}{6em}{3em}
\renewcommand\cftsectionformatpnum[1]{%
\hskip1em\hbox to \@pnumwidth{{\cftsectionpagefont #1\hfill}}}
% redefinitions for subsection entries
\renewcommand\cftsubsectionfont{\color{black}}
\renewcommand\cftsubsectionpagefont{\itshape\color{MainRed}}
\renewcommand\cftsubsectionleader{\nobreak}
\renewcommand\cftsubsectiondotsep{\cftnodots}
\renewcommand\cftsubsectionafterpnum{\hspace*{\fill}}
\setlength\cftsubsectionnumwidth{12em}
\cftsetindents{subsection}{9em}{3em}
\renewcommand\cftsubsectionformatpnum[1]{%
\hskip1em\hbox to \@pnumwidth{{\cftsubsectionpagefont #1\hfill}}}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\makeatother
%%%% End of Pretty ToC
%%%%%% use the newly defined style
\chapterstyle{BoxedChapNum}
\settocdepth{subsection}
\setsecnumdepth{subsection}
\usepackage{fontspec}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}
\usepackage{polyglossia}
\setmainlanguage{arabic}
\setdefaultlanguage{arabic}
\setRTL
\begin{document}
\begingroup
\thispagestyle{empty} % Suppress headers and footers on the title page
\begin{tikzpicture}[remember picture,overlay]
\draw (current page.center) [anchor=north] node [fill=white,fill opacity=0.6,text opacity=1,inner sep=1cm]{\Huge\centering\bfseries\parbox[c][][t]{\paperwidth}{\centering التجربة\\[15pt] % Book title
{\Large \textarabic{أول كتاب شامل في الدول العالمية}}\\[20pt] % Subtitle
{\LARGE \OwnerOne \\ }}}; % Author name
\end{tikzpicture}
\vfill
\endgroup
\nouppercaseheads
\pagestyle{myheadings}
\frontmatter
\tableofcontents*
\newpage
\listoffigures
\newpage
\listoftables
\mainmatter
\part{بارت}
\chapter{السيارة }
\chapter{الطيارة}
\end{document}
答案1
这只是部分答案。
错误您的示例代码包含错误。请添加右括号。
\newcommand{\OwnerOne}{\textarabic{الكاتب المخضرم}}% <<< Closing brace added
更改章节名称。在之前\begin{document}
,添加以下几行。
\usepackage{xpatch}
\makeatletter
\xpatchcmd\captionsarabic
{\chaptername{\@ensure@RTL{باب}}}% text to replace
{\chaptername{\@ensure@RTL{فَصْل}}}% replacement text
{}{}
\makeatother
这也会影响目录以及章节标题。
使其更大检查日志文件。我收到几个关于字体不可用并因此被替换的警告。这可能会导致文本排版为比预期更小或更浅的字体。