KOMA-Script scrbook: chapter titles right-aligned, between lines, chapter number on top in words

Herbert Voss Herbert.Voss at fu-berlin.de
Fri Jul 14 18:58:07 UTC 2023



Am 14.07.23 um 01:40 schrieb Rich Shepard:
> I'm trying to change the KOMA-Script book chapter headings so the 
> heading is
> right-aligned, between two horizontal rules, and the chapter title is 
> above
> the top rule as in the memoir class demo chapter head (attached.)
>
> I had found code on the KOMA-Script wiki to place chapter headings 
> between
> two lines and right-align it, but lost the code for the latter. A minimal
> working example file is attached. The chapter headings are between two
> rules, but still left-aligned. The last two lines of the preamble show 
> what I
> tried from StackExchange threads; neither works for me and I've not found
> code that puts the header number in lower-case words centered above 
> the top
> rule.
>
> Pointers to solutions needed.


Write into the documents preamble:

\usepackage{fmtcount}
\setkomafont{chapter}{\huge}

\renewcommand\chapterlinesformat[3]{%
     \ifx\relax#2\relax\else\makebox[\linewidth]{%
\numberstringnum{\thechapter}}\\\smallskip\fi\rule{\linewidth}{1pt}\par
     \ifx\relax#2\relax\smallskip\else\bigskip\fi
     \parbox{\linewidth}{\raggedchapter\raggedleft#3}%
     \par\medskip\rule{\linewidth}{1pt}%
}%

Herbert


More information about the lyx-users mailing list