Hi,
I'm writing a thesis and made my own chapterhead style by modifying
\@@makechapterhead
, \@@makeschapterhead
and \chapterformat
(see below) with KOMA-Script "scrbook" documentclass v2.9r .
% ------------------------------------------------------------------------------ \setlength{\lineskiplimit}{0pt} \linespread{1.10} % I know I should use setspace but... well, \makeatletter \renewcommand*{\@@makechapterhead}[1]{\chapterheadstartvskip% %\vspace*{-.19\baselineskip} % dirty hack for alignment {\normalfont\sectfont\size@chapter \setlength{\parindent}{\z@}\setlength{\parfillskip}{\fill}% \if@chapterprefix\let\@tempa\raggedsection\else\let\@tempa\@hangfrom\fi% \@tempa{\ifnum \c@secnumdepth >\m@ne% \chapterformat\fi}% \if@chapterprefix\par\nobreak\vskip.5\baselineskip\fi% {\hfill\raggedleft \interlinepenalty \@M \MakeUppercase{#1}\par}}% \nobreak\chapterheadendvskip% } \renewcommand*{\@@makeschapterhead}[1]{\chapterheadstartvskip% {\parindent \z@ \setlength{\parfillskip}{\fill}\raggedleft \normalfont \sectfont\size@chapter \MakeUppercase{#1}\par \nobreak\chapterheadendvskip }} \makeatother \renewcommand*{\chapterformat}{% {\MakeUppercase{\Large\chapappifchapterprefix{\ }} {\fontsize{60}{72}\selectfont\thechapter\autodot}\enskip}} % ------------------------------------------------------------------------------
I have 2 problems:
\tableofcontents
fails:! Missing control sequence inserted. \inaccessible l.6 \tableofcontents
I assume it is using \addchap
and that my modifications brake something but I don't see how to resolve this. When trying this preamble with an empty document, the error is different (uh ?) and says that TeX stack exceeded... so it seems there is an infinite loop induced by my redefinitions.
\chapter
ans those made by \addchap
could be equally distant from the top of the sheet (\addchap
titles should go down a bit). I tried a dirty \vspace
but I don't find it a good generic solution since I'm also modifying interline spacing. Note that the misalignment is due to my huge \chapterformat
, but I presume I can't simply fake a huge box in front of \addchap
titles since it could break commands relying on it (as for \tableofcontents
).Thanks for your time!
--
Julien Thewys
[Admin-Edit:]
seems it's a bug in \tableofcontents
In scrbook.cls (and other classes), the definition of \tableofcontents should contain
instead of
as bibliography and index are treated that way. This solves my first and important problem.
Could someone help me with the second ?
Don't redefine internal macros!
This is not a good idea, because nobody ever declared, that these macros will be used in future. So you should never redefine internal macros of a class or package if you can avoid it. Packages like titlesec are existing.
And if you are changing internal macros you should know, what you are doing. But the error message shows that you don't. Nobody ever declared, that the argument of
\chapter
has to be something, which may be used as argument of\MakeUppercase
.BTW:
\MakeUppercase
gives very ugly results. Upper case words have to be letterspaced for typographical reasons. So\MakeUppercase
is almost unusable.Partially outdated answer
The main point: “You should never redefine internal macros …” is still valid. But you also should not use titlesec with more or less current KOMA-Script releases. You should use the available configuration interfaces of KOMA-Script, i.e.
\RedeclareSectionCommand
and redefinition of\chapterlinesformat
etc.