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 the following example, I would like to make the "look" of the title of the document same as that of a chapter heading.

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\begin{document}

\title{Footer Testing}
\date{January 3, 2012}\maketitle

\chapter*{Preface}
\begin{flushleft}
\lipsum[1]\par
 \chapter*{What is footer?}
 \lipsum[2]
\end{flushleft}
\end{document}

One thing led to another, and I was looking at report.cls after a while.

In other words I like the \huge\bfseries chapter headings, and would like to use the same huge\bfseries for the title of the document. (I looked at the definition of \makechapterhead in report.cls to come to this conclusion. Please correct me if I am wrong.) However, I could not find the definition of @title in report.cls. (It seems @title is more fundamental.)

Is it possible to change the "look" of the @title to match the look of a chapter title, one way or another?

share|improve this question
3  
In answer to your question, "Yes". But how do you want the title to be the same as \chapter*? Do you want the same spacing as well, but with the \chapter* formatting/font? Also, what happens to \date? What should happen to \author? Do you print them in paragraph form or leave them as-is? Do you still want to use the same interface (via \maketitle)? –  Werner Jan 3 '12 at 19:00
    
I would like to have them as is. If I can learn how to change the \title then I think I could use that knowledge to change \author and \date if necessary. At this point, I am only interested in the title. Yes. I would like to have the same look, if that means including formatting, font(definitely), and spacing. I am not particular about \maketitle as long as I can get the same look by any means. For example, if you can use \titling package to get it done then I do not mind. However, reading the manual of the titling package did not help. –  Sony Jan 3 '12 at 20:51

2 Answers 2

up vote 3 down vote accepted

You can get the result by doing:

\documentclass[12pt]{report}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\begin{document}
    \title{\huge\bfseries Footer Testing} % already scoped in  report.cls
    \date{January 3, 2012}\maketitle


    \chapter*{Preface}
    \begin{flushleft}
        \lipsum[1]\par
        \chapter*{What is footer?}
        \lipsum[2]
    \end{flushleft}

\end{document}

For better customization the titlepage environment might be interesting. I took a look at report.cls. @title is only saving the title. Here a quote from report.cls of the relevant part.

\def\ps@myheadings{%
    \let\@oddfoot\@empty\let\@evenfoot\@empty
    \def\@evenhead{\thepage\hfil\slshape\leftmark}%
    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
    \let\@mkboth\@gobbletwo
    \let\chaptermark\@gobble
    \let\sectionmark\@gobble
    }
  \if@titlepage
  \newcommand\maketitle{\begin{titlepage}%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let \footnote \thanks
  \null\vfil
  \vskip 60\p@
  \begin{center}%
    {\LARGE \@title \par}%
    \vskip 3em%
    {\large
     \lineskip .75em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
      \vskip 1.5em%
    {\large \@date \par}%       % Set date in \large size.
  \end{center}\par
  \@thanks
  \vfil\null
  \end{titlepage}%
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
\else
\newcommand\maketitle{\par
  \begingroup
    \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
    \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
    \long\def\@makefntext##1{\parindent 1em\noindent
            \hb@xt@1.8em{%
                \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
    \if@twocolumn
      \ifnum \col@number=\@ne
        \@maketitle
      \else
        \twocolumn[\@maketitle]%
      \fi
    \else
      \newpage
      \global\@topnum\z@   % Prevents figures from going at top of page.
      \@maketitle
    \fi
    \thispagestyle{plain}\@thanks
  \endgroup
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
}
share|improve this answer
    
\title{\huge\bfseries Footer Testing} % already scoped in report.cls That was easy! But, why did not I pick it up while reading the report.cls? Thanks you very much. I will have to spend some time to understand your second solution. –  Sony Jan 3 '12 at 20:59
    
I just realized that you did not submit a second solution. This is part of the report.cls. It is like DeJaVu. :) Anyway, I do not fully understand how report.cls works. (I need time and I do not have enough of it now.) –  Sony Jan 3 '12 at 21:35
    
I just was thinking the quote from report.cls would help to understand the solution :D. I'll edit it so that this is clear. –  someonr Jan 4 '12 at 9:54

First, a comment. If you wish to see the definition of some command, you can prefix it with \show and inspect your .log file. Note that this will show the definition of the command as it is defined at that particular moment. For completeness, \@title is defined within latex.ltx as

\def\title#1{\gdef\@title{#1}}
\def\@title{\@latex@error{No \noexpand\title given}\@ehc}

which either sets \@title to be the same as \title (if you have a use \title), or it sets it as an error macro (if you don't use \title).

@someonr's answer provides the easiest way to format the title font in to your specifications. Note that \chapter and \chapter* formats the heading in \Huge\bfseries.

In order to modify the vertical alignment of \maketitle to match that of \chapter* (I assume you wish to keep the horizontal alignment/centering), a little more works needs to be done. You could just typeset it as a centered, unnumbered chapter using

\makeatletter
\title{Footer Testing}
\chapter*{\makebox[\linewidth]{\@title}}
\makeatother

but this will not typeset all the other title-related content with it. As such, perhaps a redefinition of \maketitle would work. Here is a minimal example:

enter image description here

\documentclass[12pt]{report}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\makeatletter
\renewcommand{\maketitle}{%
  \let\footnotesize\small
  \let\footnoterule\relax
  \let\footnote\thanks
  \chapter*{\makebox[\linewidth]{\@title}}
  \begin{center}
    \vskip\dimexpr 3em-40\p@\relax%
    {\large \lineskip .75em%
     \begin{tabular}[t]{c} \@author \end{tabular}\par}%
    \vskip 1.5em%
    {\large \@date \par}%
  \end{center}\par
  \@thanks
  \vfill\null\setcounter{footnote}{0}
  %\thispagestyle{empty}\addtocounter{page}{-1}
}
\makeatother
\begin{document}

\title{Footer Testing}
\date{January 3, 2012}
\author{Random Randofsky\thanks{Yo mama}}
\maketitle

\chapter*{Preface}
\lipsum[1]
\chapter*{What is footer?}
\lipsum[2]
\end{document}

If you wish to remove the footer (page number) on the first/title page, uncomment the last line of \maketitle which sets the page style to empty, and "resets" the page counter.

share|improve this answer
    
A great exposition in the usual Werner style. It is good to know about the \show command. I (occasionally) wondered if there is a command in LaTeX similar to that of Maple ?. –  Sony Jan 6 '12 at 17:20

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.