1

I'm using Koma-script I want to create a chapter page which does the following:

  1. Chapter Title is centered both horizontally, vertically
  2. Chapter Title is extremely big
  3. Chapter Number is in the background, at an extremely large scale.

My question is about 3., that I failed to do.

By modifiying \chapterlinesformat from Koma-script, I achieved 1. and 2., altough 2. is a bit weird code-wise.

For 3., I had the idea of using tikz and simply putting the header behind the chapter title, which worked. But I can't manage to center it easily, despite using (current page.center). I don't understand why it's not at the center.

Here is my MWE:

\documentclass[oneside]{scrbook}

\usepackage{xparse}
\usepackage{tikz}
\usepackage{adjustbox}

\DeclareDocumentCommand\chapterheadstartvskip {}{}
\DeclareDocumentCommand\chapterheadendvskip {}{}
\DeclareDocumentCommand\chaptermarkformat {}{}

\DeclareDocumentCommand\chapterlinesformat {mmm} {%

\tikz[remember picture,overlay]
    \node[scale=25,pink] at (current page.center){#2};%

\vspace*{-\topskip}\vfill
    \adjustbox{center}{%
    \adjustbox{minipage=8cm, scale=3, max width=20cm}{\centering #3}
    }
\vfill
\clearpage
}

\begin{document}
\chapter{Extremely long chapter title blablablablabla}
\end{document}

By the way, for 2., making the chapter title as big as I wanted, I had to nest two adjustbox. First one to center, second one to scale. If I attempt to use the keys center and scale=3 in the same adjustbox, it ignores the scale parameter.

Can anyone help me center my chapter number behind the title? And why isn't (current page.center) the center of the page?

3
  • 1
    For some reason I'm unware of (I do not use Koma neither LaTeX3) there's a space being added right after the chapter number. If you use the draw option of the node you'll see what I mean. The proper fix involves discovering why the space is there. A hacky way of solving the problem is to add space before the number as well, so its centered, using \hspace{.5em} seems to do it. Nov 25 '16 at 16:53
  • 1
    Thanks to you, I have found a solution to my problem. \RenewDocumentCommand\chapterformat {}{\thechapter} Nov 25 '16 at 16:55
  • You're welcome! Feel free to answer your own question, there's no problem in that. Though please provide explanation of why that fixes the issue, so others (like me) have the knowledge as well. :D Nov 25 '16 at 16:57
2

The original definition of the KOMA-command \chapterformat is

\newcommand*{\chapterformat}{%
  \mbox{\chapappifchapterprefix{\nobreakspace}\thechapter\autodot
    \IfUsePrefixLine{}{\enskip}}%
}

It formats the chapter number. If there is no prefixline containing the word "Chapter" and the chapter number, a space is needed to separate chapter number and chapter title text. This space must be part of the number format because it should be removed if the chapter is unnumbered.

I would suggest to use the commands as their task is.

  • Insert the space above and below the chapter title usinng \chapterheadstartvskip and \chapterheadendvskip.
  • Format the chapter number using \chapterformat.
  • Use chapterlinesformat to get your very special format for the chapter title text.

Example:

\documentclass[oneside]{scrbook}
\usepackage{tikz}
\usepackage{adjustbox}

\renewcommand*\chapterheadstartvskip{\vspace*{-\topskip}\vfill}
\renewcommand*\chapterheadendvskip{\vfill\clearpage}

\renewcommand*\chapterformat{%
  \tikz[remember picture,overlay]
    \path(current page.center)node[scale=25,pink]{\thechapter};%
}

\renewcommand\chapterlinesformat[3]{%
  #2\par
  \adjustbox{center}{%
      \adjustbox{minipage=8cm, scale=3, max width=20cm}{\centering #3}%
    }%
}

\begin{document}
\chapter{Extremely long chapter title blablablablabla}
\end{document}

enter image description here

Update

You can also use \parbox with \textwidth and \textheight inside \chapterlinesformat:

\documentclass[oneside]{scrbook}
\usepackage{tikz}
\usepackage{adjustbox}

\RedeclareSectionCommand[
  beforeskip=-1sp minus -1sp,
  afterskip=1sp minus 1sp
]{chapter}

\renewcommand*\chapterformat{%
  \tikz[remember picture,overlay]
    \path(current page.center)node[scale=25,pink]{\thechapter};%
}

\renewcommand\chapterlinesformat[3]{%
  \parbox[c][\textheight][c]{\textwidth}{%
    #2\par
    \adjustbox{center}{%
      \adjustbox{minipage=8cm, scale=3, max width=20cm}{\centering #3}%
}}}
\begin{document}
\chapter{Extremely long chapter title blablablablabla}
\end{document}

The result is the same as above.

1

A space is added by the \chapterformat command, which is the Argument of \chapterlinesformat.

So I can redefine \chapterformat to simply be \thechapter:

\RenewDocumentCommand\chapterformat {}{\thechapter}

to achieve the desired result.

Alternatively, I could use \thechapter instead of #2 but I think the first solution is better.

I think there is a space in \chapterformat because \chapterlinesformat is usually something like:

\@hangfrom{\hskip #2#3}{#4}}

with #2 being \chapterformat. Hence the need for a space? I'm not totally sure.

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.