Document Classesmemoir - redefining chapter style

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
magister
Posts: 17
Joined: Sun Aug 02, 2009 4:42 am

memoir - redefining chapter style

Post by magister »

I started with the daleif1 style found in the “Memoir Chapter Styles” document on CTAN. Through trial and error and reading the memoir manual (I am not a skilled programmer by any means!) I mostly got what I want. I would appreciate help with one remaining problem.

There is too much space above the chapter heading; I want two more lines of text at the bottom of the page. I tried adding negative extra length to the \beforechapskip command, but nothing happened. Then I tried to renew the \beforechapskip to a smaller size (default is 50pt), which worked---but it caused error messages and also put two extra pages at the front of the PDF, the first of which has “24pt” printed at the top. These are the error messages (I assure you, \begin{document} is there!). The document does compile if I ignore the error messages.

Thanks for any help -- David

Code: Select all

! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
l.138 \chapterstyle{redbox1}
? 
! Missing number, treated as zero.
<to be read again> 
                   \protect 
l.138 \chapterstyle{redbox1}
? 
! Illegal unit of measure (pt inserted).
<to be read again> 
                   \protect 
l.138 \chapterstyle{redbox1}
Here’s my new chapter style as it is right now:

Code: Select all

\usepackage{calc}  % also needs graphicx, which is loaded already
\usepackage{soul}
\definecolor{nicered}{rgb}{.647,.129,.149}
\renewcommand{\beforechapskip}{24pt}  %THIS GENERATES THE ERROR MESSAGES
%\addtolength{\beforechapskip}{-60pt} %no effect, but no error message

\makeatletter
\newlength\dlf@normtxtw
\setlength\dlf@normtxtw{\textwidth}
%\def\myhelvetfont{\def\sfdefault{mdput}}  %seems to make no diff if I comment this out
\newsavebox{\feline@chapter}
\newcommand\feline@chapter@marker[1][3cm]{% 
\sbox\feline@chapter{%
\raisebox{-1.5pt}{
\resizebox{!}{#1}{\fboxsep=1pt%
\colorbox{nicered}{\color{white}\tiny\bfseries\thechapter}}% added "tiny" command and had to raisebox by an additional -9pt in next line
}}%
%if I want to keep "Chapter," need to raise the box to get it aligned with the red box; this makes up for the "raisebox" that I removed in the next section
\raisebox{-18pt}{\rotatebox{90}{%  
\resizebox{%
\heightof{\usebox{\feline@chapter}}+\depthof{\usebox{\feline@chapter}}}%
{!}{\scshape\so\@chapapp}}}\quad%

%\raisebox{\depthof{\usebox{\feline@chapter}}}  %removing raisebox lowers box slightly
{\usebox{\feline@chapter}}%
}
\newcommand\feline@chm[1][3cm]{% 
\sbox\feline@chapter{\feline@chapter@marker[#1]}%
\makebox[0pt][l]{% aka \rlap
\makebox[4.25cm][r]{\usebox\feline@chapter}% this number controls how far right !!
}
} %end of newcommand


\makechapterstyle{redbox1}{
\renewcommand\@chapapp{chapter}
\renewcommand\chapnamefont{\normalfont\scshape\raggedleft\so}
\renewcommand\chaptitlefont{\normalfont\Huge\bfseries\color{nicered}}
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\printchapternum{\null\hfill\feline@chm[2.76cm]\par} %this number controls size of the red box
\renewcommand\afterchapternum{\vskip-\midchapskip} %removed \par and added minus sign; this gets the red box on the baseline

\renewcommand\printchaptertitle[1]{\chaptitlefont\raggedright ##1\par}  %original raggedleft changed to raggedright
}
\makeatother

\chapterstyle{redbox1}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: memoir - redefining chapter style

Post by daleif »

as with so many other questions

full minimal example please
Post Reply