Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following layout for my chapter title and number: The current layout

I reached this using the following code:

\renewcommand*{\chapterformat}{%
  \fontsize{60}{68}\selectfont\color{Gray}\thechapter\autodot\enskip}

\addtokomafont{chapter}{%
  \renewcommand*{\raggedsection}{\raggedleft}}

What is the best way to move the chapter number (2 in this case) to the right end of the same line, so that it overlaps with the chapter title? (I want the title to be on top). If possible, I want the method to integrate well with KOMA script, for example by redefining \chapterformat like I did above.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

You mean like this?

Overlapping title

That doesn't look good, does it?

At the very least, I would do something like this:

\renewcommand*{\chapterformat}{%
  \rlap{\makebox[\linewidth][r]{\colorbox{ltGray}{\fontsize{60}{68}\selectfont\color{Gray}\thechapter\autodot}}}}

\addtokomafont{chapter}{%
  \renewcommand*{\raggedsection}{\raggedleft\rightskip1.2em\hfill}}

Partially overlapping title

Disclaimer: I'm not a designer!

share|improve this answer
    
Hello Stephan, Thank's for the solution. The first example indeed doesn't look good, but at least I can experiment now to find something better looking. –  janoliver Apr 2 '12 at 14:28
add comment

Here is one way of obtaining the requested output via a patch of \@@makechapterhead (using etoolbox). \@@makechapterhead prints the actual chapter heading (chapter number + title) in scrbook.

enter image description here

\documentclass{scrbook}
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\usepackage{fix-cm}% http://ctan.org/pkg/fix-cm
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox

\renewcommand*{\chapterformat}{%
  \fontsize{60}{68}\selectfont\color{black!50}\thechapter}% \autodot\enskip

\makeatletter
% Remove \chapterformat from \@@makechapterformat
\patchcmd{\@@makechapterhead}% <cmd>
  {\chapterformat}% <search>
  {}% <replace>
  {}{}% <success><failure>
% Reinsert \chapterformat  modify heading layout
\patchcmd{\@@makechapterhead}% <cmd>
  {\size@chapter{#1}}% <search>
  {\ooalign{\hss\chapterformat\cr\size@chapter{#1}}}% <replace>
  {}{}% <success><failure>
\makeatother

\addtokomafont{chapter}{%
  \renewcommand*{\raggedsection}{\raggedleft}}
\begin{document}
\setcounter{chapter}{1}% Just for this example
\chapter{Text elements}
In this chapter, some textual elements are shown, like figures,
tables, lists, equations, etc. Also, bananas.
\end{document}

The first patch removes the typesetting of the chapter number (done via \chapterformat). The second patch re-inserts \chapterformat and overlays the title using \ooalign. For a quick course on \ooalign, see \subseteq + \circ as a single symbol ("open subset").

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.