3

Following this answer I'm trying to customize the cover of a report, which works fine for articles, but doesn't seem to work for reports. For example:

\documentclass[a4paper,12pt]{article}
\usepackage{geometry}

\makeatletter         
\def\@maketitle{
\raggedright
\begin{center}
{\Huge \bfseries \sffamily \@title }\\[4ex] 
{\Large  \@author}\\[4ex] 
\@date\\[8ex]
\end{center}}
\makeatother

\begin{document}

\title{Report}
\author{Author}
\date{Septembre 2013}

\maketitle

\end{document}

works, but when I change article to report the custom title page layout is lost. I could manually use e.g. \begin{titlepage} .., but I actually like the idea of having the definition of the title page elsewhere (for example a custom .sty file) and only including title{}, author{}, and date{} in each document.

Can this somehow be done using the report class?

3
  • It is a4paper,12pt, not a4paper12pt. – user156344 Apr 26 '19 at 7:31
  • Sorry, quickly copy-pasted it like this from the example – Bart Apr 26 '19 at 8:05
  • No problem, I understand it. See if my answer solves the issue – user156344 Apr 26 '19 at 8:06
2

\maketitle is not a core command; it is defined in each classes. In article, it is defined differently from in report or book.

So why don't you redefine \maketitle directly? No need of redefining \@maketitle.

Btw to keep the formatting, i.e. apply \raggedright for only the title, you need to place the whole thing inside a group.

\documentclass[a4paper,12pt]{report} % Not a4paper12pt
\usepackage{geometry}

\makeatletter         
\renewcommand\maketitle{
{\raggedright % Note the extra {
\begin{center}
{\Huge \bfseries \sffamily \@title }\\[4ex] 
{\Large  \@author}\\[4ex] 
\@date\\[8ex]
\end{center}}} % Note the extra }
\makeatother

\usepackage{lipsum}
\begin{document}

\title{Report}
\author{Author}
\date{Septembre 2013}

\maketitle

\lipsum[1]
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.