I didn't do the whole titlepage, mainly because the main idea is th same over and over again, on the other hand ... The titlepage you are showing is as ugly as one would suggest do see university course material puked down on paper. Sorry, but that is the main idea, getting some information out, no matter how ugly it looks. If you would provide free typesetters, some people would use those instead of a computer.
Code: Select all
%\RequirePackage{filecontents}
\begin{filecontents}{chamPlanDeCours.sty}
\NeedsTeXFormat{LaTeX2e}[2012/01/01]
\ProvidesPackage{chamPlanDeCours}
\RequirePackage{tcolorbox}
\RequirePackage{textcase}
\RequirePackage{xparse}
\RequirePackage{graphicx}
\newcommand{\name}[1]{\gdef\@name{#1}\def\thiscourse{{\itshape#1}}}
\newcommand{\session}[1]{\gdef\@session{#1}}
\newcommand{\courseplanname}[1]{\gdef\@courseplanname{#1}}
\newcommand{\@courseplanname}{Plan de Cours}
\newcommand{\telephone}[1]{\gdef\@telephone{#1}}
\newcommand{\@telephone}{\raggedright 012 3145 78\\(general advisor)}
\newcommand{\@competence}{}
\newcommand{\competence}[1]{\gdef\@competence{#1}}
\newcommand{\local}[1]{\gdef\@local{#1}}
\newcommand{\teacher}[1]{\gdef\@teacher{#1}}
\newcommand{\addcomment}[1]{\gdef\@comment{#1}}
\newcommand{\numbers}[3]{
\def\numberone{#1}
\def\numbertwo{#2}
\def\numberthree{#3}}
\NewDocumentCommand{\ponderation}{
>{\SplitArgument{2}{-}}m}
{\numbers#1}
\renewcommand{\maketitle}{%
\begin{titlepage}
\sffamily
\setlength{\parskip}{0pt}\setlength{\parindent}{0pt}\setlength{\parfillskip}{0pt plus 1fil}
\vspace*{-5\baselineskip}
\includegraphics[width=.4\textwidth]{example-image-a.pdf}%explicitly
% use the pdf here
\par\vspace{2cm}
\begin{tcolorbox}
\centering
\huge \MakeTextUppercase{\@courseplanname}
\par
\@name
\end{tcolorbox}
\vspace{3ex}
\begin{description}
\item [Session:] \@session
\vspace{1cm}
\item [Pond\'eration:]
\numberone--\numbertwo--\numberthree
\ifdefempty{\@competence}{}{\item [Competence:] \@competence}
\end{description}
\begin{tcolorbox}
\begin{tabular}{c@{\hspace{3em}}p{0.3\textwidth}@{\hspace{3em}}p{0.3\textwidth}}
Professor & Telephone & Local \\[1ex]
\@teacher & \@telephone &
\raggedright\@local
\end{tabular}
\end{tcolorbox}
\addvspace{4ex}
\begin{minipage}{\linewidth}
\@comment
\end{minipage}
\end{titlepage}
}
\renewcommand*\descriptionlabel[1]{\hspace\labelsep
\sffamily\bfseries #1}
\endinput
\end{filecontents}
%Now the document starts
\documentclass{article}
\usepackage{chamPlanDeCours}%Load the titlepage
\name{Ondes et physique moderne}
\session{Summer 2015}
\teacher{Cham}
\ponderation{3-2-3}
%\telephone{chams number}
%\competence{A kind of common sense}
\local{Central building\\Room 101\\Northeast Avenue\\Not Paris}
\addcomment{There is a lot to learn in \thiscourse, there are
\numberone{} points available for the written test.
}
\begin{document}
\maketitle
\end{document}
This makes a quite simple titlepage. To be honest, i would even omit the grey boxes. If a student cannot find relevant information on one simple piece of paper, he should consider his decision to study.
Some fields are mandatory, you cannot compile without error if you haven't set them. you could set a warning like in the standard classes.
Some fields can be left empty, and a default replacement text is printed.
Some fields can be left out and if so, the whole line isn't printed using a conditional.
One thing i did out of pure
i am used to it and
laziness: Mixing up TeX (
\def
), LaTeX2e (
\newcommand
) and the user interface of LaTeX3 (
\NewDocumentCommand
). A titlepage is so simple, that i won't suspect any stuff breaking, but nevertheless, the style is bad.
Please play around a little bit. You can show the final result and i'll take a look at it. I might have improvements to make.
Depending on how static the titlepage appearance should be, you should consider placing hooks for the fonts. Either for the convenience of the end user (which i guess won't have acces to them

) or for your convenience as the maintainer/developer of the titlepage stuff.
When develooping code for yourself and especially for others, there is one question that should ever be in your head: How flexible do i want to be? Or What crazy stuff could the user put here? If you ask a user to say »left«
or »right«, you can be sure that at least one out of one hundred says »garden hose« and breaks everything.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.