8

I am looking for a way to make the first page for a chapter (a.k.a. the chapter heading) have approximately the upper half of the first page with a chapter number and title, and the text of the chapter start about half way down the page.

I have seen several options using titlesec such as:

\usepackage[ ]{titlesec}  %
\titleformat{\chapter}[display]
  { \normalsize \huge  \color{black}}
  {\flushright \normalsize \color{RoyalRed} \MakeUppercase { \chaptertitlename } \hspace{1 ex} { \fontsize{60}{60}\selectfont \color{RoyalRed} \sffamily  \thechapter }} {10 pt}{\huge}  

This works acceptably, producing something like (ignore the blue in this graphic):

enter image description here

except I don't want to use titlesec because I get the following warning:

Class scrbook Warning: Usage of package `titlesec' together
(scrbook)              with a KOMA-Script class is not recommended.
(scrbook)              I'd suggest to use the package only
(scrbook)              if you really need it, because it breaks several
(scrbook)              KOMA-Script features, i.e., option `headings' and
(scrbook)              the extended optional argument of the section
(scrbook)              commands .
(scrbook)              Nevertheless, using requested
(scrbook)              package `titlesec' on input line 43.

I am relatively new to LaTex in general, but my sense is that the KOMA packages are well designed and well documented, so within the maelstrom of LaTex formatting capabilities, I would like to remain hitched to the using KOMA properly. So the question is, how can I get the same sort of chapter title effect without using titlesec?

  • 1
    Very difficult matter. KOMA-script uses lots and lots of helper macros to support the many many available options. If you are sure you don't want/need those options, using titlesec is fine. You can still redefine the internal chapterhead, but this will cause you a lot of headache to take all options into account; or you are doing the bare minimum (equaling the titlesec method). – Johannes_B Oct 26 '14 at 18:38
  • 2
    I don't want to use titlesec. I want to figure out how to use KOMA friendly features to get a title heading like that shown. The problem is that every example I can find on the internet always uses titlesec. I am looking for a way to do this without titlesec. – AgilePro Oct 26 '14 at 19:04
  • 1
    Anything COMPATIBLE with KOMA is fine. I keep forgetting that with LaTex everything you do breaks something else. As for style, I just sampled 10 books sitting within reach, and every single one of them has chapter titles where the text starts about half the way down the page. This seems extraordinarily common. Are you saying I should abandon KOMA to get this effect? – AgilePro Oct 26 '14 at 20:12
  • 2
    To be honest, I think you should probably be using a standard class with whatever packages. KOMA-Script is designed to be flexible within a particular set of constraints which are designed to make it more difficult to make bad choices about typography. Inevitably, this also excludes some perfectly good choices about the design and layout of particular documents. If you have clear ideas about how your document should look, you gain nothing by trying to use KOMA-Script and then fighting it every inch of the way. (Why do you care if it is well designed and documented if you want something else?) – cfr Oct 26 '14 at 23:43
  • 1
    You are trying to bake a cake and insisting on using a blow torch on the grounds that the blow torch is very well designed and comes with great instructions. That makes it a good blow torch. It will not make you a good cake. Then when people point this out, you say it is OK to dismantle bits of the blow torch and repurpose them, adding some other things if needed, just so long as you can still use the blow torch. So now people are jerry-rigging ovens from bits of your blow torch and bits of other things and you are complaining that your cakes cook unevenly, sink in the middle or burn. – cfr Oct 26 '14 at 23:49
4

I have no idea what the blue italics is meant to be or how that is supposed to get specified. Ignoring that, you can do something not a million miles from what you want:

\documentclass[headings=twolinechapter,chapterprefix=true]{scrbook}
\usepackage{xcolor}
\usepackage{kantlipsum}
\renewcommand*\chapterheadstartvskip{\vspace*{.3\textheight}}
\renewcommand*\chapterheadendvskip{\vspace*{.1\textheight}}
\renewcommand*{\chapterformat}{%
  \parbox{\textwidth}{\hfill\chapappifchapterprefix{\ }\thechapter\autodot\enskip}}
\addtokomafont{disposition}{\normalfont\bfseries}
\addtokomafont{chapterprefix}{\color{red}\mdseries\scshape}
\begin{document}

  \tableofcontents

  \chapter[My Chapter Title]{%
    My Chapter Title}

  \kant[1-10]

\end{document}

Kant with a fancy heading

  • OK I tried this. It seems to change the chapter heading, and it also changes the entries in the table of content. I would rather the table of contents be formatted consistently as a single table having nothing to do with the formatting of the first page of a chapter. Also, use of 'disposition' means that all section titles are changed as well... I changed that to 'chapter'. – AgilePro Oct 26 '14 at 23:01
  • @AgilePro I would really strongly suggest that you do not use a serif font for chapter titles and a sans serif one for all the other section titles. You really should be consistent which is why I deliberately used disposition to set the font to serif. I don't know what you mean about the ToC being formatted 'consistently as a single table'. Do you get more than one table? That would be extremely strange. If you don't want the spacing changes there, just put the changes after \tableofcontents. – cfr Oct 26 '14 at 23:30
1

This doesn't in any way answer the question, it just gives a little idea of how difficult it is to tame the beast.

The standard classes are pretty straight forward concerning the omplementatin of the sectioning commands. KOMA is different in that respect.

Consider chapters, the standard classes (report and book) know \chapter and its starred counterpart \chapter*; the KOMA classes (scrreprt and scrbook) know those two, plus \addchap (unnumbered but toc-entry and header marked) and \addchap* (unnumbered, no toc entry, header cleared). Alle behave differently and are instantly broken as soon as titlesec is loaded.* Can this be fixed? Sure, LaTeX is a macro language after all. But it will take soo much time to take all the different options, conditionals and fallbacks into account.
To get the chapter number i had to turn on the option on explicitely, since a cahpterprefix isn't the default.

The following sets the chapterprefix and the number in a dark red, but only if chapterprefix=true. Please comment out the global option and see what happens. Using KOMA internal macros and KOMA internal conditionals we can get their, but one needs to dive into the internals.

\documentclass[headings=optiontoheadandtoc,
chapterprefix=true
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[x11names]{xcolor}
\makeatletter
\if@chapterprefix
 \renewcommand*{\chapterformat}{%
     \mbox{\color{Firebrick4}\chapappifchapterprefix{\nobreakspace}{\fontsize{40}{48}\selectfont\thechapter}\autodot\enskip}%
 }
\fi
\makeatother
\begin{document}
\tableofcontents
\chapter[tocentry={this is the toc entry},head={this goes to the
head}]{this is the normal chapter}
This is just some text. \clearpage Don't worry, there aren't any
ducks here. 
\addchap[tocentry={a duck, finally},head={unnumbered
head}]{unnumbered chapter by addchap}
\clearpage Let's look at the header
\chapter*{The standard starred chapter}
\clearpage What about the header?
\addchap*{addchap; unnumbered, no toc, no head also?}
\clearpage Is there a header?
\end{document}

* Well, to be honest, my testing showed that this feature is not instantly broken.

  • @cfr already gave an anwer, but nonetheless. I wrote that beeing offline. – Johannes_B Oct 26 '14 at 20:55

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.