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 use \documentclass{scrbook} with \usepackage[Bjornstrup]{fncychap}.

How can I style the partpage like the chapterpage in the Bjornstrup-style?

Plus this I want to change the grey colour of the box from Bjornstrup in another one. How is this possible?

share|improve this question
    
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Upvoting is the preferred way here to say "thank you" to users who helped you. A tip: You can use backticks ` to mark your inline code as I did in my edit. –  Torbjørn T. Dec 2 '11 at 14:44
add comment

1 Answer

up vote 10 down vote accepted

Here's one possible solution: I redefined \partformat and the internal command \@part (from scrbook.cls) to imitate the Bjornstrup style for chapters; I also redefined \DOCH, \DOTI and \DOTIS as defined by Bjornstrup to allow a variable color. You can now control the background color for parts and chapters simply redefining (through \colorlet) the colors partbgcolor, and chapbgcolor; the color for the numbers used can similarly be changed using partnumcolor and chapnumcolor:

\documentclass{scrbook}
\usepackage[Bjornstrup]{fncychap}
\usepackage{xcolor}

\colorlet{partbgcolor}{gray!30}% shaded background color for parts
\colorlet{partnumcolor}{gray}% color for numbers in parts
\colorlet{chapbgcolor}{gray!30}% shaded background color for chapters
\colorlet{chapnumcolor}{gray}% color for numbers in chapters

\renewcommand*\partformat{%
  \fontsize{76}{80}\usefont{T1}{pzc}{m}{n}\selectfont%
  \hfill\textcolor{partnumcolor}{\thepart}}

\makeatletter
\renewcommand*{\@part}{}
\def\@part[#1]#2{%
  \ifnum \c@secnumdepth >-2\relax
    \refstepcounter{part}%
    \@maybeautodot\thepart%
    \addparttocentry{\thepart}{#1}%
  \else
    \addparttocentry{}{#1}%
  \fi
  \begingroup
    \setparsizes{\z@}{\z@}{\z@\@plus 1fil}\par@updaterelative
    \raggedpart
    \interlinepenalty \@M
    \normalfont\sectfont\nobreak
    \setlength\fboxsep{0pt}
    \colorbox{partbgcolor}{\rule{0pt}{40pt}%
    \makebox[\linewidth]{%
    \begin{minipage}{\dimexpr\linewidth+20pt\relax}
      \ifnum \c@secnumdepth >-2\relax
        \vskip-25pt
        \size@partnumber{\partformat}%
      \fi      %
      \vskip\baselineskip
      \hspace*{\dimexpr\myhi+10pt\relax}%
      \parbox{\dimexpr\linewidth-2\myhi-20pt\relax}{\raggedleft\LARGE#2\strut}%
      \hspace*{\myhi}\par\medskip%
    \end{minipage}%
      }%
    }%
    \partmark{#1}\par
  \endgroup
  \@endpart
}

\renewcommand\DOCH{%
  \settowidth{\py}{\CNoV\thechapter}
  \addtolength{\py}{-10pt}
  \fboxsep=0pt%
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
  \kern-\py\raise20pt%
  \hbox{\color{chapnumcolor}\CNoV\thechapter}\\%
}

\renewcommand\DOTI[1]{%
  \nointerlineskip\raggedright%
  \fboxsep=\myhi%
  \vskip-1ex%
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
  \vskip 40pt%
}

\renewcommand\DOTIS[1]{%
  \fboxsep=0pt
  \colorbox{chapbgcolor}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
  \nointerlineskip\raggedright%
  \fboxsep=\myhi%
  \colorbox{chapbgcolor}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
  \vskip 40pt%
 }
\makeatother


\begin{document}

\part{Test Part}
\chapter{Test Chapter}

\end{document}

Here's how parts will now look like:

enter image description here

And using

\colorlet{partbgcolor}{LightSkyBlue}% shaded background color for parts
\colorlet{partnumcolor}{NavyBlue}% color for numbers in parts

you will get:

enter image description here

share|improve this answer
    
WOW, Thankxxxxx again!!!!! –  Bjornstrup Dec 7 '11 at 9:17
    
@Bjornstrup: You're welcome! Since my response seems to answer your question, please consider marking it as ‘Accepted’ by clicking on the tickmark below its vote count. –  Gonzalo Medina Dec 7 '11 at 23:19
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.