包选项与节名冲突

包选项与节名冲突

我正在尝试设计章节外观,到目前为止我都完成了,一切运行正常,但是当我explicit向我的课程添加选项时,我丢失了章节名称。我不明白为什么会发生这种情况??

\documentclass[explicit]{biditufte-book}
\geometry{showframe, twoside}
\usepackage{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}

\usepackage{tikz}
\usepackage{ptext}
\usepackage[localise=on]{xepersian}
\settextfont[Scale=1.2]{Tahoma}
\setdigitfont[Scale=1]{Tahoma}
\setcounter{secnumdepth}{2}

%chapter Design
\newcommand\chapnumfont{% 
  \fontsize{380}{130}\color{myblueii}\selectfont%
}

\newcommand\chapnamefont{%
  \normalfont\color{white}\scshape\small\bfseries
}

\titleformat{\chapter}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\stepcounter{chapshift}%
  \begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {\thechapter};%
  \node[
      anchor=south east,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {\chapnumfont\thechapter};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }

\titleformat{name=\chapter,numberless}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {};%
  \node[
      anchor=south east,minimum width=2in,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }
\titlespacing*{\chapter}{0pt}{0pt}{3.5in}
\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{3.5in}


\newcounter{chapshift}
\addtocounter{chapshift}{-1}
%section Design
\newlength\outermargin
\newlength\innermargin
\setlength{\innermargin}{1in}
\setlength{\outermargin}{\dimexpr\paperwidth-\textwidth-\innermargin\relax}
\titleformat{\section}%
 {\normalfont\Large\color{gray}\setlength\fboxrule{0.8pt}}% format applied to label+text
 {\llap{\colorbox{yellow}{\makebox[\outermargin][l]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth]%
 {\vphantom{lp}\color{blue}\bfseries\thesection\enspace}}}}}% label
 {0pt}% horizontal separation between label and title body
{\rlap{\hspace{-\fboxrule}\framebox[\linewidth + 2\fboxrule\relax][r]{\vphantom{lp}}\colorbox{red}{\makebox[\outermargin][r]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth+\fboxrule]%
 {\vphantom{lp}}}}}\enspace}% before the title body
[]

\begin{document}

\chapter{فصل}
\ptext[1]
\section{قسمت}
\ptext[1-4]
\subsection{زیر قسمت }
\ptext[1]
\section{قسمت}

\end{document} 

答案1

这很简单。当您使用explicit选项时,您应该通过 #1 提及部分编号。

 \documentclass[explicit]{biditufte-book}
\geometry{showframe, twoside}
\usepackage{xcolor}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}

\usepackage{tikz}
\usepackage{ptext}
\usepackage[localise=on]{xepersian}
\settextfont[Scale=1.2]{Tahoma}
\setdigitfont[Scale=1]{Tahoma}
\setcounter{secnumdepth}{2}

%chapter Design
\newcommand\chapnumfont{% 
  \fontsize{380}{130}\color{myblueii}\selectfont%
}

\newcommand\chapnamefont{%
  \normalfont\color{white}\scshape\small\bfseries
}

\titleformat{\chapter}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\stepcounter{chapshift}%
  \begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {\thechapter};%
  \node[
      anchor=south east,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {\chapnumfont\thechapter};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }

\titleformat{name=\chapter,numberless}
  {\normalfont\huge\filleft}
  {}
  {0pt}
  {\begin{tikzpicture}[remember picture,overlay]
  \fill[myblueiii]
    (current page.north west) rectangle ([yshift=-13cm]current page.north east);
  \node[
      fill=mybluei,
      text width=2\paperwidth,
      rounded corners=6cm,
      text depth=18cm,
      anchor=center,
      inner sep=0pt] at (current page.north east) (chaptop)
    {};%
  \node[
      anchor=south east,minimum width=2in,
      inner sep=0pt,
      outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
    {};
  \node[
      anchor=south,
      inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
  {};
  \node[
      anchor=north east,
      align=right,
      inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
  {\parbox{.7\textwidth}{\raggedleft#1}};
  \end{tikzpicture}%
  }
\titlespacing*{\chapter}{0pt}{0pt}{3.5in}
\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{3.5in}


\newcounter{chapshift}
\addtocounter{chapshift}{-1}
%section Design
\newlength\outermargin
\newlength\innermargin
\setlength{\innermargin}{1in}
\setlength{\outermargin}{\dimexpr\paperwidth-\textwidth-\innermargin\relax}
\titleformat{\section}%
 {\normalfont\Large\color{gray}\setlength\fboxrule{0.8pt}}% format applied to label+text
 {\llap{\colorbox{yellow}{\makebox[\outermargin][l]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth]%
 {\vphantom{lp}\color{blue}\bfseries\thesection\enspace}}}}}% label
 {0pt}% horizontal separation between label and title body
{\rlap{\hspace{-\fboxrule}\framebox[\linewidth + 2\fboxrule\relax][r]{\vphantom{lp}}\colorbox{red}{\makebox[\outermargin][r]{\raisebox{0pt}[\dimexpr\height+\fboxrule][\dimexpr\depth+\fboxrule]%
 {\vphantom{lp}}}}}\enspace#1}% before the title body
[]

\begin{document}

\chapter{فصل}
\ptext[1]
\section{قسمت}
\ptext[1-4]
\subsection{زیر قسمت }
\ptext[1]
\section{قسمت}

\end{document} 

请注意,我刚刚将#1添加到:

{\vphantom{lp}}}}}\enspace#1}% before the title body

相关内容