0

I have tried to create a custom header and footed like this that should appear only the "Introduction" chapter onwards (With running chapter and page). However not only I failed to generate them but also they are appearing everywhere(TOC, List of tables, List of figures etc). Like to have

Intended template

The MWE is given below

\documentclass[listof=totoc,chapterprefix,sfdefaults=false]{scrbook}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{titletoc}
\usepackage{ragged2e}
%%%%%%%%%Header Footer
\usepackage[automark,ilines]{scrlayer-scrpage}
\automark{chapter}
\pagestyle{scrheadings}
\ohead[]{}
\ihead[]{}
\chead[]{}
\cfoot[]{-~\pagemark~-}
\ofoot[MAKAUT,WB]{}
\ifoot[]{}
%%%%%%%%%Header Footer
\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor   = red %Colour of citations
}
\begin{document}
\frontmatter
\addchap{Acknowledgment}
\lipsum[1-3]
\addchap{Abstract}
\lipsum[1-3]
{\pagestyle{empty}
\tableofcontents
\listoftables
\listoffigures
}
\mainmatter
\pagestyle{scrheadings}
\begin{justify}
\chapter{Introduction}
\lipsum[1-3]
\section{Motivation}
\lipsum[3-5]
Write Motivation of the research work
\section{Contribution}
\lipsum[5-6]
Write the thesis contribution
\section{Organization of thesis}
\lipsum[2-3]
Brief description of chapters in the thesis.
\subsection{Chapter 2: Literature Survey}
\lipsum[1-2]
\subsection{Chapter 3:}
\lipsum[1-2]
\subsection{Chapter 4:}
\lipsum[1-2]
\subsection{Chapter 5:}
\lipsum[1-2]
\subsection{Chapter 6:}
\lipsum[1-2]
\subsection{Chapter 7:}
\lipsum[1-2]
\end{justify}
\end{document}

Also if you think any other package like fancyhdr can do it better, please guide.

1
  • The basic idea is to create multiple styles and use \pagestyle to switch between them. Conversely, fancyhdr only creates one style (fancy) and keeps changing the definition. Aug 12, 2023 at 14:02

1 Answer 1

0

First of all, your example does not show any page header. So it also does not show a header like that of the image, e.g., in the ToC. Please note, that the example code, you are posting should always show the problem.

You've also not really specified, the page header (and footer) of the ToC, LoF, LoT etc. From the code, I expect, that the page header should be empty. But I'm not sure, what the page footer should be. However, note, that \listoffigures does only start a new page at the beginning, not at the end of the list. So if you use a group to modify the page style, you have to take care, that the group does not end to early.

\documentclass[listof=totoc,chapterprefix,sfdefaults=false,numbers=enddot,headsepline,footsepline,plainfootsepline]{scrbook}
\usepackage{lipsum}
\usepackage{hyperref}
%\usepackage{titletoc}% Not really compatible with KOMA-Script. See the
                      % KOMA-Script manual for alternative user interface.
\usepackage{ragged2e}
%%%%%%%%%Header Footer
\usepackage[automark,headsepline,markcase=upper]{scrlayer-scrpage}
\automark[chapter]{chapter}
\clearpairofpagestyles
\setkomafont{pageheadfoot}{}
\setkomafont{pagefoot}{\bfseries\small}
\ohead{\headmark}
\lefoot*{\pagemark{} \rule[-\dp\strutbox]{1pt}{\baselineskip} Page}
\rofoot*{Page \rule[-\dp\strutbox]{1pt}{\baselineskip} \pagemark}
\ifoot*{Jadavpur University}
\AddToHook{cmd/frontmatter/after}{%
  \renewcommand*{\chapterpagestyle}{empty}% instead of plain → manual
  \pagestyle{empty}%
}
\AddToHook{cmd/mainmatter/after}{%
  \renewcommand*{\chapterpagestyle}{plain}%
  \pagestyle{headings}%
}
%%%%%%%%%Header Footer
\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor   = red %Colour of citations
}
\begin{document}
\frontmatter
\tableofcontents

\listoftables
\listoffigures
\addchap{Acknowledgment}
\lipsum[1-3]
\addchap{Abstract}
\lipsum[1-3]
\mainmatter
\chapter{Introduction}
\pagestyle{headings}
\lipsum[1-3]
\section{Motivation}
\lipsum[3-5]
Write Motivation of the research work
\section{Contribution}
\lipsum[5-6]
Write the thesis contribution
\section{Organization of thesis}
\lipsum[2-3]
Brief description of chapters in the thesis.
\subsection{Chapter 2: Literature Survey}
\lipsum[1-2]
\subsection{Chapter 3:}
\lipsum[1-2]
\subsection{Chapter 4:}
\lipsum[1-2]
\subsection{Chapter 5:}
\lipsum[1-2]
\subsection{Chapter 6:}
\lipsum[1-2]
\subsection{Chapter 7:}
\lipsum[1-2]
\end{document}

enter image description here

9
  • The header/Footer is appearing in TOC and other Lists. I need it to appear from the "Introduction" chapter onward ( From where Arabic numeral based page number starts)
    – Bukaida
    Aug 12, 2023 at 10:35
  • @Bukaida Even with my previous example, there wasn't a header in ToC, LoF, LoT etc. And your question is not clear in this point. I guess you don't want any header and footer in the whole frontmatter. So I've switched to page style empty (even for the chapter start page). See the KOMA-Script manual for more information about \chapterpagestyle, \pagestyle, etc.
    – cabohah
    Aug 12, 2023 at 10:47
  • Thank you, That is exactly what I wanted. Only one small modification if possible, the position of "Page no" and "chapter Num" should be at left, and "Jadavpur university" should be "right". However, if that requires huge modification, then I can also live with the present form.
    – Bukaida
    Aug 12, 2023 at 11:04
  • @Bukaida: Your image shows "Page no" and "Chapter Num" at the left on an even page, as my example does. IMHO "Page no" at the left of odd pages does not really make sense. But you can do it. For the footer just replace the argument of \rofoot* by the one of \lefoot* and also replace \ifoot* by two commands \refoot* and \lofoot*. IMHO not alternating the header on left/even and right/odd page also does not make sense. But you can do it. Please read \rohead, \lohead etc. in the KOMA-Script manual.
    – cabohah
    Aug 12, 2023 at 11:14
  • @Bukaida Hint: In addition to the chapter about scrlayer-scrpage in the KOMA-Script manual, there is a section in the KOMA-Script wiki with several more examples.
    – cabohah
    Aug 12, 2023 at 11:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .