I am making a bank of exercises for a course. To do this, I use the exam class, which uses the same sectioning as the article class.
To do this, I have a separate .tex files with the questions, inside sections, subsections that uses the exam class format.
The main .tex file consists only of a \Part{Questions} \input{questions.tex} and a \Part{Answers} \input{questions.tex}. When the \part is printed, it gives the following:
Part I
Questions
I would like to remove the Part 1 header.
@Werner has a solution in this question, where the report class had been used. Using is solution seems to work, but LaTeX gives me a undefined control sequence for each \part I have.
Here is a MWE without Werner's solution
\documentclass[12pt]{exam}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts,amsmath,amssymb,amsthm,mathrsfs}
\usepackage{sectsty}
\pagestyle{headandfoot}
\firstpageheadrule
\firstpageheader{Probabilités}{}{MAT-1720}
\firstpagefooter{}{}{\thepage}
\firstpagefootrule
\runningheadrule
\runningheader{Probabilités}{}{MAT-1720}
\runningfooter{Nom du professeur}{}{\thepage}
\runningfootrule
\title{Banque d'exercices pour MAT-1720}
\author{Nom du professeur - Institut}
\date{Automne 2014}
\begin{document}
\maketitle
\thispagestyle{headandfoot}
\tableofcontents
\newpage
\part{Questions}
\noprintanswers
\begin{questions}
\newcounter{NombredeQ}
\setcounter{NombredeQ}{1}
\newcounter{NombredeR}
\setcounter{NombredeR}{1}
\section{ Dénombrement }
\subsection{Principes de dénombrement}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}} Ceci est une question test. Quel est le sigle du cours probabilités à l'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le sigle est MAT-1720.
\end{solution}
\subsection{Permutations et Combinaisons}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}}
Ceci est une autre question test. Quel est le nom du cours qui a pour sigle MAT-1720 à L'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le cours est probabilité.
\end{solution}
\newpage
\part{Solutions}
\qformat{\shadowbox{\textbf{Solution à l'exercice} \theNombredeQ} \hfill}
\printanswers
\section{ Dénombrement }
\subsection{Principes de dénombrement}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}} Ceci est une question test. Quel est le sigle du cours probabilités à l'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le sigle est MAT-1720.
\end{solution}
\subsection{Permutations et Combinaisons}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}}
Ceci est une autre question test. Quel est le nom du cours qui a pour sigle MAT-1720 à L'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le cours est probabilité.
\end{solution}
\end{questions}
\end{document}
And now the same code with Werner's code
\documentclass[12pt]{exam}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage[francais]{babel}
\usepackage{amsfonts,amsmath,amssymb,amsthm,mathrsfs}
\usepackage{sectsty}
\usepackage{hyperref}
\makeatletter
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
\addcontentsline{toc}{part}{#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
\markboth{}{}%
{\centering
\interlinepenalty \@M
\normalfont
\Huge \bfseries #2\par}%
\@endpart}
\makeatother
\pagestyle{headandfoot}
\firstpageheadrule
\firstpageheader{Probabilités}{}{MAT-1720}
\firstpagefooter{}{}{\thepage}
\firstpagefootrule
\runningheadrule
\runningheader{Probabilités}{}{MAT-1720}
\runningfooter{Nom du professeur}{}{\thepage}
\runningfootrule
\title{Banque d'exercices pour MAT-1720}
\author{Nom du professeur - Institut}
\date{Automne 2014}
\begin{document}
\maketitle
\thispagestyle{headandfoot}
\tableofcontents
\newpage
\part{Questions}
\noprintanswers
\begin{questions}
\newcounter{NombredeQ}
\setcounter{NombredeQ}{1}
\newcounter{NombredeR}
\setcounter{NombredeR}{1}
\section{ Dénombrement }
\subsection{Principes de dénombrement}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}} Ceci est une question test. Quel est le sigle du cours probabilités à l'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le sigle est MAT-1720.
\end{solution}
\subsection{Permutations et Combinaisons}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}}
Ceci est une autre question test. Quel est le nom du cours qui a pour sigle MAT-1720 à L'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le cours est probabilité.
\end{solution}
\newpage
\part{Solutions}
\printanswers
\section{ Dénombrement }
\subsection{Principes de dénombrement}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}} Ceci est une question test. Quel est le sigle du cours probabilités à l'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le sigle est MAT-1720.
\end{solution}
\subsection{Permutations et Combinaisons}
\question \ifthenelse{\boolean{printanswers}}{\label{R:\theNombredeR}}{\label{Q:\thequestion}}
Ceci est une autre question test. Quel est le nom du cours qui a pour sigle MAT-1720 à L'UdeM?
\\\ifthenelse{\boolean{printanswers}}{\textbf{Retour à la question \ref{Q:\theNombredeQ}.}\stepcounter{NombredeQ} \stepcounter{NombredeR}}{\textbf{Voir la \hyperref[R:\thequestion]{solution} à la question. }}
\begin{solution}
Le cours est probabilité.
\end{solution}
\end{questions}
\end{document}
It gives the intended results, but leaves an error.