Daleif1 主题:如何获取章节上方部分的标题?

Daleif1 主题:如何获取章节上方部分的标题?

我正在使用daleif1主题,并且我想将\part的标题放在\chapter同一页面上的 标题上方。

\documentclass{memoir}
\usepackage[explicit]{titlesec}
\usepackage{calc,graphicx,soul}
\usepackage{color}



\begin{document}
\definecolor{nicered}{rgb}{.647,.129,.149}
\makeatletter
\newlength\dlf@normtxtw
\setlength\dlf@normtxtw{\textwidth}
\def\myhelvetfont{\def\sfdefault{mdput}}
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
  \sbox\feline@chapter{%
    \resizebox{!}{#1}{\fboxsep=1pt%
      \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
    }}%
  \rotatebox{90}{%position titre "Chapitre"
    \resizebox{%
      \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
    {!}{\scshape\so\@chapapp}}\quad%
  \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
}
\newcommand\feline@chm[1][4cm]{%
  \sbox\feline@chapter{\feline@chapter@marker[#1]}%
  \makebox[0pt][l]{% aka \rlap
    \makebox[18cm][r]{\usebox\feline@chapter}%
  }}        
\makechapterstyle{daleif1}{
  \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft\so}
  \renewcommand\chaptitlefont{\normalfont\huge\bfseries\scshape\color{nicered}}
  \renewcommand\chapternamenum{}
  \renewcommand\printchaptername{\color{black}}
  \renewcommand\printchapternum{\feline@chm[2.5cm]} % taille de la box
  \setlength\beforechapskip{-1cm}
  \renewcommand\afterchapternum{\par\vskip\midchapskip}
  \renewcommand\printchaptertitle[1]{\chaptitlefont\raggedleft\underline{##1}\par}
}

\makeatother
\chapterstyle{daleif1}

\part{Part ONE}


\chapter{Chapter ONE of PART ONE}
\chapter{Chapter TWO of PART ONE}



\end{document}

我完全不知道该怎么做。我试过,\printparttitle但没有用。

答案1

您可以\printpartitle记住当前部件的标题。我还添加了一个界面,用于将标题重置为空。

\documentclass{memoir}
\usepackage{calc,graphicx}
\usepackage{color}

\definecolor{nicered}{rgb}{.647,.129,.149}
\makeatletter
\newlength\dlf@normtxtw
\setlength\dlf@normtxtw{\textwidth}
\def\myhelvetfont{\def\sfdefault{mdput}}
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][4cm]{%
  \sbox\feline@chapter{%
    \resizebox{!}{#1}{\fboxsep=1pt%
      \colorbox{nicered}{\color{white}\bfseries\sffamily\thechapter}%
    }}%
  \rotatebox{90}{%position titre "Chapitre"
    \resizebox{%
      \heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
    {!}{\scshape\@chapapp}}\quad%
  \raisebox{\depthof{\usebox{\feline@chapter}}}{\usebox{\feline@chapter}}%
}
\newcommand\feline@chm[1][4cm]{%
  \sbox\feline@chapter{\feline@chapter@marker[#1]}%
  \makebox[0pt][l]{% aka \rlap
    \makebox[18cm][r]{\usebox\feline@chapter}%
  }}        
\makechapterstyle{daleif1}{
  \renewcommand\chapnamefont{\normalfont\Large\scshape\raggedleft}
  \renewcommand\chaptitlefont{\normalfont\huge\scshape\color{nicered}}
  \renewcommand\chapternamenum{}
  \renewcommand\printchaptername{\color{black}}
  \renewcommand\printchapternum{\feline@chm[2.5cm]} % taille de la box
  \setlength\beforechapskip{-1cm}
  \renewcommand\afterchapternum{\par\vskip\midchapskip}
  \renewcommand\printchaptertitle[1]{%
    \chaptitlefont\raggedleft
    {\normalfont\itshape\currentparttitle}##1\par}
}

\renewcommand{\printparttitle}[1]{%
  \gdef\currentparttitle{#1\\}%
  \parttitlefont{#1}%
}

\newcommand{\resetparttitle}{\gdef\currentparttitle{\strut}}
\resetparttitle

\makeatother
\chapterstyle{daleif1}

\begin{document}

\chapter*{Introduction}

\part{Part ONE}


\chapter{Chapter ONE of PART ONE}
\chapter{Chapter TWO of PART ONE}

\resetparttitle
\chapter*{PPP} % emulate the back matter such as the bibliography

\end{document}

请注意,我删除了下划线,这与良好的排版没什么关系。粗体与小写字母相冲突:有些字体带有粗体小写字母,但这会刺眼。使用粗体或小写字母,不要同时使用:双重强调太多了。

在此处输入图片描述

\part当然,如果您不想要部分页面,那么就不要发出命令。

您可以定义

\newcommand\newpart[1]{%
   \cleardoublepage
   %\phantomsection % if you use hyperref uncomment this line
   \addcontentsline{toc}{part}{#1}%
   \gdef\currentparttitle{#1\\}%
}

并使用与之前相同的输入。

相关内容