15

I just found some chapter headings that are really nice: example page

But I can't exactly figure out how to extend the rule off the margin and put the figure on the page before the chapter and the caption on the next (chapter heading) page. (Some tip on the footer would be nice, too).

The layout of the other pages look pretty much the same:

enter image description here

  • 3
    Welcome to TeX.sx! This is indeed a pretty layout. However, please only ask one question per post. This way, answers will be more specific and other users can find the information they're looking for more easily. I'd suggest you reduce this question to the chapter heading with the spacing and the rule, and ask another question about separating a figure and its caption. As for the footer, you might actually find a question about that on here; if not, that'll be another question :) – doncherry Dec 05 '11 at 10:40

2 Answers2

15

Here's a solution: using the xparse package I defined a new command \ChapIma with one optional argument and two mandatory arguments; the optional argument will be the text used for the ToC; the first mandatory argument is the text for the document, and the third mandatory argument is the name of the file containing the corresponding image.

The titlesec package was used to customize the chapter title format.

I also defined another command \Caption, which behaves as the standard caption, but writes the text in the space reserved for marginal notes. This command must be invoked somewhere in the first line of text of the chapter.

The caption package was used to customize the caption in the marginal notes (suppressing the label).

The lettrine package was used to produce the drop cap.

I used the fancyhdr package (I couldn't make titlesec's pagestyles option behave well, so I had to use fancyhdr) to redefine the plain page; I also defined the page style for other pages.

\documentclass[twoside]{book}
\usepackage{xparse,ifthen}
\usepackage[calcwidth]{titlesec}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{fancyhdr}
\usepackage{marginnote}
\usepackage{lettrine}
\usepackage{lipsum}

\newlength\mylen

\DeclareDocumentCommand\ChapIma{omm}
  {\let\cleardoublepage\relax
    \ifthenelse{\isodd{\value{page}}}
      {\mbox{}\clearpage}{\mbox{}\clearpage\mbox{}\clearpage}%
    \resizebox{.9\textwidth}{.9\textheight}{\includegraphics{#3}}
    \mbox{}\thispagestyle{empty}\clearpage
    \IfNoValueTF{#1}{\chapter{#2}}{\chapter[#1]{#2}}
  }

\DeclareDocumentCommand\Caption{om}
  {\marginnote{\parbox{\marginparwidth}{%
      \captionsetup[figure]{labelformat=empty}
    \IfNoValueTF{#1}{\captionof{figure}{#2}}{\captionof{figure}[#1]{#2}}
      }%
    }%
  }

\titleformat{\chapter}[display]
  {\Huge\normalfont\sffamily}{}{2pc}  
  {\setlength\mylen{0pt}%
    \addtolength\mylen{\marginparwidth}%
    \addtolength\mylen{\marginparsep}\raggedleft
  }
  [\vspace{-20pt}%
   {%
      \begin{adjustwidth}{}{-\mylen}
        \makebox[\linewidth][r]{%
          \rule{\dimexpr\titlewidth+\mylen\relax}{0.4pt}%
        }%
      \end{adjustwidth}%
   }%
  ]
\titlespacing*{\chapter}{0pt}{1cm}{7cm}

\renewcommand\chaptermark[1]{\markboth{#1}{}}

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[OR]{\sffamily\small\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  \fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax}
}

\fancyhf{}
\fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax}
\fancyfootoffset[EL]{\dimexpr\marginparsep+\marginparwidth\relax}
\fancyfoot[OR]{\small\sffamily\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}}
\fancyfoot[EL]{\small\sffamily\oldstylenums{\thepage}~~\MakeUppercase{\rightmark}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}

\renewcommand\chaptermark[1]{\markboth{#1}{}}
\renewcommand\sectionmark[1]{\markright{#1}}

\begin{document}

\tableofcontents

\ChapIma{Preface}{ctanlion}
\lettrine{T}{his} is some initial text\Caption{This is the caption for the figure; this is just some test text}
\lipsum[1-5]
\ChapIma{Introduction}{ctanlion}
\lipsum[1]
\section{Qu'ran manuscripts}
\lipsum[1-14]

\end{document}

Here's an image of four pages of the resulting document:

enter image description here

enter image description here

The CTAN lion used in the example was drawn by Duane Bibby.

Gonzalo Medina
  • 505,128
  • You should say \thispagestyle{empty} in the page with the figure. Also the treatment of the optional argument to \ChapIma is not optimal. – egreg Dec 05 '11 at 16:51
  • Gonzalo's solution worked somehow, but I don't know why the caption, no matter what I do, just stays on the left margin. Also \thispagestyle{empty} does not seem to work. –  Dec 05 '11 at 17:31
  • @Joseph: my code needs some improvements: I'm working on them, but right now I cannot post them. In two hours I will update my answer with some adjustments. – Gonzalo Medina Dec 05 '11 at 17:35
  • @egreg: you're right. I've made now some adjustments. – Gonzalo Medina Dec 05 '11 at 18:54
  • @Joseph: please see my updated answer. – Gonzalo Medina Dec 05 '11 at 18:54
  • @Gonzalo: That's great, I just had to include: \cleardoublepage after the \tableofcontents... The only remaining (minor) issue is that chapter pages are set in plain page style, but all others are like \pagestyle{empty}. –  Dec 05 '11 at 20:56
  • @Joseph: hehe... I little mistake. It's fixed now. – Gonzalo Medina Dec 05 '11 at 21:00
  • @Joseph: I did some improvements to the code and included the footer and the drop cap. – Gonzalo Medina Dec 06 '11 at 02:51
  • @Gonzalo: Great work, almost perfect, but for my fault -- I forgot an example of the other pages, they look the same, I've edited my question now. So I guess I can set the style of the other pages, but I see fancyhdr has already been defined, so I'm a bit lost about what to do. –  Dec 06 '11 at 10:02
  • @Joseph: answer updated with page style for all pages. – Gonzalo Medina Dec 06 '11 at 13:06
  • @Gonzalo: worked great now! (I just made one change: removed the old style nums for compatibility with xetex.) –  Dec 06 '11 at 13:41
  • @Joseph: glad to hear that. Of course, feel free to make the changes that best suit your needs. – Gonzalo Medina Dec 06 '11 at 13:46
4

You can use the titlesec package to create custom title styles:

\documentclass{scrreprt}
\usepackage{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}[display]{\Huge\sffamily}{}{3pc}{\raggedleft}[\footrule\vspace{8cm}]
\begin{document}
    \chapter{Preface}
        \lipsum
\end{document}

To add a custom footer, use the fancyhdr package:

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{\chaptername\ \thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

To adjust the margin widths, use the geometry package:

\usepackage[twoside,right=5cm]{geometry}
Village
  • 13,603
  • 23
  • 116
  • 219