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.

In every pager header I want title, author left side and chapter name with indent and date on right side. I have been trying from long time. It's very important for my thesis. Please some one help me to solve this. Here is the MS Word representation:

[ Title ]  - [ Subtitle ]                                            1 Introduction
[Author’s name]                                                       2012-01-04
------------------------------------------------------------------------------------

1 Introduction

   xxxxxxxxxxxxxxxxxxxxxxxxxxx
-------------------------------------------------------------------------------------
                                  1

I edited the Alan's script a little..All i need is header and footer in Abstract, Acknowledgements and Introduction page also.. this is the edited script.

\documentclass{report}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage{lipsum} % for dummy text only


\makeatletter
% These commands follow the titling package format for titles
% They define user commands to format the subtitle
\newcommand\presubtitle[1]{\gdef\@presubtitle{#1}}
\newcommand\postsubtitle[1]{\gdef\@postsubtitle{#1}}
\newenvironment{alwayssingle}{%
       \@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn
       \else\newpage\fi}
       {\if@restonecol\twocolumn\else\newpage\fi}
\newenvironment{acknowledgements}
{\pagestyle{empty}
\begin{alwayssingle}
\begin{center}
\vspace*{1.5cm}
 \begin{flushleft} {\Large \bfseries Acknowledgements} \end{flushleft}
\end{center}
\vspace{0.5cm}
\begin{quote}}
{\end{quote}\end{alwayssingle}}
\newenvironment{abstracts}
{\pagestyle{empty}
\begin{alwayssingle}
\begin{center}
\vspace*{1.5cm}
 \begin{flushleft} {\Large \bfseries Abstract} \end{flushleft}
\end{center}
\vspace{0.5cm}
\begin{quote}}
{\end{quote}\end{alwayssingle}}
% This command takes the subtitle as its argument, and uses the titling command
% \maketitlehookb plus the previously defined formatting commands to insert
% the subtitle into the titlepage. It also generates \thesubtitle for subsequent use
\newcommand\subtitle[1]{%
  \renewcommand{\maketitlehookb}{\@presubtitle#1\@postsubtitle}
  \newcommand\thesubtitle{#1}}
\makeatother
% Now we define the formatting for the subtitle
\presubtitle{\begin{center}\Large} % change this as needed
\postsubtitle{\end{center}}
% Now enter the regular title information, with the new \subtitle command
\title{My Thesis Title}
\author{A.M. Author}
\subtitle{My subtitle}
\date{\today}

% These commands set up the headers. They are set up for even and odd pages the same
% Check the fancyhdr documentation for information on how to set them differently
% for odd and even pages
\lhead{\begin{tabular}{@{}l}\thetitle\ -- \thesubtitle\\\theauthor\end{tabular}}
\chead{}
\rhead{\begin{tabular}{r@{}}\leftmark\\\thedate\end{tabular}}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
% Set the width of the header rule. Make 0pt to remove the rule.
\renewcommand{\headrulewidth}{.5pt}
\renewcommand{\footrulewidth}{.5pt}
% Make the head height match the size of the header
\setlength{\headheight}{24pt}
\pagestyle{fancy}
% Remove "Chapter" from the marks
\renewcommand{\chaptermark}[1]{%
  \markboth{\thechapter.\ #1}{}}

\begin{document}
\maketitle
\begin{abstracts}
\end{abstracts}
\begin{acknowledgements}
\end{acknowledgements}
\chapter{Introduction}
\lipsum\lipsum
\end{document}
share|improve this question
    
What does [Title] and [Subtitle] represent? –  Werner Jan 30 '12 at 21:11
    
Have a look at the packages fancyhdr and scrpage2. It depends on the documentclass. scrpage2 is recommend by a KOMA-class. –  Marco Daniel Jan 30 '12 at 21:23
    
I am very new to latex and have been wasting days to get this format.. –  volatNumbers Jan 30 '12 at 21:25
    
@Werner, tile is the document title and subtitle is work related code.. –  volatNumbers Jan 30 '12 at 21:34
add comment

1 Answer

up vote 14 down vote accepted

Here's a version of what you want to do using the fancyhdr and titling packages. I've created a new command \subtitle (with associated formatting hooks) for the subtitle, which is not standardly provided by most document classes.

\documentclass{report}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage{lipsum} % for dummy text only

\makeatletter
% These commands follow the titling package format for titles
% They define user commands to format the subtitle
\newcommand\presubtitle[1]{\gdef\@presubtitle{#1}}
\newcommand\postsubtitle[1]{\gdef\@postsubtitle{#1}}
% This command takes the subtitle as its argument, and uses the titling command
% \maketitlehookb plus the previously defined formatting commands to insert
% the subtitle into the titlepage. It also generates \thesubtitle for subsequent use
\newcommand\subtitle[1]{%
  \renewcommand{\maketitlehookb}{\@presubtitle#1\@postsubtitle}
  \newcommand\thesubtitle{#1}}
\makeatother
% Now we define the formatting for the subtitle
\presubtitle{\begin{center}\Large} % change this as needed
\postsubtitle{\end{center}}
% Now enter the regular title information, with the new \subtitle command
\title{My Thesis Title}
\author{A.M. Author}
\subtitle{My subtitle}
\date{\today}

% These commands set up the headers. They are set up for even and odd pages the same
% Check the fancyhdr documentation for information on how to set them differently
% for odd and even pages
\lhead{\begin{tabular}{@{}l}\thetitle\ -- \thesubtitle\\\theauthor\end{tabular}}
\chead{}
\rhead{\begin{tabular}{r@{}}\leftmark\\\thedate\end{tabular}}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
% Set the width of the header rule. Make 0pt to remove the rule.
\renewcommand{\headrulewidth}{.5pt}
\renewcommand{\footrulewidth}{0pt}
% Make the head height match the size of the header
\setlength{\headheight}{24pt}
\pagestyle{fancy}
% Remove "Chapter" from the marks
\renewcommand{\chaptermark}[1]{%
  \markboth{\thechapter.\ #1}{}}

\begin{document}
\maketitle
\chapter{Introduction}
\lipsum\lipsum
\end{document}

sample header

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.