1

I'm trying to modify \maketitle to add a logo before the title, but it's not showing. I'm gessing the because of the titlepage option in \documentclass[titlepage, a4paper, 12pt]{article} but how to solve it ?

Here is my document :

\documentclass[titlepage, a4paper, 12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{diagbox}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{hyperref}

\title{CatCatch\\Cahier des charges\\42/2}
\author{John \bsc{Doe} \and Foo \bsc{Bar} \and Someone \bsc{Else}}
\date{19 janvier 2018}

\makeatletter
\renewcommand{\and}{\\}
\def\@maketitle{
    \begin{center}
        \includegraphics[width=120mm]{logo.png}\\[8ex]
        {\Huge \@title }\\[4ex] 
        {\Large \@author}\\[4ex] 
        \@date\\[8ex]
    \end{center}}
\makeatother

\begin{document}
    \maketitle
\end{document}
3
  • Just remove the titlepage option. What's its purpose? – egreg Jan 15 '18 at 13:22
  • What's the point of redefining \maketitle? What's wrong with \title{\includegraphics[width=120mm]{logo.png}\\[8ex] CatCatch\\Cahier des charges\\42/2} with the original \maketitle command? – user121799 Jan 15 '18 at 13:24
  • the purpose of titlepage is to have the title page separated from the rest of the document – Marc Schmitt Jan 15 '18 at 13:28
1

The report class defines \maketitle in two different ways, according to the presence of the titlepage option.

When the option is specified, \maketitle will not use \@maketitle, but will directly arrange the elements.

When the option is specified, \maketitle will delegate some aspects to \@maketitle. Use the titlepage environment in the redefinition of \@maketitle.

So, the correct definition for \@maketitle should be

\def\@maketitle{%
  \begin{titlepage}
  \centering
  \includegraphics[width=120mm]{logo.png}\\[8ex]
  {\Huge \@title\\[4ex]}% <-- note where the brace is
  {\Large \@author\\[4ex]}% <-- note where the brace is
  \@date
  \end{titlepage}%
}

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.