3

Here is my main file:

\documentclass{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}

\include{definitions/pagetitre}

\title{Text}

\author{Text}

\sujet{Text}

\motsclefs{Text}

\datedebut{September 26th}
\datefin{December 3, 2005}

\superviseurs{Name1 \textsc{Blabla} (ACRONYM)}

\proverbe{A leader is someone who steps back from the entire system and tries to build a more collaborative, more innovative system that will work over the long term.}
\auteurproverbe{Robert Reich, United States Secretary of Labor (1993--1997)}

\begin{document}

\maketitle

\paragraph{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vestibulum risus nec dapibus aliquam. Phasellus ultricies egestas erat sed mollis. Etiam euismod tortor ut ante rutrum consequat. Nunc id sem convallis, iaculis diam quis, facilisis nulla. Aliquam leo lorem, ultricies.

\end{document}

And here is definitions/pagetitre.tex:

%%%%%%%% Feuilles de style page de titre %%%%%%%%%%

\makeatletter
\def\maketitle{%
    \thispagestyle{empty}%\vbox to \vsize{%
    \LARGE
        \begin{flushright}%
            \@sujet\\  
            \hrulefill
        \end{flushright}%
    \vfill
    \begin{center}%
        \textbf{\huge \@title}\\
        \vspace{1cm}%
        \Large{ \@author}%
    \end{center}%
\par
\vfill

\large
    \begin{tabularx}{\textwidth}{lX}%
        \textbf{Keywords} & \@motsclefs\\[0.2cm]
        \textbf{Dates} & \@datedebut  --- \@datefin\\[0.2cm]
        \textbf{Supervisors} & \@superviseurs
    \end{tabularx}%
  %  }%
  \clearpage
\vfill
\Large
\emph{\og\@proverbe\fg}
\begin{flushright}
    \@auteurproverbe
\end{flushright}
\vfill
\normalsize
%\clearpage
  }

\def\date#1{\def\@date{#1}}
\def\author#1{\def\@author{#1}}
\def\title#1{\def\@title{#1}}
\def\departement#1{\def\@departement{#1}}
\def\filiere#1{\def\@filiere{#1}}
\def\motsclefs#1{\def\@motsclefs{#1}}
\def\datedebut#1{\def\@datedebut{#1}}
\def\datefin#1{\def\@datefin{#1}}
\def\sujet#1{\def\@sujet{#1}}
\def\proverbe#1{\def\@proverbe{#1}}
\def\auteurproverbe#1{\def\@auteurproverbe{#1}}
\def\superviseurs#1{\def\@superviseurs{#1}}



% Valeurs par défaut
\proverbe{}
\auteurproverbe{}
\sujet{}
\departement{}
\filiere{}
\motsclefs{}
\datedebut{\today}
\datefin{\today}
\superviseurs{\@author} 

Does anyone know why it does not compile? The error is LaTeX doesn't know the command \maketitle...

And when I delete the command \maketitle, it works, but the custom title doesn't appear at all.

  • 2
    Please put the exact error you get, do not paraphrase it. I get ! LaTeX Error: Environment tabularx undefined. which is expected as the tabularx package is not loaded. Also you should use \input (or better \usepackage) for including macros, not \include – David Carlisle Jul 22 '13 at 12:34
  • @user2429940 in fact David is right (and faster than I am). The mistake was the undefined tabularx environment which prevented your example to compile, including it solves the pb... – Vser Jul 22 '13 at 12:38
5

As the error message states tabularx is not defined, so you need to load tabularx. Also there were some accented A in your page title file, look like a mis-encoding of utf8 no break space. I removed those and also added \noindent before the tabularx so that you can get a full width table (otherwise the line is over-full by 15pt = the paragraph indentation). Also use \input not \include.

\documentclass{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{tabularx}
\input{pagetitre}

\title{Text}

\author{Text}

\sujet{Text}

\motsclefs{Text}

\datedebut{September 26th}
\datefin{December 3, 2005}

\superviseurs{Name1 \textsc{Blabla} (ACRONYM)}

\proverbe{A leader is someone who steps back from the entire system and tries to build a more collaborative, more innovative system that will work over the long term.}
\auteurproverbe{Robert Reich, United States Secretary of Labor (1993--1997)}

\begin{document}

\maketitle

\paragraph{Lorem ipsum}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur vestibulum risus nec dapibus aliquam. Phasellus ultricies egestas erat sed mollis. Etiam euismod tortor ut ante rutrum consequat. Nunc id sem convallis, iaculis diam quis, facilisis nulla. Aliquam leo lorem, ultricies.

\end{document}

%%%%%%%% Feuilles de style page de titre %%%%%%%%%%

\makeatletter
\def\maketitle{%
    \thispagestyle{empty}%\vbox to \vsize{%
    \LARGE
        \begin{flushright}%
            \@sujet\\
            \hrulefill
        \end{flushright}%
    \vfill
    \begin{center}%
        \textbf{\huge \@title}\\
        \vspace{1cm}%
        \Large{ \@author}%
    \end{center}%
\par
\vfill

\large
    \noindent\begin{tabularx}{\textwidth}{lX}%
        \textbf{Keywords} & \@motsclefs\\[0.2cm]
        \textbf{Dates} & \@datedebut  --- \@datefin\\[0.2cm]
        \textbf{Supervisors} & \@superviseurs
    \end{tabularx}%
%}%
\clearpage
\vfill
\Large
\emph{\og\@proverbe\fg}
\begin{flushright}
    \@auteurproverbe
\end{flushright}
\vfill
\normalsize
%\clearpage
}

\def\date#1{\def\@date{#1}}
\def\author#1{\def\@author{#1}}
\def\title#1{\def\@title{#1}}
\def\departement#1{\def\@departement{#1}}
\def\filiere#1{\def\@filiere{#1}}
\def\motsclefs#1{\def\@motsclefs{#1}}
\def\datedebut#1{\def\@datedebut{#1}}
\def\datefin#1{\def\@datefin{#1}}
\def\sujet#1{\def\@sujet{#1}}
\def\proverbe#1{\def\@proverbe{#1}}
\def\auteurproverbe#1{\def\@auteurproverbe{#1}}
\def\superviseurs#1{\def\@superviseurs{#1}}



% Valeurs par défaut
\proverbe{}
\auteurproverbe{}
\sujet{}
\departement{}
\filiere{}
\motsclefs{}
\datedebut{\today}
\datefin{\today}
\superviseurs{\@author} 

Your Answer

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