for my book i define own chapter style which i like to use only in body of document (after \mainmatter
). in front matter i like to preserve default memoir chapter style.
background:
my chapter style gives the following result:
in the front matter i increase text width to the right border of chapter title (see mwe below). consequently chapter title is pushed out of page (in this case title of table of content, i.e.: "Content").
to make it visible, i looking for how to make my chapter style aware, where is used. for star i like to have in front matter memoir
default style.
mwe:
\documentclass{memoir}
\usepackage{lmodern}
\usepackage{tikz}
\usetikzlibrary{positioning, shadows}
%---------------------------------------------------------------%
\newlength{\marginwidth}
\setlength{\marginwidth}{\dimexpr\marginparsep+\marginparwidth\relax}
\newsavebox{\bookbox}
\newcommand{\zfcbookname}[1]{\sbox{\bookbox}{\textsc{#1}}}
\zfcbookname{<book title>}
%---------------------------------------------------------------%
\makechapterstyle{zfcBook}{%
\setlength\beforechapskip{9\baselineskip}
\setlength\afterchapskip{7\baselineskip}
\setlength\midchapskip{1\baselineskip}
\renewcommand*{\chaptitlefont}{\normalfont\Huge\bfseries}
\renewcommand*{\chapnamefont}{\chaptitlefont}
\renewcommand*{\chapnumfont}{\bfseries\fontsize{77}{84}\selectfont}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\printchapternum}{%
\begin{adjustwidth}{\marginwidth}{-\marginwidth}
\begin{tikzpicture}
%-------
\node[name=chapter,
rectangle,fill=white,minimum width=\textwidth,minimum height=22mm,
copy shadow={shadow xshift=6pt,shadow yshift=-2pt,fill=black}] {~};
\node[above left] at (chapter.south east) {
\ifanappendix\chaptitlefont\@chapapp\fi
\chapnumfont\thechapter};
\node[below right=1mm and 0mm] at (chapter.south west) {\usebox{\bookbox}};
%-------
\end{tikzpicture}
\end{adjustwidth}
}%end od print chapter num
\renewcommand*{\printchaptertitle}[1]{
\begin{adjustwidth}{\marginwidth}{-\marginwidth}
\raggedleft{\chaptitlefont ##1}\par\nobreak%
\end{adjustwidth}
}% end of print chapter title
}%end of zfcBook
%---------------------------------------------------------------%
\usepackage{lipsum}
\begin{document}
\chapterstyle{zfcBook}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\frontmatter
\changetext{0pt}{\marginwidth}{-\marginwidth}{0pt}{0pt}
\tableofcontents % kazalo
\changetext{0pt}{-\marginwidth}{\marginwidth}{0pt}{0pt}
\mainmatter
\chapter{ena}
\lipsum[11]
\section{ena ena}
\section{ena dva}
\section{ena tri}
\chapter{dva}
\section{dva ena}
\section{dva dva}
\section{dva tri}
\end{document}
question:
how to change my \makechapterstyle
that it will be aware of \frontmatter
and there use or default memoir style or new defined style (very different from one used in \mainmatter
)?
\chapterstyle{zfcBook}
after\mainmatter
... it seems that i should delete my question :-(\frontmatter
the numbered version is not used, so you can add stuff to\printchapternonum
, which will be executed under\chapter*
and within frontmatter. I sometimes add a switch in\printchapternonum
when I have all the typesetting (name and number) inside\printchaptertitle
, then I can distinguish between the two cases.