4

I am using the daleif1 theme, and I would like to have the \part's title juste above the \chapter's title on the same page.

\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}

I dont have the slighest idea how to do it. I tried to use \printparttitle but it doesn't work.

1
  • 1
    @daleif One for you ;-)
    – Johannes_B
    Sep 7, 2014 at 9:07

1 Answer 1

1

You can make \printpartitle to remember the current part title. I added also an interface for resetting the title to nothing.

\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}

Note that I removed underlining, which has little to do with good typography. Also boldface is in conflict with small caps: there are fonts with boldface small caps, but this is a punch in the eye. Use either boldface or small caps, not both: double emphasis is too much.

enter image description here

If you don't want a part page, then don't issue the \part command, of course.

You can define

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

and use the same input as before.

6
  • Yeah Thanks. However, there is still a page with only the part's title. How can I remove the default part's title page ?
    – Terriguest
    Sep 7, 2014 at 12:43
  • @Terriguest That's a very different question. Just don't use \part and set \currentparttitle.
    – egreg
    Sep 7, 2014 at 13:00
  • That doesn't work ! "Part one" no longer appears!
    – Terriguest
    Sep 7, 2014 at 13:17
  • Something is wrong
    – Terriguest
    Sep 7, 2014 at 14:31
  • @Terriguest You should update your question; anyway, I added how to do what I think you want.
    – egreg
    Sep 7, 2014 at 15:23

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.