Juli 28, 2012

Fancy Header with KOMA-Script

Using KOMA-script for my dissertation, does make me a bit confuse. Reading its manual is a bit daunting since I am a new user of KOMA-Script although I am a self-proclaimed average LaTeX user. Here I will give a guide to create fancy header. I will not explain a lot, just directly put my LaTeX source so that you can get them directly to create a fancy header. Here's the source:

\documentclass{scrreprt}
\usepackage{url}
\usepackage{listings}

\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage{wrapfig}
\usepackage[pdftex]{graphicx}
\usepackage{setspace}

\usepackage[Sonny]{fncychap}
%\usepackage[Bjornstrup]{fncychap}

\usepackage[automark]{scrpage2}

\begin{document}

 \pagestyle{scrheadings}
 \setheadsepline{.4pt}
 \clearscrheadings
 \automark[section]{chapter}
 \ihead{\headmark}
 \ohead{\pagemark}
 \cfoot{}

 \KOMAoptions{abstract=on}

 \definecolor{light-gray}{gray}{0.95}
 \lstset{numbers=left,basicstyle=\scriptsize,numberstyle=\scriptsize,frame=tb,captionpos=b,backgroundcolor=\color{light-gray},showspaces=false,showstringspaces=false}

 \input{./cover.tex}
 \input{./abstract.tex}

 \tableofcontents

 \listoffigures

 \lstlistoflistings

 \input{./01-introduction.tex}
 \input{./02-background.tex}
 \input{./03-research-goals.tex}
 \input{./04-research-contributions.tex}
 \input{./05-future-directions.tex}
 \input{./06-bibliographies.tex}

\end{document}


I put all of my main full source so that you can imagine how to fit KOMA-Script into your source. The part of the source which come from KOMA-Script listed below:

Preparation

\documentclass{scrreprt}

\usepackage[automark]{scrpage2}


Header Definition

 \pagestyle{scrheadings}
 \setheadsepline{.4pt}
 \clearscrheadings
 \automark[section]{chapter}
 \ihead{\headmark}
 \ohead{\pagemark}
 \cfoot{}


Display "Abstract" Title

 \KOMAoptions{abstract=on}



The result is the document which has page number as the footer in every beginning of the chapter and the fancy header with chapter - section - page number and line for the next pages.




I believe that you love to read the manual, so if you want to know the meaning of the commands above, have a look at KOMA-Script manual. :)

0 comments:

Poskan Komentar